質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Spring

Spring Framework は、Javaプラットフォーム向けのオープンソースアプリケーションフレームワークです。 Java Platform上に、 Web ベースのアプリケーションを設計するための拡張機能が数多く用意されています。

Q&A

1回答

5472閲覧

[Spring Security4.0.2] XML定義のAOP処理でerror at ::0 formal unbound in pointcut

退会済みユーザー

退会済みユーザー

総合スコア0

Spring

Spring Framework は、Javaプラットフォーム向けのオープンソースアプリケーションフレームワークです。 Java Platform上に、 Web ベースのアプリケーションを設計するための拡張機能が数多く用意されています。

0グッド

1クリップ

投稿2016/01/18 03:10

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 }

分かる方、ご伝授をお願いいたします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

インタセプタの引数を@argsオプションで指定したらいかがでしょうか?

参考:http://docs.spring.io/spring/docs/current/spring-framework-reference/html/aop.html#aop-pointcuts-designators

投稿2016/01/18 04:06

takenyaan

総合スコア119

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問