When learning the AOP configuration of spring, I encountered an error as follows:
Warning: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: com/jeremy/service/userServiceImpl (wrong name: com/jeremy/service/UserServiceImpl)
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: com/jeremy/service/userServiceImpl (wrong name: com/jeremy/service/UserServiceImpl)
An error occurred when creating the bean because the class NoClassDefFoundError could not be found
Cause of the problem: the class name of pointcut configured in execution is filled in lowercase by mistake, so an error is reported
solution: change the class name to the correct uppercase
<aop:config>
<aop:pointcut id="pointcut" expression="execution(* com.jeremy.service.userServiceImpl.*(..))"/>
<aop:advisor advice-ref="afterLog" pointcut-ref="pointcut"/>
<aop:advisor advice-ref="beforeLog" pointcut-ref="pointcut"/>
</aop:config>
Change to
<aop:config>
<aop:pointcut id="pointcut" expression="execution(* com.jeremy.service.UserServiceImpl.*(..))"/>
<aop:advisor advice-ref="afterLog" pointcut-ref="pointcut"/>
<aop:advisor advice-ref="beforeLog" pointcut-ref="pointcut"/>
</aop:config>
Read More:
- Spring Aop error creating bean with name ‘org.springframework.aop.config.internalAutoProxyCreator
- [Solved] Spring Aop Error: Error creating bean with name ‘org.springframework.aop.config.internalAutoProxyCreator‘
- [Solved] spring boot Startup Error: Error creating bean with name ‘requestMappingHandlerMapping‘ defined in class path
- Spring Project Error: Error creating bean with name [How to Solve]
- [Solved] Rabbitmq injection failed, bean creation failed, error creating bean with name ‘rabbitconnectionfactory’‘
- [Solved] org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘xxx‘
- [Solved] Error creating bean with name ‘accountService‘: Unsatisfied dependency expressed through field
- SpringCloud: Error creating bean with name ‘configurationPropertiesBeans‘
- [Solved] BeanCreationException: Error creating bean with name ‘configurationPropertiesBeans‘
- [Solved] Error creating bean with name ‘org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#0‘:
- Error creating bean with name ‘adminMapper‘ Injection of resource dependencies failed
- [Solved] Error creating bean with name ‘fileVisitController‘ defined in file
- [Solved] Error creating bean with name ‘sqlSessionFactory‘ defined in class path resource
- springboot Integrate mybatis Error: Error creating bean with name ‘deptController‘: Unsatisfied dependency expresse
- Annotation @resource & @Autowired introduces Spring bean error
- [Solved] Error creating bean with name ‘mappingJackson2HttpMessageConverter‘ defined in class path resource
- [Solved] ssm Error: Error creating bean with name ‘employeeController’: Injection of autowired dependencies failed
- [Solved] Error creating bean with name ‘configurationPropertiesBeans‘ defined in class path resource…
- [Solved] Error creating bean with name ‘redisConnectionFactory‘ defined in class path resource…
- [Solved] org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘org