亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Spring Boot War部署到Tomcat

Spring Boot War部署到Tomcat

鳳凰求蠱 2019-11-28 13:59:52
我想將Spring Boot應用程序部署到Tomcat,因為我想部署到AWS。我創建了一個WAR文件,但是即使它可見,它似乎也不能在Tomcat上運行。詳細信息:0。這是我的應用程序:@Configuration@ComponentScan@EnableAutoConfigurationpublic class App {    public static void main(String[] args) {        SpringApplication.run(SampleController.class, args);    }}@Controller@EnableAutoConfigurationpublic class SampleController {    @RequestMapping("/help")    @ResponseBody    String home() {        String input = "Hi! Please use 'tag','check' and 'close' resources.";        return input;    }}application.properties具有以下內容:server.port=${port:7777}閱讀了許多頁面和問題后,我在POM中添加了以下內容:http://maven.apache.org/xsd/maven-4.0.0.xsd“> 4.0.0<groupId>com.niewlabs</groupId><artifactId>highlighter</artifactId><version>1.0-SNAPSHOT</version><packaging>war</packaging><properties>    <java.version>1.8</java.version></properties>    <parent>    <groupId>org.springframework.boot</groupId>    <artifactId>spring-boot-starter-parent</artifactId>    <version>1.1.9.RELEASE</version></parent>    <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></dependencies>我運行“ MVN程序包”,并獲得了WAR文件(大小為250Mb),并將其放入“ webapps”文件夾中。我啟動了Tomcat,并能夠看到列出的應用程序,在本例中為“ /highlighter-1.0-SNAPSHOT”。單擊應用程序的鏈接將顯示“狀態404”頁面。當我單獨運行Spring Boot應用程序時,沒有容器時,它運行在localhost:7777上,但是在Tomcat中運行時卻沒有任何顯示。更新:還有另一個參考。不知道它有多有用。
查看完整描述

3 回答

  • 3 回答
  • 0 關注
  • 656 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號