use of cn.taketoday.context.condition.ConditionalOnBean in project today-infrastructure by TAKETODAY.
the class WebMvcAutoConfiguration method viewResolver.
@Component
@ConditionalOnBean(ViewResolver.class)
@ConditionalOnMissingBean(name = "viewResolver", value = ContentNegotiatingViewResolver.class)
public ContentNegotiatingViewResolver viewResolver(@Nullable ContentNegotiationManager contentNegotiationManager) {
ContentNegotiatingViewResolver resolver = new ContentNegotiatingViewResolver();
resolver.setContentNegotiationManager(contentNegotiationManager);
// ContentNegotiatingViewResolver uses all the other view resolvers to locate
// a view so it should have a high precedence
resolver.setOrder(Ordered.HIGHEST_PRECEDENCE);
return resolver;
}
use of cn.taketoday.context.condition.ConditionalOnBean in project today-framework by TAKETODAY.
the class HttpMessageConvertersAutoConfiguration method stringHttpMessageConverter.
@Component
@ConditionalOnMissingBean
@ConditionalOnBean(ServerProperties.class)
public StringHttpMessageConverter stringHttpMessageConverter(Environment environment, ServerProperties serverProperties) {
Encoding encoding = serverProperties.getEncoding();
Charset charset = encoding.getCharset();
StringHttpMessageConverter converter = new StringHttpMessageConverter(charset);
converter.setWriteAcceptCharset(false);
return converter;
}
use of cn.taketoday.context.condition.ConditionalOnBean in project today-framework by TAKETODAY.
the class WebMvcAutoConfiguration method beanNameViewResolver.
@Component
@ConditionalOnBean(View.class)
@ConditionalOnMissingBean
public BeanNameViewResolver beanNameViewResolver() {
BeanNameViewResolver resolver = new BeanNameViewResolver();
resolver.setOrder(Ordered.LOWEST_PRECEDENCE - 10);
return resolver;
}
use of cn.taketoday.context.condition.ConditionalOnBean in project today-framework by TAKETODAY.
the class WebMvcAutoConfiguration method viewResolver.
@Component
@ConditionalOnBean(ViewResolver.class)
@ConditionalOnMissingBean(name = "viewResolver", value = ContentNegotiatingViewResolver.class)
public ContentNegotiatingViewResolver viewResolver(@Nullable ContentNegotiationManager contentNegotiationManager) {
ContentNegotiatingViewResolver resolver = new ContentNegotiatingViewResolver();
resolver.setContentNegotiationManager(contentNegotiationManager);
// ContentNegotiatingViewResolver uses all the other view resolvers to locate
// a view so it should have a high precedence
resolver.setOrder(Ordered.HIGHEST_PRECEDENCE);
return resolver;
}
use of cn.taketoday.context.condition.ConditionalOnBean in project today-infrastructure by TAKETODAY.
the class WebMvcAutoConfiguration method beanNameViewResolver.
@Component
@ConditionalOnBean(View.class)
@ConditionalOnMissingBean
public BeanNameViewResolver beanNameViewResolver() {
BeanNameViewResolver resolver = new BeanNameViewResolver();
resolver.setOrder(Ordered.LOWEST_PRECEDENCE - 10);
return resolver;
}
Aggregations