我想將Spring Boot應(yīng)用程序部署到Tomcat,因?yàn)槲蚁氩渴鸬紸WS。我創(chuàng)建了一個(gè)WAR文件,但是即使它可見,它似乎也不能在Tomcat上運(yùn)行。詳細(xì)信息:0。這是我的應(yīng)用程序:@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具有以下內(nèi)容:server.port=${port:7777}閱讀了許多頁面和問題后,我在POM中添加了以下內(nèi)容: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>我運(yùn)行“ MVN程序包”,并獲得了WAR文件(大小為250Mb),并將其放入“ webapps”文件夾中。我啟動(dòng)了Tomcat,并能夠看到列出的應(yīng)用程序,在本例中為“ /highlighter-1.0-SNAPSHOT”。單擊應(yīng)用程序的鏈接將顯示“狀態(tài)404”頁面。當(dāng)我單獨(dú)運(yùn)行Spring Boot應(yīng)用程序時(shí),沒有容器時(shí),它運(yùn)行在localhost:7777上,但是在Tomcat中運(yùn)行時(shí)卻沒有任何顯示。更新:還有另一個(gè)參考。不知道它有多有用。
- 3 回答
- 0 關(guān)注
- 676 瀏覽
添加回答
舉報(bào)
0/150
提交
取消