2

In a running app (with gradle bootRun) I add a simple println params to a controller action:

def index( Integer max ) {
  params.max = Math.min( max ?: 20, 100 )
  println params
  respond Some.list( params ), model:[ someCount:Some.count() ]
}

In the logs I can see:

File C:\workspace-neon\proj\grails-app\controllers\io.smth.SomeController.groovy changed, recompiling...

11:23:08.632 [Thread-14] INFO o.s.b.f.s.DefaultListableBeanFactory - Overriding bean definition for bean 'io.smth.SomeController' with a different definition: replacing [Generic bean: class [io.smth.SomeController]; scope=singleton; abstract=false; lazyInit=true; autowireMode=1; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Generic bean: class [io.smth.SomeController]; scope=singleton; abstract=false; lazyInit=false; autowireMode=1; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]

Although when I run the action in question, I see no println output in the console.

What am I missing?

Community
  • 1
  • 1
injecteer
  • 20,038
  • 4
  • 45
  • 89
  • I just created a blank Grails 3.2.11 on macOS and added a simple controller to it. Then started the app using `./gradlew bootRun` and called the index action of that controller. After that I modified the action with a `println` statement. It recompiled it and after I called the action the output of that println statement was visible in the console. So it not seems to be a general issue with Grails 3.2.11. – saw303 Oct 18 '17 at 06:22
  • @saw303 that might well be with no dependencies. let's put the question the other way around: what should I do to disable controller reloading in development mode? any tricks with spring-loaded? – injecteer Oct 18 '17 at 08:28
  • Maybe related to this? https://stackoverflow.com/questions/24371111/spring-boot-spring-loaded-intellij-gradle – saw303 Oct 18 '17 at 11:06
  • @saw303 for now I ended up starting another gradle daemon with `gradlew -t classes`. It does something really strange, but reloads the controllers somehow – injecteer Oct 19 '17 at 08:39

0 Answers0