[英]HelloRestAPI showing 404 (created with IntelliJ Spring Initializr)
我對那個初學者問題感到非常沮喪只需使用 JDK18 和 UpToDate IntelliJ 啟動一個新的 SpringBoot 項目。
不再插入此 Controller 的代碼:
package com.example.springboot;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloController {
@GetMapping("/")
public String index() {
return "Greetings from Spring Boot!";
}
}
調用: curl localhost:8080並得到一個異常的 404:
The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.
搜索該回復,將我指向談論視圖 jsp 和 web.xml 的非常老的線程
但我不想有令人討厭的效果圖。 我想要純 REST-Controller。
有什么建議可以指出正確的問題或者更好的解決方案嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.