Mossila Mossila - 3 years ago 110
Java Question

Spring Boot Reference Guide - get 404 from app.groovy example

I follow Spring Boot Reference Guide and got this error

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.


Here is the code

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


Command that I run.

spring run app.groovy


Console log that I got.



. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: 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)



Did I do something wrong?

Answer Source

I just use sdkman switch back to Spring CLI v1.5.3.RELEASE and it's work.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download