SHOW:
|
|
- or go back to the newest paste.
1 | <!-- Плагин с аспектами в контейнере --> | |
2 | <plugin> | |
3 | <groupId>org.codehaus.mojo</groupId> | |
4 | <artifactId>aspectj-maven-plugin</artifactId> | |
5 | <configuration> | |
6 | <aspectLibraries> | |
7 | <aspectLibrary> | |
8 | <groupId>com.ihg.crm</groupId> | |
9 | <artifactId>common-hibernate</artifactId> | |
10 | </aspectLibrary> | |
11 | <aspectLibrary> | |
12 | <groupId>com.ihg.crm</groupId> | |
13 | <artifactId>util</artifactId> | |
14 | </aspectLibrary> | |
15 | <aspectLibrary> | |
16 | <groupId>org.springframework</groupId> | |
17 | <artifactId>spring-aspects</artifactId> | |
18 | </aspectLibrary> | |
19 | </aspectLibraries> | |
20 | </configuration> | |
21 | - | </plugin> |
21 | + | </plugin> |
22 | ||
23 | <!-- Ну и бин вот такой определен и аннотация над конфигом --> | |
24 | @EnableTransactionManagement(mode = AdviceMode.ASPECTJ) | |
25 | ||
26 | @Bean | |
27 | public ValidationAspect validationAspect(){ | |
28 | return new com.ihg.crm.ws.validation.ValidationAspect(); | |
29 | } | |
30 | ||
31 | <!-- В конфиги веб сервисов есть бин ResponseValidatorInterceptor --> | |
32 | @Bean | |
33 | public ResponseValidatorInterceptor responseValidator() | |
34 | { | |
35 | return new com.ihg.crm.ws.validation.ResponseValidatorInterceptor(); | |
36 | } | |
37 | ||
38 | <!-- А также он добавлен в интерсепторы эндпоинта --> | |
39 | @Configuration | |
40 | public class CorporateServiceEndpointsConfiguration | |
41 | { | |
42 | @Autowired | |
43 | private SpringBus springBus; | |
44 | @Autowired | |
45 | private ResponseValidatorInterceptor responseValidator; | |
46 | @Autowired | |
47 | private CorporateServiceDomainInterface corporateService; | |
48 | ||
49 | @Value("${corporate.http.address}") | |
50 | String corporatePath; | |
51 | @Value("${corporate.wsdl.location}") | |
52 | String corporateWsdlLocation; | |
53 | ||
54 | @Bean | |
55 | public EndpointImpl guestServiceEndpoint() | |
56 | { | |
57 | EndpointImpl endpoint = new EndpointImpl(springBus, corporateService); | |
58 | endpoint.publish(corporatePath); | |
59 | endpoint.setEndpointName(CorporateServiceProvider.UnifiedCorporateServicePortHTTPServiceContainer); | |
60 | endpoint.setServiceName(CorporateServiceProvider.SERVICE); | |
61 | endpoint.setWsdlLocation(corporateWsdlLocation); | |
62 | ||
63 | endpoint.getOutInterceptors().add(responseValidator); | |
64 | ||
65 | return endpoint; | |
66 | } | |
67 | } | |
68 | ||
69 | <!-- Над раннером спрингбута вот такая аннотация стоит --> | |
70 | @EnableAspectJAutoProxy | |
71 | ||
72 | <!-- Еще есть конфиг для регистра валидаторов (не знаю нужен ли он) --> | |
73 | @Configuration | |
74 | public class CorporateBeanConfig | |
75 | { | |
76 | ||
77 | @Autowired | |
78 | ApplicationContext context; | |
79 | ||
80 | @Bean | |
81 | public CorporateValidatorRegistry enrollValidatorRegistry() | |
82 | { | |
83 | Class[] validators = { | |
84 | CreateCorporateInfoRequestValidator.class, | |
85 | UpdateCorporateInfoRequestValidator.class | |
86 | }; | |
87 | return new CorporateValidatorRegistry(context, validators); | |
88 | } | |
89 | ||
90 | @Bean | |
91 | public CorporateValidatorRegistry updateGuestValidatorsRegistry() | |
92 | { | |
93 | Class[] validators = { | |
94 | CreateCorporateInfoRequestValidator.class, | |
95 | UpdateCorporateInfoRequestValidator.class | |
96 | }; | |
97 | return new CorporateValidatorRegistry(context, validators); | |
98 | } | |
99 | ||
100 | /*@Bean | |
101 | public ValidatorRegistry retrieveValidatorRegistry() | |
102 | { | |
103 | Class[] validators = { | |
104 | MembershipPriceRequestValidator.class | |
105 | }; | |
106 | return new ValidatorRegistry(context, validators); | |
107 | }*/ | |
108 | ||
109 | @Bean | |
110 | public Validator localValidatorFactoryBean() | |
111 | { | |
112 | return new LocalValidatorFactoryBean(); | |
113 | } | |
114 | } |