Annotation Interface EnableWs


Add this annotation to an @Configuration class to have the Spring Web Services configuration defined in WsConfigurationSupport imported. For instance:
 @Configuration
 @EnableWs
 @ComponentScan(basePackageClasses = { MyConfiguration.class })
 public class MyWsConfiguration {

 }
 

Customize the imported configuration by implementing the WsConfigurer interface or more likely by extending the WsConfigurerAdapter base class and overriding individual methods:

 @Configuration
 @EnableWs
 @ComponentScan(basePackageClasses = { MyConfiguration.class })
 public class MyConfiguration extends WsConfigurerAdapter {

        @Override
        public void addInterceptors(List<EndpointInterceptor> interceptors) {
                interceptors.add(new MyInterceptor());
        }

        @Override
        public void addArgumentResolvers(List<MethodArgumentResolver> argumentResolvers) {
                argumentResolvers.add(new MyArgumentResolver());
        }

        // More overridden methods ...
 }
 

If the customization options of WsConfigurer do not expose something you need to configure, consider removing the @EnableWs annotation and extending directly from WsConfigurationSupport overriding selected @Bean methods:

 @Configuration
 @ComponentScan(basePackageClasses = { MyConfiguration.class })
 public class MyConfiguration extends WsConfigurationSupport {

        @Override
        public void addInterceptors(List<EndpointInterceptor> interceptors) {
                interceptors.add(new MyInterceptor());
        }

        @Bean
        @Override
        public DefaultMethodEndpointAdapter defaultMethodEndpointAdapter() {
                // Create or delegate to "super" to create and
                // customize properties of DefaultMethodEndpointAdapter
        }
 }
 
Since:
2.2
Author:
Arjen Poutsma
See Also: