I've been trying to create a simple hello world application with Java and SpringBoot in IntelliJ IDEA, but I get this error and I don't know how to solve it.
I get the error at the return. Java doesn't seem to know how to resolve the of
method that's in the public List<String> getHelloWorld
method.
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");
}
}