spring boot RestController not seen from Grails -


i have made grails 3 application

$ grails create-app helloworld   

into 1 have created spring controller democontroller.groovy

package helloworld import org.springframework.web.bind.annotation.requestmapping import org.springframework.web.bind.annotation.restcontroller /**  * controller responding  * curl http://localhost:8080/demo  * source location: src/main/groovy/helloworld/democontroller.groovy  *  */ @restcontroller class democontroller {   @requestmapping("/demo")   string demo() {     "hello demo!"   } } 

using

$spring run src/main/groovy/helloworld/democontroller.groovy &   $curl http://localhost:8080/demo    

works fine

using

$gradle bootrun &   $curl http://localhost:8080/demo    

fails! grails reports /demo cannot found

when same thing clean spring boot application (made http://start.spring.io/ ) works fine

i cannot see wrong

i have found solution in ( grails 3 , spring @requestmapping )

the grails application must have @componentscan package hierarchy of grails application java package. in case "helloworld"

application.groovy (generated grails) looks this:

@componentscan("helloworld") class application extends grailsautoconfiguration {   static void main(string[] args) {     grailsapp.run(application)   } } 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -