[英]How to deploy Spring Boot application on Google App Engine(GAE) using Eclipse IDE?
I've created a spring boot application, and I want to deploy it on Google App Engine(GAE). 我已经创建了一个Spring Boot应用程序,并且希望将其部署在Google App Engine(GAE)上。 With reference to that following are the things I've done.
关于这一点,以下是我所做的事情。
Now, when I try to run my application using spring boot or google web application, it gives tomcat connection error. 现在,当我尝试使用Spring Boot或Google Web应用程序运行我的应用程序时,它会显示tomcat连接错误。
Following are the related files, appengine-web.xml 以下是相关文件appengine-web.xml
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>appname</application>
<version>1</version>
<threadsafe>true</threadsafe>
</appengine-web-app>
web.xml web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>org.example.Application</param-value>
</context-param>
<listener>
<listener-class>org.springframework.boot.legacy.context.web.SpringBootContextLoaderListener</listener-class>
</listener>
<filter>
<filter-name>metricFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>metricFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextAttribute</param-name>
<param-value>org.springframework.web.context.WebApplicationContext.ROOT</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
pom.xml pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>spring-boot-fundamentals</artifactId>
<version>1.0-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.1.RELEASE</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.7</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-legacy</artifactId>
<version>1.0.2.RELEASE</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<packaging>war</packaging>
</project>
Before Spring Boot, I used to deploy an application to GAE using Google plugin. 在Spring Boot之前,我曾经使用Google插件将应用程序部署到GAE。 But for Spring Boot application, it's completely different.
但是对于Spring Boot应用程序,则完全不同。 Just add appengine-web.xml and web.xml files under webapp/WEB-INF folder and use "mvn appengine:update" to deploy the application.
只需在webapp / WEB-INF文件夹下添加appengine-web.xml和web.xml文件,然后使用“ mvn appengine:update”来部署该应用程序。
You are missing a number of the steps required to convert a Spring Boot application for App Engine Standard . 您缺少为App Engine Standard转换Spring Boot应用程序所需的许多步骤。 In your particular case you need to:
在您的特定情况下,您需要:
Or you could simply base yourself on the configuration in this sample Spring Boot application . 或者,您可以简单地基于此示例Spring Boot应用程序中的配置。
I would go into more details but then I'd simply be rewriting the source material, which I encourage you to read. 我将进一步介绍细节,但是之后我将只重写源材料,我鼓励您阅读这些源材料。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.