类 ViewResolverRegistry
- java.lang.Object
- org.springframework.web.reactive.config.ViewResolverRegistry
public class ViewResolverRegistry extends Object
Assist with the configuration of a chain ofViewResolver's supporting different template mechanisms.In addition, you can also configure
defaultViewsfor rendering according to the requested content type, e.g. JSON, XML, etc.- 从以下版本开始:
- 5.0
- 作者:
- Rossen Stoyanchev, Sebastien Deleuze
构造器概要
构造器 构造器 说明 ViewResolverRegistry(ApplicationContext applicationContext)
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voiddefaultViews(View... defaultViews)Set default views associated with any view name and selected based on the best match for the requested content type.UrlBasedViewResolverRegistrationfreeMarker()Register aFreeMarkerViewResolverwith a ".ftl" suffix.protected List<View>getDefaultViews()protected intgetOrder()protected List<ViewResolver>getViewResolvers()booleanhasRegistrations()Whether any view resolvers have been registered.voidorder(int order)Set the order for theViewResolutionResultHandler.UrlBasedViewResolverRegistrationscriptTemplate()Register a script template view resolver with an empty default view name prefix and suffix.voidviewResolver(ViewResolver viewResolver)Register aViewResolverbean instance.
构造器详细资料
ViewResolverRegistry
public ViewResolverRegistry(@Nullable ApplicationContext applicationContext)
方法详细资料
freeMarker
public UrlBasedViewResolverRegistration freeMarker()
Register aFreeMarkerViewResolverwith a ".ftl" suffix.Note that you must also configure FreeMarker by adding a
FreeMarkerConfigurerbean.
scriptTemplate
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
ScriptTemplateConfigurerbean.- 从以下版本开始:
- 5.0.4
viewResolver
public void viewResolver(ViewResolver viewResolver)
Register aViewResolverbean 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.
defaultViews
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
HttpMessageWriterViewto adapt and use any existingHttpMessageWriter(e.g. JSON, XML) as aView.
hasRegistrations
public boolean hasRegistrations()
Whether any view resolvers have been registered.
order
public void order(int order)
Set the order for theViewResolutionResultHandler.By default this property is not set, which means the result handler is ordered at
Ordered.LOWEST_PRECEDENCE.
getOrder
protected int getOrder()
getViewResolvers
protected List<ViewResolver> getViewResolvers()
getDefaultViews
protected List<View> getDefaultViews()