我想將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 回答
- 0 關注
- 656 瀏覽
添加回答
舉報
0/150
提交
取消