spring-mvc - 当 Intellij Idea View 运行的 Spring Boot 应用程序无法解析时

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

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

问题是 Spring MVC 无法解析 View :

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

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

mvn clean spring-boot:run

一切正常。

两个 View (“home.jsp” - 从 Controller 返回和“start.jsp” - 在配置类中描述)正确解析。

完整源代码你可以看到here

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

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

在文件->项目结构中

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

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

最佳答案

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

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

我有零钱<scope>provided</scope><scope>compile</scope>而且效果很好。

关于spring-mvc - 当 Intellij Idea View 运行的 Spring Boot 应用程序无法解析时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34114681/

相关文章:

json - Spring REST Controller中带有RequestBody的XML/JSON POST

spring - 使用 Spring MVC 框架设置 Intellij

intellij-idea - 如何在 IntelliJ 窗口中堆叠或包装代码选项卡

testing - Flutter:如何加载文件进行测试

spring-boot - 如何在 Spring 集成中重试对 Webflux.outboundgateway 的失败调用

java - 什么是处理在此 Spring Boot 应用程序中实现接口(interface)的不同类列表的智能解决方案?

java - Spring Data REST Controller 不得在类级别使用@RequestMapping,因为这会导致向 Spring MVC 进行双重注册

java - Spring Security 自定义登录表单操作与 default-target-url

maven - Spring Boot 无法识别 mvn liquibase cli 更改,反之亦然

java - Spring 3.2 Autowire 泛型类型