错误信息:
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [F:\Program Files\eclipse\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\testsh\WEB-INF\classes\entity\Department.class];
nested exception is org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet: file [F:\Program Files\eclipse\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\testsh\WEB-INF\classes\entity\Department.class];
nested exception is java.lang.IllegalArgumentException
版本信息:
spring3.2.3RELEASE hibernate4.2.21Final jdk1.8
一直报上边的错误
百度说java1.8版本只支持spring4.0以上,所以我就把web项目的jdk调为1.7版本,这个错误解决了,但是出现了一个新问题。
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mainController': Injection of autowired dependencies failed;
nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private service.EmpService controller.MainController.empService;
nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [service.EmpService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
原因是我配置文件中扫描路径写错了,写成entity
<context:component-scan base-package="*"><context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
修改之后就可以正常访问了,整合成功~~~