项目场景:
使用基于注解(Annotation)装配的方式完成Bean的装配工作
问题描述:
- 运行测试类时报Specified class is an interface
<context:annotation-config>
标签报错
解决方案:
- 配置文件中Bean标签的class属性值错误,UserService后边没有加Impl,使用的是接口
- 文件头的配置错误,在此提供给大家一个配置,仅供参考
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.3.xsd">
</beans>