2017-02-02 1 views
0

Я узнаю об использовании АОП о веб-сервисах RESTful. Я выбираю Tomcat как платформу и Weld, чтобы принести CDI, я также использую CXF как реализация JAX-RS (это специфическое технологическое ограничение для коммитов, в котором я довольно новый). Это мой sandbox. Насколько я могу видеть Weld загружен правильно, я получил Tomcat + Weld конфигурацию из here, и найти свой перехватчик (здесь журнал снимок):AOP на Tomcat с Weld

... 
2017-02-02 11:26:03 DEBUG Bootstrap:238 - WELD-000105: Enabled interceptor types for Weld BeanManager for /SecProof_/WEB-INF/classes [bean count=2]: 
    - class org.jboss.weld.context.activator.ActivateRequestContextInterceptor, 
    - class edu.pezzati.sec.CanAccessImpl 
2017-02-02 11:26:03 DEBUG Bootstrap:236 - WELD-000103: Enabled alternatives for Weld BeanManager for org.jboss.weld.environment.deployment.WeldDeployment.additionalClasses [bean count=3]: (empty collection) 
2017-02-02 11:26:03 DEBUG Bootstrap:237 - WELD-000104: Enabled decorator types for Weld BeanManager for org.jboss.weld.environment.deployment.WeldDeployment.additionalClasses [bean count=3]: (empty collection) 
2017-02-02 11:26:03 DEBUG Bootstrap:238 - WELD-000105: Enabled interceptor types for Weld BeanManager for org.jboss.weld.environment.deployment.WeldDeployment.additionalClasses [bean count=3]: 
    - class org.jboss.weld.context.activator.ActivateRequestContextInterceptor 
2017-02-02 11:26:03 INFO servletTomcat:45 - WELD-ENV-001100: Tomcat 7+ detected, CDI injection will be available in Servlets, Filters and Listeners. 
2017-02-02 11:26:03 TRACE Bean:300 - WELD-001536: Found [] constructors annotated with @Inject for [EnhancedAnnotatedTypeImpl] public @Path class edu.pezzati.sec.WebBoundary 
2017-02-02 11:26:03 TRACE Bean:300 - WELD-001536: Found [] constructors annotated with @Inject for [EnhancedAnnotatedTypeImpl] public @CanAccess @Interceptor class edu.pezzati.sec.CanAccessImpl 
2017-02-02 11:26:03 TRACE Bean:309 - WELD-000002: Exactly one constructor ([EnhancedAnnotatedConstructorImpl] public edu.pezzati.sec.WebBoundary()) defined, using it as the bean constructor for [EnhancedAnnotatedTypeImpl] public @Path class edu.pezzati.sec.WebBoundary 
2017-02-02 11:26:03 TRACE Bean:309 - WELD-000002: Exactly one constructor ([EnhancedAnnotatedConstructorImpl] public edu.pezzati.sec.CanAccessImpl()) defined, using it as the bean constructor for [EnhancedAnnotatedTypeImpl] public @CanAccess @Interceptor class edu.pezzati.sec.CanAccessImpl 
2017-02-02 11:26:03 TRACE Bean:300 - WELD-001536: Found [] constructors annotated with @Inject for [EnhancedAnnotatedTypeImpl] public @CanAccess @Interceptor class edu.pezzati.sec.CanAccessImpl 
2017-02-02 11:26:03 TRACE Bean:309 - WELD-000002: Exactly one constructor ([EnhancedAnnotatedConstructorImpl] public edu.pezzati.sec.CanAccessImpl()) defined, using it as the bean constructor for [EnhancedAnnotatedTypeImpl] public @CanAccess @Interceptor class edu.pezzati.sec.CanAccessImpl 
2017-02-02 11:26:03 TRACE Bean:300 - WELD-001536: Found [] constructors annotated with @Inject for [EnhancedAnnotatedTypeImpl] public @Path class edu.pezzati.sec.WebBoundary 
... 

Ну, я могу достигнуть моего тривиального но мой перехватчик не срабатывает. Вот то, что Tomcat возвращает мне:

... 
INFORMAZIONI: Server startup in 2293 ms 
2017-02-02 11:28:59 TRACE Servlet:232 - WELD-000708: Initializing request [email protected] 
2017-02-02 11:28:59 DEBUG Reflection:82 - WELD-000620: interface javax.enterprise.inject.Intercepted is not declared @Target(METHOD, FIELD, PARAMETER, TYPE). Weld will use this annotation, however this may make the application unportable. 
2017-02-02 11:28:59 DEBUG Reflection:82 - WELD-000620: interface javax.enterprise.inject.Decorated is not declared @Target(METHOD, FIELD, PARAMETER, TYPE). Weld will use this annotation, however this may make the application unportable. 
2017-02-02 11:28:59 TRACE Context:69 - WELD-000222: Loading bean store [email protected]776 map from session null 
2017-02-02 11:28:59 TRACE DefaultListableBeanFactory:568 - No bean named 'org.apache.cxf.phase.PhaseManager' found in org.s[email protected]2c80a98d: defining beans [cxf,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,sec,secproof]; root of factory hierarchy 
2017-02-02 11:28:59 TRACE DefaultListableBeanFactory:568 - No bean named 'org.apache.cxf.policy.PolicyDataEngine' found in org.s[email protected]2c80a98d: defining beans [cxf,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,sec,secproof]; root of factory hierarchy 
2017-02-02 11:28:59 TRACE Servlet:293 - WELD-000709: Destroying request [email protected] 
... 

Что мне не хватает?

ответ

0

Nevermind. Это было только отсутствие конфигурации. Я должен был использовать cxf-integration-cdi, чтобы сделать его работы this блога и this примером были основы. Спасибо автору.

Смежные вопросы