Controllerクラス内に、アノテーション@CheckClientCertをもつメソッドに対してAOPによる処理を作成しましたが、以下のエラーになってしまい、原因がわからずに困っています。
Caused by: java.lang.IllegalArgumentException: error at ::0 formal unbound in pointcut
AOPのやり方として、XML上で定義しています。
これはXMLで定義しているクラスを環境に合わせて変更するためです。
XML
1<beans:beans xmlns="http://www.springframework.org/schema/security" 2 xmlns:beans="http://www.springframework.org/schema/beans" xmlns:util="http://www.springframework.org/schema/util" 3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 4 xmlns:aop="http://www.springframework.org/schema/aop" 5 xsi:schemaLocation="http://www.springframework.org/schema/security 6http://www.springframework.org/schema/security/spring-security-4.0.xsd 7http://www.springframework.org/schema/beans 8http://www.springframework.org/schema/beans/spring-beans-4.2.xsd 9http://www.springframework.org/schema/util 10http://www.springframework.org/schema/util/spring-util-4.2.xsd 11http://www.springframework.org/schema/aop 12http://www.springframework.org/schema/aop/spring-aop-4.2.xsd"> 13 <!-- 中略 --> 14 <aop:config> 15 <aop:aspect ref="checkAuthAspect"> 16 <aop:before pointcut="@annotation(sample.security.annotation.CheckClientCert)" method="checkAuthentication" /> 17 </aop:aspect> 18</aop:config> 19<beans:bean id="checkAuthAspect" class="sample.security.aspect.CheckDummyUserAspect" /> 20 <!-- 中略 --> 21<beans:beans>
aop:beforeタグのpointcut属性に
"execution(* sample...(..))"
と定義しても、結果は同じでした。
CheckClientCert.java
java
1package sample.security.annotation; 2 3import java.lang.annotation.Documented; 4import java.lang.annotation.Retention; 5import java.lang.annotation.Target; 6 7import static java.lang.annotation.ElementType.METHOD; 8import static java.lang.annotation.RetentionPolicy.RUNTIME; 9 10@Documented 11@Target({METHOD}) 12@Retention(RUNTIME) 13public @interface CheckClientCert { 14 15} 16
CheckDummyUserAspect.java(一部)
※@Aspect,@Beforeは付けていません。
Java
1/*inport部分*/ 2 3public class CheckDummyUserAspect { 4 5 public void checkAuthentication(JoinPoint joinPoint, HttpServletRequest request) throws AccessDeniedException { 6 /* メソッド内省略 */ 7 }
分かる方、ご伝授をお願いいたします。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。