java – GWT项目中的Spring配置?
发布时间:2020-12-15 08:31:27 所属栏目:Java 来源:网络整理
导读:我正在开发一个GWT- Spring-Hibernate项目,我想在GWT Service Servlet中使用Spring Autowired注释,但我的自动连接注释服务没有注入.它是null.我错过了配置细节吗? 我加 context:annotation-config /context:component-scan base-package="com.org" / 到我的
我正在开发一个GWT-
Spring-Hibernate项目,我想在GWT Service Servlet中使用Spring Autowired注释,但我的自动连接注释服务没有注入.它是null.我错过了配置细节吗?
我加 <context:annotation-config /> <context:component-scan base-package="com.org" /> 到我的ApplicationContext.xml,我已将我的服务注释为@Service(“myService”) @Autowired MyService myService; // This is null so WHY? 解决方法
那么,@ Autowired注释所在的类也应该在spring上下文中(即用@Component注释),但是如果它是GWT(即客户端)类,我怀疑它是否会起作用.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |