SpringBoot javax.servlet.ServletException: Could not resolve view with name ‘login’ in servlet with name ‘XXX’

SpringBoot javax.servlet.ServletException: Could not resolve view with name ‘login’ in servlet with name ‘XXX’

文章目录

错误提示: javax.servlet.ServletException: Could not resolve view with name ‘login’ in servlet with name ‘XXX’

开发配置 SpringBoot maven Thymleaf

RootCause:找不到视图或者视图生成不了,但是页面文件xxx.ftl 已经存在,所以应该是视图生成不了的原因,最后发现是freemarker的dependency没有引入

解决办法,在pom.xml文件中添加 freemarker的dependency

       <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-freemarker</artifactId>
        </dependency>

参考链接: