[Solved] org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘xxx‘

1. Problem description

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.config.internalAutoProxyCreator': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/aspectj/lang/annotation/Around

2. Anomaly analysis

org. springframework. beans. factory. BeanCreationException: Error creating bean with name ‘XXX’

This exception is: bean injection failure exception. If this exception occurs, the corresponding bean cannot be found! The reasons for bean injection failure include but are not limited to the following:

The corresponding bean is not annotated; There is an error adding annotation to the corresponding bean, for example, the @service of spring is incorrectly selected as Dubbo; Select the wrong automatic injection method, etc.

Caused by: java.lang.ClassNotFoundException: org.aspectj.lang.annotation. Around

Missing aspect, Maven coordinate of AOP

   <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>4.3.12.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aspects</artifactId>
            <version>4.3.12.RELEASE</version>
        </dependency>

After adding dependency, the problem is solved

Read More: