dimanche 29 novembre 2020

My "/" requestMapping sent me a WhiteLabel "/" error

I want to simply map my home page with a Spring Controller like this :

package com.douineau.testspringboot.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/")
public class HomeController {

    @GetMapping
//  @ResponseBody
    public String home() {
        return "index";
    }
}

I also have index.html in src/main/webapp folder. But the application does not recognize the mapping, whereas if comment this all, the app recognizes that it is my home page.

What am I missing?




Aucun commentaire:

Enregistrer un commentaire