Slide 114
Slide 114 text
@Slf4j
@Configuration
@EnableConfigurationProperties
@ConditionalOnProperty(name = "spring.cxf.client.enabled", matchIfMissing = true)
public class CxfClientConfiguration {
@Bean
public CxfBeanDefinitionPostProcessor cxfBeanDefinitionPP(Environment environment) {
return new CxfBeanDefinitionPostProcessor(environment);
}
@Bean
public static BusWiringBeanFactoryPostProcessor jsr250BeanPostProcessor() {
return new BusWiringBeanFactoryPostProcessor();
}
@Bean
public static BusExtensionPostProcessor busExtensionPostProcessor() {
return new BusExtensionPostProcessor();
}
@Slf4j
@Configuration
@ConditionalOnClass({SpringBus.class, JaxWsClientFactoryBean.class, ConfigurationPropertiesBindingPostProcessor.class})
@EnableConfigurationProperties({CxfClientsProperties.class, WSConfiguration.class})
public static class CxfClientFactoryAutoConfiguration {
@Bean(name = CXF_WS_CLIENT_PROXY_FACTORY_DEFAULT_NAME)
@ConditionalOnMissingBean(name = {CXF_WS_CLIENT_PROXY_FACTORY_DEFAULT_NAME})
CxfWsStubBeanFactory proxyWsBeanFactory(
CxfClientsProperties cxfClientsProperties,
Bus bus,
CxfInterceptorConfigurer interceptorConfigurer
) {
return new CxfWsStubBeanFactory(
cxfClientsProperties,
bus,
interceptorConfigurer
);
}
Конфигурация библиотек
@Bean
@ConditionalOnMissingBean(CxfBusConfigurer.class)
public CxfBusConfigurer cxfBusConfigurer(CxfClientsProperties cxfClientsProperties) {
return new DefaultCxfBusConfigurer(cxfClientsProperties);
}
@Bean(destroyMethod = "shutdown")
public Bus cxf(CxfBusConfigurer cxfBusConfigurer) {
SpringBus bus = new SpringBus();
cxfBusConfigurer.configure(bus);
return bus;
}
@Bean
@ConditionalOnMissingBean(CxfInterceptorConfigurer.class)
public CxfInterceptorConfigurer cxfInterceptorConfigurer(
CxfInterceptorAnnotationProcessor cxfInterceptorAnnotationProcessor,
BeanFactory beanFactory
) {
return new CxfInterceptorConfigurer(
beanFactory,
cxfInterceptorAnnotationProcessor.getGlobalInterceptors(),
cxfInterceptorAnnotationProcessor.getSpecificInterceptors()
);
}
@Bean
@ConditionalOnMissingBean(CxfInterceptorAnnotationProcessor.class)
public static CxfInterceptorAnnotationProcessor cxfInterceptorBFPP() {
return new CxfInterceptorAnnotationProcessor();
}
static final String CXF_WS_CLIENT_PROXY_FACTORY_DEFAULT_NAME = "CxfWsClientProxyFactory";
}
}