Methode 'list.of (java.lang.String, java.lang.String)' nicht nicht beheben kann.

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Methode 'list.of (java.lang.String, java.lang.String)' nicht nicht beheben kann.

by Guest » 04 Feb 2025, 16:13

Ich habe versucht, eine einfache Hello World -Anwendung mit Java und Springboot in der Intellij -Idee zu erstellen, aber ich erhalte diesen Fehler und ich weiß nicht, wie ich ihn lösen soll. < /p>

Ich erhalte den Fehler bei der Rückgabe. Java scheint nicht zu wissen

Code: Select all

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 getHelloWorld(){
return List.of("Hello", "World");
}
}


Top