use of cn.taketoday.lang.Component in project today-framework by TAKETODAY.
the class WebMvcAutoConfiguration method defaultViewResolver.
@Component
@ConditionalOnMissingBean
public InternalResourceViewResolver defaultViewResolver() {
InternalResourceViewResolver resolver = new InternalResourceViewResolver();
resolver.setPrefix(this.mvcProperties.getView().getPrefix());
resolver.setSuffix(this.mvcProperties.getView().getSuffix());
return resolver;
}
use of cn.taketoday.lang.Component 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.lang.Component in project today-framework by TAKETODAY.
the class ClassPathScanningCandidateComponentProvider method registerDefaultFilters.
/**
* Register the default filter for {@link Component @Component}.
* <p>This will implicitly register all annotations that have the
* {@link Component @Component} meta-annotation including the
* {@link Repository @Repository}, {@link Service @Service}, and
* {@link cn.taketoday.web.annotation.Controller @Controller} stereotype annotations.
* <p>Also supports Jakarta EE's {@link jakarta.annotation.ManagedBean} and
* JSR-330's {@link jakarta.inject.Named} annotations, if available.
*/
protected void registerDefaultFilters() {
this.includeFilters.add(new AnnotationTypeFilter(Component.class));
ClassLoader cl = ClassPathScanningCandidateComponentProvider.class.getClassLoader();
try {
this.includeFilters.add(new AnnotationTypeFilter(ClassUtils.forName("jakarta.annotation.ManagedBean", cl), false));
log.trace("JSR-250 'jakarta.annotation.ManagedBean' found and supported for component scanning");
} catch (ClassNotFoundException ex) {
// JSR-250 1.1 API (as included in Jakarta EE) not available - simply skip.
}
try {
this.includeFilters.add(new AnnotationTypeFilter(ClassUtils.forName("jakarta.inject.Named", cl), false));
log.trace("JSR-330 'jakarta.inject.Named' annotation found and supported for component scanning");
} catch (ClassNotFoundException ex) {
// JSR-330 API not available - simply skip.
}
}
use of cn.taketoday.lang.Component 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.lang.Component in project today-framework by TAKETODAY.
the class ProxyCachingConfiguration method cacheEvictInterceptor.
@Aspect
@Component
@ConditionalOnMissingBean
@Advice(CacheEvict.class)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
CacheEvictInterceptor cacheEvictInterceptor(CacheManager cacheManager, CacheExpressionOperations operations) {
CacheEvictInterceptor cacheEvictInterceptor = new CacheEvictInterceptor(cacheManager);
cacheEvictInterceptor.setExpressionOperations(operations);
return cacheEvictInterceptor;
}
Aggregations