spring注入问题 springjava 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 如果你不想用配置文件的话 就这样:@Service("tServiceImpl")public interface TServiceImpl implements TService{}@Resource(name="tServiceImpl") TServiceImpl tService;最好用Resource而不是Autowire @Autowired注入的默认行为byName还是byType来着.. 只想到这个可能是问题另外你贴上来的代码不对吧,第二个再另外回#4,@Resource @Autowired @Inject 这几个注解在Spring里的功能完全一样 我又没说不一样 Autowired还要加个Qualifier来指定名字 麻烦 1. “public interface TServiceImpl implements TService” ------ 这里的TServiceImpl是class吧?2. 我用的是spring3,好像类型无论是接口还是实现类,注入都是可以的 你的spring只能注接口,改配置文件使它可以注类 我也遇见过这种问题,service层注入不成功。你的dao层OK么?我当时是把@Service改成,@Repository来着 com.microsoft.sqlserver.jdbc.SQLServerException Enumeration导入不可用 关于彩信脚本 视频播放 java的多态 vs c++的多态 工资系统做到修改了 请大家提点意见 java 与数据库的连接问题 客户端如何操作服务器的文件(如查看文件列表,上传,下载)(★) 请教nesting interface的特点和用处? 跪求各位答疑解惑 【新手提问】JDBC使用第三方dbutils包操纵mysql,查询出来的结果是空的 一个算法题目求助
@Service("tServiceImpl")
public interface TServiceImpl implements TService{
}
@Resource(name="tServiceImpl")
TServiceImpl tService;
最好用Resource而不是Autowire
另外你贴上来的代码不对吧,第二个
再另外回#4,@Resource @Autowired @Inject 这几个注解在Spring里的功能完全一样
2. 我用的是spring3,好像类型无论是接口还是实现类,注入都是可以的
我当时是把@Service改成,@Repository来着