简体   繁体   English

带有Spring MVC的Google App Engine

[英]Google App Engine with Spring MVC

I want to use GAE with Spring MVC 我想将GAE与Spring MVC一起使用

so, I found this following site. 所以,我发现以下网站。

here 这里

but This site's example seems to manually add jar files. 但这个网站的例子似乎是手动添加jar文件。

I think it is inefficient. 我认为效率低下。

In eclipse, Is there another way like adding dependency on pom.xml in spring MVC project? 在eclipse中,还有另一种方法,比如在spring MVC项目中添加对pom.xml的依赖吗?

I would suggest you to git clone the guestbook-spring project (it's adding Spring MVC to the GAE guestbook example) and continue from there. 我建议你git克隆guestbook-spring项目 (它将Spring MVC添加到GAE留言簿示例中)并从那里继续。

We have builded our webapp app based on this, and it's great. 我们已经基于此构建了我们的webapp应用程序,这很棒。

PS Also, it got tests for the controller included. PS此外,它还包含了对控制器的测试。 It's good to have it as inspiration for testing you future app (as a developing practice). 将它作为测试未来应用程序(作为开发实践)的灵感是很好的。

You could use gae archetype to create your project firstly, and then add spring components to pom.xml: 您可以先使用gae archetype创建项目,然后将spring组件添加到pom.xml:

mvn archetype:generate -Dappengine-version=1.9.14 -Dapplication-id=your-app-id -Dfilter=com.google.appengine.archetypes

where -Dappengine-version is set to the most recent App Engine Java SDK version, and application-id is set to the Developer console application ID used for your app. 其中-Dappengine-version设置为最新的App Engine Java SDK版本,application-id设置为用于应用程序的Developer Console应用程序ID。

Yes, if you have created a maven project, then it is much easier to add dependencies using pom.xml. 是的,如果您已经创建了一个maven项目,那么使用pom.xml添加依赖项要容易得多。

You can edit directly, or use eclipse maven pom manager to add dependencies directly, or from a repository. 您可以直接编辑,或使用eclipse maven pom manager直接添加依赖项,或者从存储库添加依赖项。

The link you gave does not create a maven project, but you can modify the instructions so it does. 您提供的链接不会创建maven项目,但您可以修改说明。

You can create maven project instead of Web Application at the start, then add Spring dependencies and continue adding dependencies from there. 您可以在开始时创建maven项目而不是Web Application,然后添加Spring依赖项并继续从那里添加依赖项。

You can also follow this video tutorial . 您也可以关注此视频教程 It will give you step by step idea how to deploy your app in the Google App Engine. 它将逐步介绍如何在Google App Engine中部署您的应用。

I found simple way. 我找到了简单的方法。

1.First, Create Spring MVC Project, and add dependency and plugin in pom.xml 1.首先,创建Spring MVC项目,并在pom.xml中添加依赖项和插件

1.1 add gae dependency 1.1添加gae依赖

 <dependency>
        <groupId>com.google.appengine</groupId>
        <artifactId>appengine-api-1.0-sdk</artifactId>
        <version>1.9.14</version>
 </dependency>

1.2 add gae plugin 1.2添加gae插件

  <plugin>
        <groupId>com.google.appengine</groupId>
        <artifactId>appengine-maven-plugin</artifactId>
        <version>1.9.14</version>
  </plugin>
  1. In WEB-INF, create appengine-web.xml and logging.properties 在WEB-INF中,创建appengine-web.xml和logging.properties

then, you can run it on server 然后,您可以在服务器上运行它

在右键单击项目 - >配置 - >转换为maven项目之后,创建一个新的Web应用程序项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM