[英]Web service stopped working after deploy
它在本地主機上工作。 試圖在Heroku和AWS上進行部署。 不起作用 但是靜態資源還可以。 響應為404。
@SpringBootApplication
@RestController
public class WebService implements WebServiceInterface{
public static void main(String[] args) throws Throwable {
SpringApplication.run(WebService.class, args);
}
@Override
@RequestMapping("/getcontent")
public WebContent getContent(@RequestParam(value="id", defaultValue="summary") String id) {
try {
return new WebContent(id);
} catch (IOException e) {
e.printStackTrace();
}
return null;
} }
我在本地使用
mvn spring-boot:運行
這就是為什么我的Web服務沒有問題
對於Heroku和AWS,我部署了war軟件包。 它不適用於我的代碼。 僅此初始化程序有助於解決我的問題:
public class ServletInitializer extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(Application.class); } }
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.