spring加载异常

时间:2022-10-01 01:27:25

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in file [F:\WorkSpace\businessoracle\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\passwd\WEB-INF\classes\ApplicationContext-dao.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': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException

如果出现这种情况:

分两种情况试试:1,如果没有使用springmvc,考虑一下是不是aspectjweaver.jar和aspectjrtweaver.jar这两个jar包没有加载

2,使用springmvc,检查一下是不是没有导入spring-aspects

没有加入

spring-aspects对应的maven地址:

<dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aspects</artifactId>
            <version>${spring.version}</version>
</dependency>具体版本看自己使用的spring版本,尽量保持统一。