问题描述
我遇到了一个奇怪的情况,这是我无法找到的决定。
我使用Spring Boot 1.3.0和Intelij Idea 14.1.3运行简单的演示应用程序
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
问题是Spring MVC无法解析视图:
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'
当我通过Maven Spring Boot-plugin运行应用程序时,奇怪的是
Oddity is that when I run application by Maven Spring Boot-plugin
mvn clean spring-boot:run
everythig工作正常。
everythig works fine.
两个视图(home.jsp - 从Controller返回,start.jsp - 在Configuration类中描述)解析正确。
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.
所以,我认为我的IDE配置有问题。
但是出了什么问题 - 我不知道。
So, I think that something wrong with my IDE configuration.But what is going wrong - I don`t know.
在文件 - >项目结构中
In File->Project Structure
我在模块选项卡中添加了Spring和Web模块,与我在Facets选项卡中创建的相同。
I have added Spring and web module in "Modules" tab, the same I`ve made in "Facets" tab.
有什么可以做的应用程序使用IDE正确运行?
What is possible to do to make application run correctly using IDE?
推荐答案
pom.xml中的dependecies配置存在问题
Problem was in dependecies configuration in pom.xml
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
我已更改< scope>已提供< / scope>
到< scope>编译< / scope>
,效果很好。
I have change <scope>provided</scope>
to <scope>compile</scope>
and it works well.
这篇关于当Intelij Idea视图运行的Spring Boot应用程序无法解析时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!