アノテーションインターフェース EnableWs
@RetentionSE(RUNTIMESE)
@TargetSE(TYPESE)
@DocumentedSE
@Import(DelegatingWsConfiguration.class)
public @interface EnableWs
このアノテーションを
@Configuration クラスに追加して、WsConfigurationSupport で定義された Spring Web Services 構成をインポートします。例:
@Configuration
@EnableWs
@ComponentScan(basePackageClasses = { MyConfiguration.class })
public class MyWsConfiguration {
}
WsConfigurer インターフェースを実装するか、WsConfigurerAdapter 基本クラスを継承して個々のメソッドをオーバーライドすることにより、インポートされた構成をカスタマイズします。
@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 ...
}
WsConfigurer のカスタマイズオプションで構成が必要なものが公開されない場合は、@EnableWs アノテーションを削除し、WsConfigurationSupport から直接拡張して、選択した @Bean メソッドをオーバーライドすることを検討してください。
@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
}
}
- 導入:
- 2.2
- 作成者:
- Arjen Poutsma
- 関連事項: