标签:文件内容 efault spec -- nested files rem ble mirror
java Spring AOP编写MAVEN项目,编译时出现错误提示如下:
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘customerService‘ defined in class path resource [applicationContext.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 ‘mycut‘ while setting bean property ‘pointcut‘; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘mycut‘: Failed to introspect bean class [org.springframework.aop.aspectj.AspectJExpressionPointcut] for lookup method metadata: could not find class that it depends on; nested exception is java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException
刚开始以为是
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations="classpath:applicationContext.xml")
路径配置问题,
后来发现D:\Program Files\apache-maven-3.2.3\conf\settings.xml文件中<mirrors>配置有问题:
<!-- 使用私服仓库,加上以下语句 -->
<!-- 若要使用网络(官网中央仓库),就注释掉,默认没有该语句,不用添加就行了 -->
<mirror>
<id>my</id>
<mirrorOf>*</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>私服仓库地址</url>
</mirror>
即使更改过来后还是报同样的错误,原因:
jar包一旦出现下载错误,则会在repository文件夹中生成.lastUpdated文件.
必须在D:\Program Files\apache-maven-3.2.3\repository中查找并删掉对应的.lastUpdated文件,才会重新从中央仓库中下载,否则是下载不了的.
批删除.lastUpdated文件小技巧: 创建cleanLastUpdated.bat文件双击运行即可.
文件内容如下:
set REPOSITORY_PATH=D:\Program Files\apache-maven-3.2.3\repository
rem 正在搜索...
for /f "delims=" %%i in (‘dir /b /s "%REPOSITORY_PATH%\*lastUpdated"‘) do (
del /s /q %%i
)
rem 搜索完毕
pause
<!-- 初学者,第一次发表博客,若有不当之处还请见谅! -->
java.lang.IllegalStateException: Failed to load ApplicationContext
标签:文件内容 efault spec -- nested files rem ble mirror
原文地址:https://www.cnblogs.com/zhengjinjun/p/9216468.html