Annotation Interface EnableWs
@Retention(RUNTIME)
@Target(TYPE)
@Documented
@Import(DelegatingWsConfiguration.class)
public @interface EnableWs
Adding this annotation to an
@Configuration
class imports the Spring Web
Services configuration from WsConfigurationSupport
, for example:
@Configuration
@EnableWs
@ComponentScan(basePackageClasses = MyConfiguration.class)
public class MyConfiguration {
}
Customize the imported configuration by implementing the WsConfigurer
interface
and overriding individual methods:
@Configuration
@EnableWs
@ComponentScan(basePackageClasses = MyConfiguration.class)
public class MyConfiguration implements WsConfigurer {
@Override
public void addInterceptors(List<EndpointInterceptor> interceptors) {
interceptors.add(new MyInterceptor());
}
@Override
public void addArgumentResolvers(List<MethodArgumentResolver> argumentResolvers) {
argumentResolvers.add(new MyArgumentResolver());
}
}
Note: only one @Configuration
class may have the
@EnableWs
annotation to import the Spring Web Services configuration. There can
however be multiple @Configuration
classes implementing WsConfigurer
in
order to customize the provided configuration.
If WsConfigurer
does not expose some more advanced setting that needs to be
configured, consider removing the @EnableWs
annotation and extending directly
from WsConfigurationSupport
or DelegatingWsConfiguration
, for example:
@Configuration
@ComponentScan(basePackageClasses = { MyConfiguration.class })
public class MyConfiguration extends WsConfigurationSupport {
@Override
public void addInterceptors(List<EndpointInterceptor> interceptors) {
interceptors.add(new MyInterceptor());
}
@Bean
@Override
public PayloadRootAnnotationMethodEndpointMapping payloadRootAnnotationMethodEndpointMapping() {
// Create or delegate to "super" to create and
// customize properties of PayloadRootAnnotationMethodEndpointMapping
}
}
- Since:
- 2.2
- See Also: