gpt4 book ai didi

java - Intellij 运行配置 Spring Boot 与 Maven 问题

转载 作者:塔克拉玛干 更新时间:2023-11-03 04:58:02 24 4
gpt4 key购买 nike

我正在尝试使用 Intellij IDEA 运行我的 Spring Boot 项目。这个项目是 Spring MVC 类型的,这意味着它在路径 main/webapp/WEB-INF/jsp 中有 JSP 文件。

我的 application.properties 有这些设置:

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

当我在 Intellij 中将项目作为“Spring Boot 运行配置”运行时,服务器无法识别 JSP 文件的路径。这是我收到的消息:

enter image description herez

如果我使用命令 spring-boot:run 使用“Maven Run Configuration”运行项目,一切正常。

我不知道为什么会这样。项目的代码和设置与每个运行配置相同。

你可以尝试这个项目(不是我的项目)来理解我的意思https://github.com/mariuszs/spring-boot-web-jsp-example .

我的项目表现相同。我应该注意到,当项目使用 Spring Boot 运行配置运行时,我确实在控制台中看到 Controller 已正确映射。

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()

最佳答案

我通过在运行配置中将工作目录设置为 $MODULE_DIR$ 解决了这个问题。

关于java - Intellij 运行配置 Spring Boot 与 Maven 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44794588/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com