public class ViewResolverRegistry
extends java.lang.Object
ViewResolver
's supporting
different template mechanisms.
In addition, you can also configure defaultViews
for rendering according to the requested content type, e.g.
JSON, XML, etc.
Modifier and Type | Class and Description |
---|---|
private static class |
ViewResolverRegistry.FreeMarkerRegistration |
Modifier and Type | Field and Description |
---|---|
private ApplicationContext |
applicationContext |
private java.util.List<View> |
defaultViews |
private java.lang.Integer |
order |
private java.util.List<ViewResolver> |
viewResolvers |
Constructor and Description |
---|
ViewResolverRegistry(ApplicationContext applicationContext) |
Modifier and Type | Method and Description |
---|---|
private boolean |
checkBeanOfType(java.lang.Class<?> beanType) |
void |
defaultViews(View... defaultViews)
Set default views associated with any view name and selected based on the
best match for the requested content type.
|
UrlBasedViewResolverRegistration |
freeMarker()
Register a
FreeMarkerViewResolver with a ".ftl" suffix. |
protected java.util.List<View> |
getDefaultViews() |
protected int |
getOrder() |
protected java.util.List<ViewResolver> |
getViewResolvers() |
boolean |
hasRegistrations()
Whether any view resolvers have been registered.
|
void |
order(int order)
Set the order for the
ViewResolutionResultHandler . |
void |
viewResolver(ViewResolver viewResolver)
Register a
ViewResolver bean instance. |
@Nullable private final ApplicationContext applicationContext
private final java.util.List<ViewResolver> viewResolvers
private final java.util.List<View> defaultViews
@Nullable private java.lang.Integer order
public ViewResolverRegistry(@Nullable ApplicationContext applicationContext)
public UrlBasedViewResolverRegistration freeMarker()
FreeMarkerViewResolver
with a ".ftl" suffix.
Note that you must also configure FreeMarker by
adding a FreeMarkerConfigurer
bean.
public void viewResolver(ViewResolver viewResolver)
ViewResolver
bean instance. This may be useful to
configure a 3rd party resolver implementation or as an alternative to
other registration methods in this class when they don't expose some
more advanced property that needs to be set.public void defaultViews(View... defaultViews)
Use HttpMessageWriterView
to adapt and use any existing
HttpMessageWriter
(e.g. JSON, XML) as a View
.
public boolean hasRegistrations()
public void order(int order)
ViewResolutionResultHandler
.
By default this property is not set, which means the result handler is
ordered at Ordered.LOWEST_PRECEDENCE
.
private boolean checkBeanOfType(java.lang.Class<?> beanType)
protected int getOrder()
protected java.util.List<ViewResolver> getViewResolvers()
protected java.util.List<View> getDefaultViews()