【问题标题】:Run/Debug Spring Boot application from Eclipse JEE Neon alone?仅从 Eclipse JEE Neon 运行/调试 Spring Boot 应用程序?
【发布时间】:2017-05-28 02:40:20
【问题描述】:

我会保持这个速度。

我正在关注the Spring documentation listed here 的示例。当我使用 Gradle 时,我可以通过以下方式运行应用程序:

./gradlew bootRun. 

或者我可以使用

构建 JAR 文件
./gradlew build

运行jar文件

虽然所有这些都按照指示运行,但这有点痛苦。当我向老板展示这个应用程序时,我想直接通过 IDE 运行它。每当我右键单击项目(甚至只是应用程序类)尝试运行它时,该服务都不起作用,只是将我带到以下错误:

This application has no explicit mapping for /error, so you are seeing this as a fallback.
Sat May 27 22:32:23 EDT 2017
There was an unexpected error (type=Internal Server Error, status=500).
Error resolving template "greeting", template might not exist or might not be accessible by any of the configured Template Resolvers

我用谷歌搜索了这个,似乎找不到解决方案。我曾尝试创建一个src/main/resource/static/home.html,但它不起作用。

有没有人可以帮助我解决这个问题?仅作记录,application.properties 文件当前读取为:

spring.mobile.devicedelegatingviewresolver.enabled: true

【问题讨论】:

  • 我已经让它与 maven 和 m2e 一起工作,再也没有回到 gradle(或 sbt)上工作。你有 STS 吗?
  • 下载eclipse的gradle插件。单击您的项目gradle -> refresh 并将其作为 Spring 启动应用程序运行。
  • 错误是抱怨缺少greeting.html 那么为什么要添加home.html 帮助呢?此外,在使用 Gradle 项目时,请确保您使用 Eclipse 的 Gradle 插件来导入项目,否则将不会将内容添加到类路径中。
  • 我已经有了eclipse的gradle插件。当我刷新它时,它什么也不做。我添加 home.html 的原因是因为另一个教程告诉我添加 src/main/static/home.html 才能开始。此外,在我从头开始构建项目时,我没有导入任何内容。现在它甚至不起作用,因为当我运行它时不会动态进行更改。所以我不知道我昨天尝试的哪些改变/事情打破了这个。

标签: java spring eclipse gradle spring-boot


【解决方案1】:

修复它。

所以发生了一些事情......

主要是你必须在包资源管理器中实际打开项目,选择应用程序类,右键单击并作为 java 项目运行。我只是单击项目,右键单击,然后尝试了一堆不同的选项(spring 应用程序、hello 应用程序等)。

【讨论】:

猜你喜欢
  • 2016-03-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-05-02
  • 1970-01-01
  • 2020-03-18
  • 2016-04-27
相关资源
最近更新 更多