use of cn.taketoday.context.annotation.MissingBean in project today-infrastructure by TAKETODAY.
the class WebSocketConfig method annotationWebSocketHandlerBuilder.
@MissingBean(value = AnnotationWebSocketHandlerBuilder.class)
AnnotationWebSocketHandlerBuilder annotationWebSocketHandlerBuilder(List<EndpointParameterResolver> resolvers, List<WebSocketConfiguration> configurers) {
AnnotationWebSocketHandlerBuilder handlerBuilder;
if (ClassUtils.isPresent("jakarta.websocket.Session")) {
handlerBuilder = new StandardAnnotationWebSocketHandlerBuilder();
} else {
handlerBuilder = new AnnotationWebSocketHandlerBuilder();
}
// configure EndpointParameterResolver
for (WebSocketConfiguration configurer : configurers) {
configurer.configureEndpointParameterResolvers(resolvers);
}
handlerBuilder.registerDefaultResolvers();
handlerBuilder.addResolvers(resolvers);
// @since 4.0 trimToSize
handlerBuilder.trimToSize();
return handlerBuilder;
}
use of cn.taketoday.context.annotation.MissingBean in project today-framework by TAKETODAY.
the class BeanValidationConfig method hibernateValidator.
@MissingBean
@SuppressWarnings({ "unchecked", "rawtypes" })
@ConditionalOnClass(name = "org.hibernate.validator.HibernateValidator")
DefaultJavaxValidator hibernateValidator(ApplicationContext context) {
final Class<ValidationProvider> aClass = ClassUtils.load("org.hibernate.validator.HibernateValidator");
final Configuration hibernateValidatorConfig = Validation.byProvider(aClass).configure().messageInterpolator(new ContextMessageInterpolator(context)).parameterNameProvider(new ContextParameterNameProvider());
return new DefaultJavaxValidator(hibernateValidatorConfig);
}
Aggregations