Summary: This section is primarily about Spring boot support JSP, which has been a bit of a detour due to the lack of familiarity with spring boot.
Environment:
idea15+
jdk1.8+
maven3+
First, pom.xml resource dependence
Relative to Chapter01, there are more resources to rely on here. There is no direct reference to SPRING-WEBMVC, Spring-boot-starter, and Spring-boot-tomcat, as in Chapter01, but by referencing Spring-boot-starter-web resources.
It can be seen that spring-boot-starter-web contains Chapter01 resources, and in order to parse the JSP resources need to introduce jsaper, the JSP file precompiled into a Java file, and then compiled into a class file. The JVM can now load the corresponding class file for the JSP
In addition, JSTL (JSP standard Tag Library) resources are mainly JSP standards tag libraries, improve JSP development efficiency
Note: There is an indirect dependency of spring-boot-starter-parent on the <parent> node, otherwise there will be compile exceptions at compile time.
Second, springboot configuration
Here are the main settings for SPRINGMVC view parser related properties
Spring.mvc.view.prefix:/web-inf/jsp/spring.mvc.view.suffix:. jsp
Startclass differs from Chapter01, where Springbootservletinitializer is inherited primarily by inheriting this class to deploy the application to the servlet container
@SpringBootApplication @componentscan (value= "Com.shujushow") Public classChapter02applicationextendsSpringbootservletinitializer {@OverrideprotectedSpringapplicationbuilder Configure (Springapplicationbuilder application) {returnApplication.sources (chapter02application.class); } Public Static voidMain (string[] args)throwsexception{Springapplication.run (chapter02application.class, args); }}
Springboot-shiro Chapter02--springboot Webmvc JSP