Не получение ответа от контроллера в приложении Spring BootJAVA

Программисты JAVA общаются здесь
Anonymous
Не получение ответа от контроллера в приложении Spring Boot

Сообщение Anonymous »

Я изучаю весеннюю загрузку. Я пытаюсь получить ответ от контроллера, нажав http: // localhost: 8080 URL. Но, к сожалению, я не получаю ожидаемый ответ. < /P>
Вот мой контроллер ... < /p>
package com.learning.helloworld;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ProductController {
@GetMapping
public String product(){
System.out.println("Hi");
return "the product is sold";
}
}
< /code>
Вот pom.xml < /p>

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0

org.springframework.boot
spring-boot-starter-parent
3.0.3


com.learning
helloworld
0.0.1-SNAPSHOT
helloworld
Demo project for Spring Boot

19



org.springframework.boot
spring-boot-starter-web



org.springframework.boot
spring-boot-starter-test
test






org.springframework.boot
spring-boot-maven-plugin



< /code>

после нажатия http: // localhost: 8080 URL The Browser Show

Как решить эту проблему?

Подробнее здесь: https://stackoverflow.com/questions/756 ... pplication

Вернуться в «JAVA»