When Spring Boot application running by Intelij Id

2019-07-10 06:34发布

问题:

I have encountered a strange situation, the decision which I cant find. I`m runnig simple demo application using Spring Boot 1.3.0 and Intelij Idea 14.1.3

The problem is that Spring MVC cant resolve the view:

javax.servlet.ServletException: Could not resolve view with name 'home' in servlet with name 'dispatcherServlet'

Oddity is that when I run application by Maven Spring Boot-plugin

mvn clean spring-boot:run

everythig works fine.

Both views ("home.jsp" - returning from Controller and "start.jsp" - described in Configuration class) resolve correctly.

Full source code you can see here

I`ve downloaded another demo project - the same situation.

So, I think that something wrong with my IDE configuration. But what is going wrong - I don`t know.

In File->Project Structure

I have added Spring and web module in "Modules" tab, the same I`ve made in "Facets" tab.

What is possible to do to make application run correctly using IDE?

回答1:

Problem was in dependecies configuration in pom.xml

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

I have change <scope>provided</scope> to <scope>compile</scope> and it works well.