Java Spring does not map HTML templates

Viewed 25

I'm working on a Spring project with Gradle, I use mysql-connector-java v-8.0.30, javax.persistence-api v-2.2, and spring-boot-starter-data-jpa dependencies. My project was running correctly, but from one moment to another it stopped compiling, only the Spring logo appears in the console with the following warning: RN 19232 --- [ restartedMain] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning

enter image description here

What I thought at first is that the application was not compiling, however when I access it, I execute a class method annotated with @RestController and I paint a message in the HTMl, it is displayed correctly.

@SpringBootApplication
@RestController
   public class CompraventaspringApplication {

       public static void main(String[] args) {
        SpringApplication.run(CompraventaspringApplication.class, args);
       }

       @GetMapping("/")
       public static String message(@RequestParam(value = "saludo", defaultValue =
       "i'm a CRUD system") String saludo )
       {
          return String.format("<h1>Hello  %s ! </h1>", saludo);
       }

enter image description here

However, when I try to bind any route from a controller to an HTML template the route doesn't map properly. I've already tried to remove the Gradle dependencies and rebuild them but still can't find my HTML:

@Controller
@RequestMapping
public class ControllerProductos {
    @Autowired
    public ProductoServicesClass service;

    public static String UPLOADS = "src/main/resources/static/uploads";

    // Listar todos los productos diponibles
    @GetMapping("/home")
    public String listar(Model model) {
        List<Productos> productos = service.listar();

        model.addAttribute("productos", productos);

        return "HomePage";
    }
 }
 

enter image description here

I already checked several times and yes, the name of the template is the same as the one associated with the return of the method.

0 Answers
Related