【问题标题】:Spring Boot Reference Guide - get 404 from app.groovy exampleSpring Boot 参考指南 - 从 app.groovy 示例中获取 404
【发布时间】:2017-12-27 04:15:18
【问题描述】:

我关注Spring Boot Reference Guide 得到了这个错误

HTTP Status [404] – [Not Found]
Type Status Report
Message /
Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

这里是代码

@RestController
class ThisWillActuallyRun {
    @RequestMapping("/")
    String home() {
        "Hello World!"
    }
}

我运行的命令。

spring run app.groovy

我得到的控制台日志。

. ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_||))))) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|===============|___/=/_/_/_/ :: Spring Boot :: (v1.5.4.RELEASE) 2017-07-21 14:37:37.474 INFO 47637 --- [runner-0] osboot.SpringApplication:在 PID 47637 的 MacBook-Pro-2016.local 上启动应用程序(由 /Users/moss/java_ws/ 中的 moss 启动你好) 2017-07-21 14:37:37.477 INFO 47637 --- [runner-0] os.boot.SpringApplication:没有活动配置文件集,回退到默认配置文件:默认 2017-07-21 14:37:37.659 INFO 47637 --- [runner-0] ationConfigEmbeddedWebApplicationContext:刷新 org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@3a0184b7:启动日期 [Fri Jul 21 14:37:37 ICT 2017 ];上下文层次的根 2017-07-21 14:37:38.831 INFO 47637 --- [runner-0] s.b.c.e.t.TomcatEmbeddedServletContainer:Tomcat 使用端口初始化:8080 (http) 2017-07-21 14:37:38.844 INFO 47637 --- [runner-0] o.apache.catalina.core.StandardService:启动服务 [Tomcat] 2017-07-21 14:37:38.846 INFO 47637 --- [runner-0] org.apache.catalina.core.StandardEngine:启动 Servlet 引擎:Apache Tomcat/8.5.15 2017-07-21 14:37:38.923 INFO 47637 --- [ost-startStop-1] org.apache.catalina.loader.WebappLoader:未知加载器 org.springframework.boot.cli.compiler.ExtendedGroovyClassLoader$DefaultScopeParentClassLoader@c0454ed 类org.springframework.boot.cli.compiler.ExtendedGroovyClassLoader$DefaultScopeParentClassLoader 2017-07-21 14:37:38.950 INFO 47637 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]:初始化 Spring 嵌入式 WebApplicationContext 2017-07-21 14:37:38.951 INFO 47637 --- [ost-startStop-1] os.web.context.ContextLoader:根 WebApplicationContext:初始化在 1296 毫秒内完成 2017-07-21 14:37:39.020 信息 47637 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean:映射过滤器:'characterEncodingFilter' 到:[/*] 2017-07-21 14:37:39.605 INFO 47637 --- [runner-0] o.s.j.e.a.AnnotationMBeanExporter:在启​​动时为 JMX 暴露注册 bean 2017-07-21 14:37:39.674 INFO 47637 --- [runner-0] s.b.c.e.t.TomcatEmbeddedServletContainer:Tomcat 在端口:8080 (http) 上启动 2017-07-21 14:37:39.678 INFO 47637 --- [runner-0] os.boot.SpringApplication:在 12.556 秒内启动应用程序(JVM 运行 14.572)

我做错了吗?

【问题讨论】:

  • 你使用的是什么版本的 Spring CLI?
  • Spring CLI v1.5.4.RELEASE
  • @chrylis 我尝试在不同的目录中创建另一个文件,但结果是一样的。

标签: java spring-boot


【解决方案1】:

我只是使用sdkman 切换回Spring CLI v1.5.3.RELEASE 并且它的工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-10-19
    • 2016-06-28
    • 2021-08-10
    • 1970-01-01
    • 2020-04-15
    • 1970-01-01
    • 1970-01-01
    • 2011-10-27
    相关资源
    最近更新 更多