AOP横切错误异常 Cannot resolve reference to bean 'point' while setting bean property 'pointcut'

dataSource为配置的数据源
point为切面ID
四月 10, 2020 10:26:30 下午 org.springframework.context.support.AbstractApplicationContext refresh
警告: Exception encountered during context initialization - cancelling refresh attempt:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource[mybatis-spring.xml]:
BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0': 
Cannot resolve reference to bean 'point' while setting bean property 'pointcut'; 
Lnested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'point': 
Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class 
[org.springframework.aop.aspectj.AspectJExpressionPointcut] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource
[mybatis-spring.xml]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0': 
Cannot resolve reference to bean 'point' while setting bean property 'pointcut'; 
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'point':
 Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class 
 [org.springframework.aop.aspectj.AspectJExpressionPointcut] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:512)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:882)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:144)
	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:85)

出现的原因AOP少导入了包。
将下面依赖导入即可,不是maven项目导包。

  <!-- https://mvnrepository.com/artifact/org.aspectj/aspectjweaver -->
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>1.9.5</version>
        </dependency>
发布了67 篇原创文章 · 获赞 0 · 访问量 2451

猜你喜欢

转载自blog.csdn.net/sabstarb/article/details/105444105
今日推荐