Top Description Inners Fields Constructors Methods
org.springframework.web.reactive.config

public Class ViewResolverRegistry

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Arrays, .List, org.springframework.beans.factory.BeanFactoryUtils, .BeanInitializationException, org.springframework.context.ApplicationContext, org.springframework.core.Ordered, org.springframework.lang.Nullable, org.springframework.util.ObjectUtils, org.springframework.web.reactive.result.view.HttpMessageWriterView, .UrlBasedViewResolver, .View, .ViewResolver, org.springframework.web.reactive.result.view.freemarker.FreeMarkerConfigurer, .FreeMarkerViewResolver, org.springframework.web.reactive.result.view.script.ScriptTemplateConfigurer, .ScriptTemplateViewResolver

Assist with the configuration of a chain of 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.

Authors
Rossen Stoyanchev, Sebastien Deleuze
Since
5.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class

Field Summary

Modifier and TypeField and Description
private final ApplicationContext
private final List<View>
private Integer
private final List<ViewResolver>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private boolean
checkBeanOfType(Class<?> beanType)

public void
defaultViews(View... defaultViews)

Set default views associated with any view name and selected based on the best match for the requested content type.

public UrlBasedViewResolverRegistration
freeMarker()

Register a FreeMarkerViewResolver with a ".ftl" suffix.

protected List<View>
protected int
protected List<ViewResolver>
public boolean
hasRegistrations()

Whether any view resolvers have been registered.

public void
order(int order)

Set the order for the ViewResolutionResultHandler.

public UrlBasedViewResolverRegistration
scriptTemplate()

Register a script template view resolver with an empty default view name prefix and suffix.

public void
viewResolver(ViewResolver viewResolver)

Register a ViewResolver bean instance.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

applicationContextback to summary
private final ApplicationContext applicationContext
Annotations
@Nullable
defaultViewsback to summary
private final List<View> defaultViews
orderback to summary
private Integer order
Annotations
@Nullable
viewResolversback to summary
private final List<ViewResolver> viewResolvers

Constructor Detail

ViewResolverRegistryback to summary
public ViewResolverRegistry(ApplicationContext applicationContext)

Method Detail

checkBeanOfTypeback to summary
private boolean checkBeanOfType(Class<?> beanType)
defaultViewsback to summary
public void defaultViews(View... defaultViews)

Set default views associated with any view name and selected based on the best match for the requested content type.

Use HttpMessageWriterView to adapt and use any existing HttpMessageWriter (e.g. JSON, XML) as a View.

freeMarkerback to summary
public UrlBasedViewResolverRegistration freeMarker()

Register a FreeMarkerViewResolver with a ".ftl" suffix.

Note

that you must also configure FreeMarker by adding a FreeMarkerConfigurer bean.

getDefaultViewsback to summary
protected List<View> getDefaultViews()
getOrderback to summary
protected int getOrder()
getViewResolversback to summary
protected List<ViewResolver> getViewResolvers()
hasRegistrationsback to summary
public boolean hasRegistrations()

Whether any view resolvers have been registered.

orderback to summary
public void order(int order)

Set the order for the ViewResolutionResultHandler.

By default this property is not set, which means the result handler is ordered at Ordered#LOWEST_PRECEDENCE.

scriptTemplateback to summary
public UrlBasedViewResolverRegistration scriptTemplate()

Register a script template view resolver with an empty default view name prefix and suffix.

Note

that you must also configure script templating by adding a ScriptTemplateConfigurer bean.

Since
5.0.4
viewResolverback to summary
public void viewResolver(ViewResolver viewResolver)

Register a 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.

org.springframework.web.reactive.config back to summary

private Class ViewResolverRegistry.FreeMarkerRegistration

extends UrlBasedViewResolverRegistration
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from org.springframework.web.reactive.config.UrlBasedViewResolverRegistration:
getViewResolverprefixsuffixviewClassviewNames

Constructor Detail

FreeMarkerRegistrationback to summary
public FreeMarkerRegistration()
org.springframework.web.reactive.config back to summary

private Class ViewResolverRegistry.ScriptRegistration

extends UrlBasedViewResolverRegistration
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from org.springframework.web.reactive.config.UrlBasedViewResolverRegistration:
getViewResolverprefixsuffixviewClassviewNames

Constructor Detail

ScriptRegistrationback to summary
public ScriptRegistration()