我试图在所有类中定义切入点,或者在Spring中导入的库中至少定义一个类。但是,当我运行应用程序时,我得到了
[tomcat:launch] SEVERE: Servlet threw load() exception
[tomcat:launch] java.lang.IllegalArgumentException: warning no match for this type name: com.example.package [Xlint:invalidAbsoluteTypeName]
[tomcat:launch] at org.aspectj.weaver.tools.PointcutParser.parsePointcutExpression(PointcutParser.java:301)
[tomcat:launch] at org.springframework.aop.aspectj.AspectJExpressionPointcut.buildPointcutExpression(AspectJExpressionPointcut.java:207)
[tomcat:launch] at org.springframework.aop.aspectj.AspectJExpressionPointcut.buildPointcutExpression(AspectJExpressionPointcut.java:193)
[tomcat:launch] at org.springframework.aop.aspectj.AspectJExpressionPointcut.checkReadyToMatch(AspectJExpressionPointcut.java:182)
[tomcat:launch] at org.springframework.aop.aspectj.AspectJExpressionPointcut.getClassFilter(AspectJExpressionPointcut.java:163)
[tomcat:launch] at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:210)
[tomcat:launch] at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:264)
[tomcat:launch] at org.springframework.aop.support.AopUtils.findAdvisorsThatCanApply(AopUtils.java:296)
[tomcat:launch] at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findAdvisorsThatCanApply(AbstractAdvisorAutoProxyCreator.java:117)
[tomcat:launch] at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:87)
[tomcat:launch] at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:68)
[tomcat:launch] at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:359)
[tomcat:launch] at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:322)
[tomcat:launch] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:407)
答案 0 :(得分:0)
错误消息提供了一个很好的提示:
no match for this type name:
com.example.package [Xlint:invalidAbsoluteTypeName]
您似乎在切入点中指定了一个纯粹的包名称作为类型名称。可能你想写这样的东西:
com.example.package.MyClass
针对特定班级com.example.package.*
适用于包中的所有类com.example.package..*