Estoy trabajando en proyectos con Spring boot y Spring web principalmente, hice un proyecto sencillo solo para entender el funcionamiento de spring y no me funciona. no sale ningun error inicializa el servidor pero no hace el return del servicio rest.
Adjunto mi POM
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" 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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-start
er-parent</artifactId>
<version>2.1.13.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>init.product</groupId>
<artifactId>hulkstore</artifactId>
<version>1</version>
<name>hulkstore</name>
<description>Api Hulk Store</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
Clase REST
package com.yefersoncm.rest;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(value="/")
public class UserRest {
@GetMapping
public String helloWorld() {
return "Hello World";
}
}
Main
package com.yefersoncm.hulkstore;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class HulkstoreApplication {
public static void main(String[] args) {
SpringApplication.run(HulkstoreApplication.class, args);
}
}
Al correr ejecutar como Spring Boot Aplication sale lo siguiente
2020-04-12 10:49:11.539 INFO 403080 --- [ main] c.y.hulkstore.HulkstoreApplication : Starting HulkstoreApplication on LAPTOP-HBBAHBR4 with PID 403080 (C:\Users\Yefersonft\eclipse-workspace\hulkstore\target\classes started by Yefersonft in C:\Users\Yefersonft\eclipse-workspace\hulkstore)
2020-04-12 10:49:11.539 INFO 403080 --- [ main] c.y.hulkstore.HulkstoreApplication : No active profile set, falling back to default profiles: default
2020-04-12 10:49:12.498 INFO 403080 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2020-04-12 10:49:12.522 INFO 403080 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-04-12 10:49:12.522 INFO 403080 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.31]
2020-04-12 10:49:12.647 INFO 403080 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-04-12 10:49:12.647 INFO 403080 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1061 ms
2020-04-12 10:49:12.866 INFO 403080 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2020-04-12 10:49:13.053 INFO 403080 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2020-04-12 10:49:13.053 INFO 403080 --- [ main] c.y.hulkstore.HulkstoreApplication : Started HulkstoreApplication in 1.834 seconds (JVM running for 2.716)
2020-04-12 10:49:16.975 INFO 403080 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2020-04-12 10:49:16.976 INFO 403080 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2020-04-12 10:49:16.984 INFO 403080 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 8 ms
Segun yo, no hay ningun error segun eso, el Tomcat se inicia pero el rest no funciona, no me retorna el hola mundo, quisiera saber que puedo estar haciendo mal, ya intente con ResponseEntity<String>
en el método y no funciona tampoco.
Muchas gracias de antemano.