【发布时间】:2023-01-27 20:04:06
【问题描述】:
我对那个初学者问题感到非常沮丧 只需使用 JDK 18 和 UpToDate IntelliJ 启动一个全新的 Spring Boot 项目。
不再插入此控制器的代码:
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!";
}
}
打电话:卷曲本地主机: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。
有什么建议可以指出正确的问题或者更好的解决方案吗?
【问题讨论】:
标签: spring spring-boot spring-restcontroller