问题描述
提示:这里描述项目中遇到的问题:
配置文件设置完后找不到相关的bean(一种可能的情况及其解决方案)
@Autowired
private AdminService service;
@Test
public void testSave() {
Admin admin = new Admin(null,"jerry","1234","杰瑞","108@qq.com","null");
service.save(admin);
}
原因分析:
未将相对应的配置文件扫描进来。
解决方案:
添加配置文件
// 加载 Spring 配置文件的注解
@ContextConfiguration(locations = {"classpath:spring-persist-mybatis.xml","classpath:spring-persist-tx.xml"})
3447

被折叠的 条评论
为什么被折叠?



