亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

aspectj 注解中 execution()的問題

aspectj 注解中 execution()的問題

MMTTMM 2019-03-13 18:19:04
錯誤如下包結構如下這是我的方法@Before("execution(*com.wisely.highlight_spring4.ch1.aop.DemoMethodService.*(..))")    public void before(JoinPoint joinPoint){        MethodSignature signature=(MethodSignature)joinPoint.getSignature();        Method method=signature.getMethod();        System.out.println("方法規則攔截"+method.getName());    }這是運行的錯誤Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.context.event.internalEventListenerProcessor': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: Pointcut is not well-formed: expecting 'name pattern' at character position 68execution(*com.wisely.highlight_spring4.ch1.aop.DemoMethodService.*(..))                                                                    ^    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:775)    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861)    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)網上查了各種資料.*(..)就是執行所有方法的意思啊,為什么這里會報錯?
查看完整描述

2 回答

?
阿波羅的戰車

TA貢獻1862條經驗 獲得超6個贊

我猜問題可能是你少了一個空格


@Before("execution(* com.wisely.highlight_spring4.ch1.aop.DemoMethodService.*(..))")

public void before(JoinPoint joinPoint){

    MethodSignature signature = (MethodSignature)joinPoint.getSignature();

    Method method = signature.getMethod();

    System.out.println("方法規則攔截"+method.getName());

}

問題在這* com.wisely


查看完整回答
反對 回復 2019-04-19
?
有只小跳蛙

TA貢獻1824條經驗 獲得超8個贊

Caused by: java.lang.IllegalArgumentException: Pointcut is not well-formed: expecting 'name pattern' at character position 68

execution(*com.wisely.highlight_spring4.ch1.aop.DemoMethodService.*(..))

你檢查你的聲明切入點表達式那里有沒有錯,括號的兩個點(..)是沒有錯的


查看完整回答
反對 回復 2019-04-19
  • 2 回答
  • 0 關注
  • 971 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號