java.lang.IllegalArgumentException
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'studentDao' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: error at ::0 can't find referenced pointcut update
正在回答 回答被采纳积分+1
建议你将aspectjweaver的版本换成1.8.9,可以在pom文件中修改如下代码,祝学习愉快~
<dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> <version>1.8.9</version> </dependency>
测试类代码 package com.imooc.aspectJ.demo1; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import javax.annotation.Resource; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("classpath:applicationContext.xml") public class SpringDemo1 { @Resource(name = "studentDao") private StudentDao studentDao; @Test public void demo(){ studentDao.delete(); studentDao.findOne(); studentDao.update(); studentDao.save(); studentDao.findAll(); } } xml的代码 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd"> <!--开启aspectj的注解开发,自动代理--> <aop:aspectj-autoproxy/> <bean id="studentDao" class="com.imooc.aspectJ.demo1.StudentDao"/> <bean class="com.imooc.aspectJ.demo1.MyASpectAnno"/> </beans>
建议同学将代码添加到我要回答中,添加到回复中会失去代码格式,祝学习愉快~
错误提示说是applicationContext.xml中的studentDao出现了问题,建议你将测试类代码和xml文件中的代码粘贴到我要回答中,方便老师调试并具有针对性的为你解答,祝学习愉快~
- 参与学习 人
- 提交作业 205 份
- 解答问题 4317 个
Java中非常实用的SSM整合开发内容,从Spring开始,到MyBaits的进阶内容,再到SpringMVC的应用,最后是SSM整合开发案例,逐步深入,助你成长为一名Java工程师!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星