Spring 来自 GWT
Spring from a GWT
我有下一个问题。我使用 Spring 和 Hibernate 做了一个简单的项目。这是我的项目结构:(哦,我不能附上图片)。
结构:
模块"service" - 整个业务逻辑;
模块 "war" - 生成带有客户端部分的 war 文件。
在模块 war 中,我有一个 .jsp 页面生成 table 来自数据库的数据。还有一些 servlet。在我的 .jsp 页面中,我使用 Spring 获取电影服务。
ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
MovieService bean = (MovieService) context.getBean("movieService");
List<Movie> movieList = bean.getAllMovies();
现在,我需要在这里使用 GWT。如何在 GWT 应用程序中使用 Spring?我只是用 GWT 框架添加新模块,在条目中 class 我不能使用 WebAppContext...
我应该用什么?但是,我可以直接使用我的服务 class,但它并不酷 :) 我想像在 .jsp 页面中那样使用它。
感谢您的帮助!
如果我没理解错的话,你有 3 个选择:
- 使用spring4gwt(可能项目已死)
- 将您的控制器用作 RESTful 服务(可能不是您想要的)
- 像 this 示例中那样使用 spring
另外here你可以找到spring4gwt的自制模拟的例子,也许它也可以工作
我有下一个问题。我使用 Spring 和 Hibernate 做了一个简单的项目。这是我的项目结构:(哦,我不能附上图片)。
结构:
模块"service" - 整个业务逻辑;
模块 "war" - 生成带有客户端部分的 war 文件。
在模块 war 中,我有一个 .jsp 页面生成 table 来自数据库的数据。还有一些 servlet。在我的 .jsp 页面中,我使用 Spring 获取电影服务。
ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
MovieService bean = (MovieService) context.getBean("movieService");
List<Movie> movieList = bean.getAllMovies();
现在,我需要在这里使用 GWT。如何在 GWT 应用程序中使用 Spring?我只是用 GWT 框架添加新模块,在条目中 class 我不能使用 WebAppContext...
我应该用什么?但是,我可以直接使用我的服务 class,但它并不酷 :) 我想像在 .jsp 页面中那样使用它。
感谢您的帮助!
如果我没理解错的话,你有 3 个选择:
- 使用spring4gwt(可能项目已死)
- 将您的控制器用作 RESTful 服务(可能不是您想要的)
- 像 this 示例中那样使用 spring
另外here你可以找到spring4gwt的自制模拟的例子,也许它也可以工作