【问题标题】:When Spring Boot application running by Intelij Idea views can`t be resolved当 Intellij Idea 视图运行的 Spring Boot 应用程序无法解析时
【发布时间】:2015-12-06 06:19:51
【问题描述】:

我遇到了一个奇怪的情况,我找不到的决定。 我正在使用 Spring Boot 1.3.0 和 Intelij Idea 14.1.3 运行简单的演示应用程序

问题是Spring MVC无法解析视图:

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

奇怪的是,当我通过 Maven Spring Boot-plugin 运行应用程序时

mvn clean spring-boot:run

一切正常。

两个视图(“home.jsp” - 从控制器返回和“start.jsp” - 在配置类中描述)正确解析。

完整源码你可以看here

我已经下载了another demo project - 同样的情况。

所以,我认为我的 IDE 配置有问题。 但出了什么问题 - 我不知道。

在文件->项目结构中

我在“模块”选项卡中添加了 Spring 和 Web 模块,与我在“Facets”选项卡中所做的相同。

如何使用 IDE 使应用程序正确运行?

【问题讨论】:

    标签: spring-mvc intellij-idea spring-boot maven-plugin


    【解决方案1】:

    问题在于 pom.xml 中的依赖配置

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

    我已将 &lt;scope&gt;provided&lt;/scope&gt; 更改为 &lt;scope&gt;compile&lt;/scope&gt; 并且效果很好。

    【讨论】:

    • 遇到同样的问题已经有一段时间了,现在解决了,非常感谢!
    • 同样的问题,浪费时间 - 你的解决方案。它有效,@Workin_Man!
    • 非常感谢,我花了几个小时寻找这么简单的东西。我也有提供的空间!将其更改为编译并立即运行。
    猜你喜欢
    • 2016-03-15
    • 2016-03-29
    • 2016-12-28
    • 2016-06-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-23
    相关资源
    最近更新 更多