M.G*_*ede 2 java intellij-idea
我一直在尝试在 IntelliJ IDEA 中使用 Java 和 SpringBoot 创建一个简单的 hello world 应用程序,但出现此错误,我不知道如何解决。
我在返回时收到错误。Java 似乎不知道如何解析of方法中的public List<String> getHelloWorld方法。
package com.myname.SpringApp;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
public class HelloWorldController {
@RequestMapping("api/hello-world")
@GetMapping
public List<String> getHelloWorld(){
return List.of("Hello", "World");
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5784 次 |
| 最近记录: |