是否需要执行一个步骤,比如将jar添加到classpath中?Spring Boot @RestController
我也跟着这样的:
10.2.6快速启动春季CLI例如
这里,你可以用它来测试你的安装非常简单的Web应用程序。创建一个文件名为app.groovy:
@RestController
class ThisWillActuallyRun {
@RequestMapping("/")
String home() {
"Hello World!"
}
}
然后只需从shell中运行它:
$ spring run app.groovy
,并得到:
startup failed:
file:/home/rgupta/Documents/products/microservices/postabook/hola-springboot/app.groovy: 1: unable to resolve class ResttController, unable to find class for annotation
@ line 1, column 1.
@ResttController
^
file:/home/rgupta/Documents/products/microservices/postabook/hola-springboot/app.groovy: 4: unable to resolve class RequestMapping , unable to find class for annotation
@ line 4, column 5.
@RequestMapping("/")
^
2 errors
[[email protected] hola-springboot]$
'app.groovy'真的是你文件的内容吗?它正在寻找'ResttController'的错误信息(注意双t)听起来不对。 –