Java 使用Azure应用程序服务的Spring boot应用程序终结点
我正在尝试将简单的Spring Boot应用程序部署到Azure应用程序服务,但看起来应用程序并没有启动 我的应用程序在rest端点上具有Java 使用Azure应用程序服务的Spring boot应用程序终结点,java,spring,azure,spring-boot,Java,Spring,Azure,Spring Boot,我正在尝试将简单的Spring Boot应用程序部署到Azure应用程序服务,但看起来应用程序并没有启动 我的应用程序在rest端点上具有 @RequestMapping("/") public String index() { return "Greetings from Spring Boot!"; } 我尝试使用azure webapp maven插件进行部署,pom中的配置如下所示 <plugin> <groupId>com.
@RequestMapping("/")
public String index() {
return "Greetings from Spring Boot!";
}
我尝试使用azure webapp maven插件进行部署,pom中的配置如下所示
<plugin>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-webapp-maven-plugin</artifactId>
<version>1.7.0</version>
<configuration>
<schemaVersion>V2</schemaVersion>
<!-- Web App information -->
<resourceGroup>${resourceGroup}</resourceGroup>
<appName>boot-test-app</appName>
<region>westeurope</region>
<pricingTier>P1V2</pricingTier>
<runtime>
<os>linux</os>
<javaVersion>jre8</javaVersion>
<webContainer>tomcat 8.5</webContainer>
</runtime>
<appSettings>
<property>
<name>PORT</name>
<value>80</value>
</property>
<property>
<name>JAVA_OPTS</name>
<value>-Xmx512m -Xms512m</value>
</property>
</appSettings>
<deployment>
<resources>
<resource>
<directory>${project.basedir}/target</directory>
<!--<targetPath>/home/site/wwwroot/webapps/ROOT/</targetPath>-->
<includes>
<include>*.war</include>
</includes>
</resource>
</resources>
</deployment>
</configuration>
</plugin>
com.microsoft.azure
azure webapp maven插件
1.7.0
V2
${resourceGroup}
启动测试应用程序
西欧
P1V2
linux
jre8
tomcat 8.5
港口
80
JAVA_选项
-Xmx512m-Xms512m
${project.basedir}/target
*.战争
插件说部署成功了,但当我打开应用程序网页时,我得到了404错误。
如果我使用Intellij Idea的Azure插件进行部署,情况也是如此
我错过了什么?
谢谢 请按照本教程进行部署:。我测试了多次,这对我来说很有效。或者您可以使用我的pom.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework</groupId>
<artifactId>gs-spring-boot</artifactId>
<version>0.1.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.6.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- tag::actuator[] -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- end::actuator[] -->
<!-- tag::tests[] -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- end::tests[] -->
</dependencies>
<properties>
<java.version>1.8</java.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-webapp-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<schemaVersion>V2</schemaVersion>
<resourceGroup>group name</resourceGroup>
<appName>app name</appName>
<region>westeurope</region>
<pricingTier>P1V2</pricingTier>
<!-- Begin of App Settings -->
<appSettings>
<property>
<name>JAVA_OPTS</name>
<value>-Dserver.port=80</value>
</property>
</appSettings>
<runtime>
<os>linux</os>
<javaVersion>jre8</javaVersion>
<webContainer>jre8</webContainer>
</runtime>
<deployment>
<resources>
<resource>
<directory>${project.basedir}/target</directory>
<includes>
<include>*.jar</include>
</includes>
</resource>
</resources>
</deployment>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
4.0.0
org.springframework
弹簧靴
0.1.0
org.springframework.boot
spring启动程序父级
2.1.6.1发布
org.springframework.boot
SpringBootStarterWeb
org.springframework.boot
弹簧靴起动器执行器
org.springframework.boot
弹簧起动试验
试验
1.8
org.springframework.boot
springbootmaven插件
com.microsoft.azure
azure webapp maven插件
1.6.0
V2
组名
应用程序名称
西欧
P1V2
JAVA_选项
-数据服务器端口=80
linux
jre8
jre8
${project.basedir}/target
*jar先生
maven故障保护插件
集成测试
验证
部署后,如果web仍然没有显示正确的页面,请检查运行时堆栈是否与您在pom.xml中定义的相同 谢谢,我忘了删除
选项。