|
22 | 22 | import java.lang.annotation.RetentionPolicy; |
23 | 23 | import java.lang.annotation.Target; |
24 | 24 |
|
25 | | -import org.springframework.context.annotation.Configuration; |
26 | 25 | import org.springframework.context.annotation.Import; |
27 | 26 |
|
28 | 27 | /** |
29 | | - * Add this annotation to an {@link Configuration @Configuration} class to have the Spring |
30 | | - * Web Services configuration defined in {@link WsConfigurationSupport} imported. For |
31 | | - * instance: |
| 28 | + * Adding this annotation to an {@code @Configuration} class imports the Spring Web |
| 29 | + * Services configuration from {@link WsConfigurationSupport}, for example: |
32 | 30 | * |
33 | 31 | * <pre><code class='java'> |
34 | 32 | * @Configuration |
35 | 33 | * @EnableWs |
36 | | - * @ComponentScan(basePackageClasses = { MyConfiguration.class }) |
37 | | - * public class MyWsConfiguration { |
| 34 | + * @ComponentScan(basePackageClasses = MyConfiguration.class) |
| 35 | + * public class MyConfiguration { |
38 | 36 | * |
39 | 37 | * }</code></pre> |
40 | 38 | * <p> |
41 | | - * Customize the imported configuration by implementing the {@link WsConfigurer} interface |
42 | | - * or more likely by extending the {@link WsConfigurerAdapter} base class and overriding |
43 | | - * individual methods: |
| 39 | + * To customize the imported configuration, implement the {@link WsConfigurer} interface |
| 40 | + * or more likely extend the {@link WsConfigurerAdapter} base class and override |
| 41 | + * individual methods, for example: |
44 | 42 | * |
45 | 43 | * <pre><code class='java'> |
46 | 44 | * @Configuration |
47 | 45 | * @EnableWs |
48 | | - * @ComponentScan(basePackageClasses = { MyConfiguration.class }) |
| 46 | + * @ComponentScan(basePackageClasses = MyConfiguration.class) |
49 | 47 | * public class MyConfiguration extends WsConfigurerAdapter { |
50 | 48 | * |
51 | | - * @Override |
52 | | - * public void addInterceptors(List<EndpointInterceptor> interceptors) { |
53 | | - * interceptors.add(new MyInterceptor()); |
54 | | - * } |
| 49 | + * @Override |
| 50 | + * public void addInterceptors(List<EndpointInterceptor> interceptors) { |
| 51 | + * interceptors.add(new MyInterceptor()); |
| 52 | + * } |
55 | 53 | * |
56 | | - * @Override |
57 | | - * public void addArgumentResolvers(List<MethodArgumentResolver> argumentResolvers) { |
58 | | - * argumentResolvers.add(new MyArgumentResolver()); |
59 | | - * } |
| 54 | + * @Override |
| 55 | + * public void addArgumentResolvers(List<MethodArgumentResolver> argumentResolvers) { |
| 56 | + * argumentResolvers.add(new MyArgumentResolver()); |
| 57 | + * } |
60 | 58 | * |
61 | | - * // More overridden methods ... |
62 | 59 | * }</code></pre> |
63 | 60 | * <p> |
64 | | - * If the customization options of {@link WsConfigurer} do not expose something you need |
65 | | - * to configure, consider removing the {@code @EnableWs} annotation and extending directly |
66 | | - * from {@link WsConfigurationSupport} overriding selected {@code @Bean} methods: |
| 61 | + * <strong>Note:</strong> only one {@code @Configuration} class may have the |
| 62 | + * {@code @EnableWs} annotation to import the Spring Web Services configuration. There can |
| 63 | + * however be multiple {@code @Configuration} classes implementing {@code WsConfigurer} in |
| 64 | + * order to customize the provided configuration. |
| 65 | + * <p> |
| 66 | + * If {@link WsConfigurer} does not expose some more advanced setting that needs to be |
| 67 | + * configured, consider removing the {@code @EnableWs} annotation and extending directly |
| 68 | + * from {@link WsConfigurationSupport} or {@link DelegatingWsConfiguration}, for example: |
67 | 69 | * |
68 | 70 | * <pre><code class='java'> |
69 | 71 | * @Configuration |
70 | 72 | * @ComponentScan(basePackageClasses = { MyConfiguration.class }) |
71 | 73 | * public class MyConfiguration extends WsConfigurationSupport { |
72 | 74 | * |
73 | | - * @Override |
74 | | - * public void addInterceptors(List<EndpointInterceptor> interceptors) { |
75 | | - * interceptors.add(new MyInterceptor()); |
76 | | - * } |
| 75 | + * @Override |
| 76 | + * public void addInterceptors(List<EndpointInterceptor> interceptors) { |
| 77 | + * interceptors.add(new MyInterceptor()); |
| 78 | + * } |
77 | 79 | * |
78 | | - * @Bean |
79 | | - * @Override |
80 | | - * public DefaultMethodEndpointAdapter defaultMethodEndpointAdapter() { |
81 | | - * // Create or delegate to "super" to create and |
82 | | - * // customize properties of DefaultMethodEndpointAdapter |
83 | | - * } |
| 80 | + * @Bean |
| 81 | + * @Override |
| 82 | + * public PayloadRootAnnotationMethodEndpointMapping payloadRootAnnotationMethodEndpointMapping() { |
| 83 | + * // Create or delegate to "super" to create and |
| 84 | + * // customize properties of PayloadRootAnnotationMethodEndpointMapping |
| 85 | + * } |
84 | 86 | * }</code></pre> |
85 | 87 | * |
86 | 88 | * @author Arjen Poutsma |
| 89 | + * @author Stephane Nicoll |
87 | 90 | * @since 2.2 |
88 | 91 | * @see WsConfigurer |
89 | 92 | * @see WsConfigurerAdapter |
|
0 commit comments