public class SpringContextUtils extends Object
Utility class for easy access of information stored at the context in a Spring-enabled application (such as the Spring ApplicationContext).
Modifier and Type | Method and Description |
---|---|
static org.springframework.context.ApplicationContext |
getApplicationContext(org.thymeleaf.context.ITemplateContext context)
Get the
ApplicationContext from the Thymeleaf template context. |
public static org.springframework.context.ApplicationContext getApplicationContext(org.thymeleaf.context.ITemplateContext context)
Get the ApplicationContext
from the Thymeleaf template context.
Note that the application context might not be always accessible (and thus this method
can return null). Application Context will be accessible when the template is being executed
as a Spring View, or else when an object of class ThymeleafEvaluationContext
has been
explicitly set into the ITemplateContext
context with variable name
ThymeleafEvaluationContext.THYMELEAF_EVALUATION_CONTEXT_CONTEXT_VARIABLE_NAME
.
context
- the template context.Copyright © 2017 The THYMELEAF team. All rights reserved.