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 context. |
static IThymeleafRequestContext |
getRequestContext(org.thymeleaf.context.IExpressionContext context)
Get the
IThymeleafRequestContext from the Thymeleaf context. |
public static org.springframework.context.ApplicationContext getApplicationContext(org.thymeleaf.context.ITemplateContext context)
Get the ApplicationContext
from the Thymeleaf context.
context
- the template contextpublic static IThymeleafRequestContext getRequestContext(org.thymeleaf.context.IExpressionContext context)
Get the IThymeleafRequestContext
from the Thymeleaf context.
The returned object is a wrapper on the Spring request context that hides the fact of this request context corresponding to a Spring Web MVC or Spring Web Reactive application.
This will be done by looking for a context variable called
SpringContextVariableNames.THYMELEAF_REQUEST_CONTEXT
.
context
- the contextCopyright © 2017 The THYMELEAF team. All rights reserved.