java.lang.IllegalArgumentException

java.lang.IllegalArgumentException

http://img1.sycdn.imooc.com//climg/5c359a3e0001918112920592.jpghttp://img1.sycdn.imooc.com//climg/5c359a620001df6c09290552.jpgCaused 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

登陆购买课程后可参与讨论,去登陆

4回答
chrismorgen 2019-01-09 19:12:42

建议你将aspectjweaver的版本换成1.8.9,可以在pom文件中修改如下代码,祝学习愉快~

<dependency>
  <groupId>org.aspectj</groupId>
  <artifactId>aspectjweaver</artifactId>
  <version>1.8.9</version>
</dependency>


提问者 慕粉1045053936 2019-01-09 17:06:10

测试类代码 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>

chrismorgen 2019-01-09 16:43:56

建议同学将代码添加到我要回答中,添加到回复中会失去代码格式,祝学习愉快~

http://img1.sycdn.imooc.com//climg/5c35b4330001d9e807390119.jpg

chrismorgen 2019-01-09 16:10:54

错误提示说是applicationContext.xml中的studentDao出现了问题,建议你将测试类代码和xml文件中的代码粘贴到我要回答中,方便老师调试并具有针对性的为你解答,祝学习愉快~

  • 提问者 慕粉1045053936 #1
    测试类代码 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>
    2019-01-09 16:23:56
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
SSM主流框架入门与综合项目实战2018版
  • 参与学习           人
  • 提交作业       205    份
  • 解答问题       4317    个

Java中非常实用的SSM整合开发内容,从Spring开始,到MyBaits的进阶内容,再到SpringMVC的应用,最后是SSM整合开发案例,逐步深入,助你成长为一名Java工程师!

了解课程
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师