Intellij Run Configuration Spring Download and Maven Issues

I am trying to run my Spring boot project with Intellij IDEA. This project is of type Spring MVC, which means it has JSP files in the path main/webapp/WEB-INF/jsp.

My application.propertieshas the following settings:

spring.view.prefix=/WEB-INF/jsp/
spring.view.suffix=.jsp

When I run a project in Intellij as "

enter image description here g

If I start the project using the "Maven Launch Configuration" using the command spring-boot:run, everything works fine.

I have no idea why this is happening. The code and project settings are the same with each launch configuration.

You can try this project (not my project) to understand what I mean https://github.com/mariuszs/spring-boot-web-jsp-example .

. , Spring , .

2017-06-28 08:29:13.906  INFO 10308 --- [           main] o.s.w.s.h.SimpleUrlHandlerMapping        : Mapped URL path [/login] onto handler of type [class org.springframework.web.servlet.mvc.ParameterizableViewController]

2017-06-28 08:29:13.835  INFO 10308 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/login],methods=[GET]}" onto public java.lang.String com.intuit.mintbills.controllers.generic.LoginController.getLoginPage()
+4
1

IntelliJ Spring. :

-

, . web.xml, IntelliJ src/main/webapp. web.xml src/main/webapp/WEB-INF reimport , - . - , webapp.

web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
         version="3.1">
</web-app>

" " src/main/webapp:

project structure

IntelliJ , . , ..., . , tomcat-embed-jasper, ecj .

dependency configuration

, , , pom.xml. <scope> pom.xml:

<dependency>
    <groupId>org.apache.tomcat.embed</groupId>
    <artifactId>tomcat-embed-jasper</artifactId>
</dependency>

- (, Tomcat), , , -.

JSP

WAR, , JSP JAR. :

Spring, ( ), JSP.

  • Tomcat , , .. , ( , Tomcat). - Tomcat.
  • Jetty , , .. , .
  • Undertow JSP.
  • error.jsp , .
+3

Source: https://habr.com/ru/post/1680276/


All Articles