是否需要執行一個步驟,比如將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)聽起來不對。 –