Article From:https://www.cnblogs.com/zhengjinjun/p/9216468.html

java Spring AOPWhen writing the MAVEN project, the error occurred during compile time is as follows:

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

At first I thought it was

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations=”classpath:applicationContext.xml”)

Path configuration problem,

Later found in D:\Program Files\apache-maven-3.2.3\conf\settings.xml file < mirrors> configuration problems:

<!– Use the private service warehouse, add the following statement –>

<!– If you want to use the network (the central repository of the official website), note it off, default does not have the statement, do not add –&gt.
<mirror>
<id>my</id>
<mirrorOf>*</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>Private service warehouse address < /url>
</mirror>

Even after the change, the same mistake was reported.

jarOnce a package download error occurs, the.LastUpdated file will be generated in the repository folder.

You must find and delete the corresponding.LastUpdated files in D:\Program Files\apache-maven-3.2.3\repository before you can download it from the central warehouse, otherwise it can’t be downloaded.

Batch delete.LastUpdated file tips: create cleanLastUpdated.bat files, double-click run.

The contents of the document are as follows:

set REPOSITORY_PATH=D:\Program Files\apache-maven-3.2.3\repository
rem Search…
for /f “delims=” %%i in (‘dir /b /s “%REPOSITORY_PATH%\*lastUpdated”‘) do (
del /s /q %%i
)
rem Complete search
pause

<!– Beginners, the first time to publish a blog, if there is any misconception, please forgive me! –>

Leave a Reply

Your email address will not be published. Required fields are marked *