ResourceHttpRequestHandler : "Path with "WEB-INF" or "META-INF": [WEB-INF/views/main.html]"
Asked Answered
I

0

1

I get 404 error and o.s.w.s.r.ResourceHttpRequestHandler : "Path with "WEB-INF" or "META-INF": [WEB-INF/views/main.html]" in logs. APPLICATION PROPERTIES:

spring.mvc.view.prefix=/WEB-INF/views/
spring.mvc.view.suffix=.html

CONTROLLER:

@RestController
@RequestMapping(value = "/main")
public class MainController {

    @GetMapping(value = "/")
    public ModelAndView showMainPage() {
        ModelAndView mv = new ModelAndView();
        mv.setViewName("main");
        return mv;
    }

}

PROJECT STRUCTURE: project structure

After importing into pom.xml it still doesn't work.

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
        </dependency>
Insensibility answered 18/1, 2023 at 13:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.