我关注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] o.s.boot.SpringApplication               : Starting application on MacBook-Pro-2016.local with PID 47637 (started by moss in /Users/moss/java_ws/hello) 
2017-07-21 14:37:37.477  INFO 47637 --- [       runner-0] o.s.boot.SpringApplication               : No active profile set, falling back to default profiles: default 
2017-07-21 14:37:37.659  INFO 47637 --- [       runner-0] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@3a0184b7: startup date [Fri Jul 21 14:37:37 ICT 2017]; root of context hierarchy 
2017-07-21 14:37:38.831  INFO 47637 --- [       runner-0] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http) 
2017-07-21 14:37:38.844  INFO 47637 --- [       runner-0] o.apache.catalina.core.StandardService   : Starting service [Tomcat] 
2017-07-21 14:37:38.846  INFO 47637 --- [       runner-0] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.15 
2017-07-21 14:37:38.923  INFO 47637 --- [ost-startStop-1] org.apache.catalina.loader.WebappLoader  : Unknown loader org.springframework.boot.cli.compiler.ExtendedGroovyClassLoader$DefaultScopeParentClassLoader@c0454ed class 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].[/]       : Initializing Spring embedded WebApplicationContext 
2017-07-21 14:37:38.951  INFO 47637 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1296 ms 
2017-07-21 14:37:39.020  INFO 47637 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*] 
2017-07-21 14:37:39.605  INFO 47637 --- [       runner-0] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup 
2017-07-21 14:37:39.674  INFO 47637 --- [       runner-0] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http) 
2017-07-21 14:37:39.678  INFO 47637 --- [       runner-0] o.s.boot.SpringApplication               : Started application in 12.556 seconds (JVM running for 14.572) 
 

我做错了什么吗?

请您参考如下方法:

我只是使用 sdkman 切换回 Spring CLI v1.5.3.RELEASE 就可以了。


评论关闭
IT源码网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!