난 그냥 웹 스피어 8.5.5에 CDI를 활성화 JAX에서 beans.xml 환경 파일CDI 오류가 8.5
<?xml version="1.0"?>
<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/
XMLSchema-instance"
xsi:schemeLocation="http://java.sun.com/xml/ns/javaee http://
java.sun.com/xml/ns/javaee/beans_1_0.xsd">
<interceptors>
<class>com.example.jaxrs.SecurityChecked</class>
</interceptors>
</beans>
SecurityChecked 주석
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.interceptor.InterceptorBinding;
@Inherited
@InterceptorBinding
@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface SecurityChecked {
}
import javax.interceptor.AroundInvoke;
import javax.interceptor.Interceptor;
import javax.interceptor.InvocationContext;
@Interceptor
@SecurityChecked
public class SecurityCheckInterceptor {
@AroundInvoke
public Object checkSecurity(InvocationContext context) throws Exception {
/*
* check the parameters or do a generic security check before invoking
* the original method
*/
Object[] params = context.getParameters();
/* if security validation fails, you can throw an exception */
System.out.println("in securitycheck interceptor");
/* invoke the proceed() method to call the original method */
Object ret = context.proceed();
/* perform any post method call work */
return ret;
}
}
에서 인터셉터를
을 추가 한 아래의 -RS 클래스
@GET
@com.example.jaxrs.SecurityChecked
public String checkInterceptor(String hello) {
return "Hello world!";
}
EAR을 배포 할 때 오류가 발생합니다. [53 : 15 259 EDT 10/15/14 14] 00,000,067 BeansDeployer E BeansDeployer org.apache.webbeans.exception.WebBeansConfigurationException를 배포 :
WebContainerL I WebContainerLifecycle startApplication OpenWebBeans 컨테이너 ...
가 시작 주어 클래스 : com.example.jaxrs.SecurityChecked 인터페이스가 인터셉터 클래스가 아닙니다.
이 오류의 원인은 무엇입니까?
OOPS! 내 잘못, 그게 고쳐 줄게. 감사! – user923499
문제가 해결되면 내 대답을 받아 들일 것을 고려하십시오 :) –
좋아, 작동, 가끔 과장 :). – user923499