在使用GWT的RPC时,我们一般会创建一个类继承RemoteServiceServlet
这样就可以时候GWT提供给我们的RPC调用了。
RemoteServiceServlet继承了HttpServlet,要想与Spring整合,只需要覆写HttpServlet中的
public void init(ServletConfig config) throws ServletException 方法即可
public class BaseService extends RemoteServiceServlet {
protected WebApplicationContext springContext;
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
springContext = WebApplicationContextUtils.getWebApplicationContext(
config.getServletContext(),
WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
}
}
之后我们所有的类都继承这个BaseService,就可以拿到Spring上下文springContext了
通过:
Object obj=springContext.getBean("object");
拿到spring注入的类
分享到:
相关推荐
GWT与Spring整合,分析的很透彻,有代码过程。
gwt+spring+hibernate整合例子,导入myeclipse中(要安gwt插件)即可用,数据库自己去代码中查看。包是精简版的,去掉很多不必要的包
smartGwt、spring、Mybatis整合;一个登录和一个分页查询功能;根据用户获取相应的权限;gwt2.4、内付数据表
一个简单的maven项目,演示 smartgwt + spring + hibernate 整合框架
GWT整合spring网上资源十分少,版本比较旧,晚点进行更新
GWT整合SPRING, 愿与大家分享!
GSH:spring3.1.0M2+Hibernate3.5+GWT2.4+JPA+Annotation+Spring4gwt0.0.1亲手整合,也可以上新浪博客去看 http://blog.sina.com.cn/s/blog_687dfecb0100yrmf.html
上次上传的没有包含数据库表这次补上;smartGwt、spring和Mybatis的整合
这是csdn上其他博主的资源,我把它整合起来
NULL 博文链接:https://digga2012.iteye.com/blog/1450696
GWT整合Spring时需要这个包,在官网上没有最新的jar包,这是自己用jar命令生成的,并测试可以使用。
Gwt Rpc Spring做的一个整合
Gwt和Spring做的一个整合,里面可以直接运行war
pro web 2.0 application development with gwt. 基于gwt1.5,详细讲解了和spring等流行框架的整合。
浪曦 的webwork+spring+hibernate