Using Spring DSL in a Grails Plugin

I'm trying to use the Spring DSL functionality in a Grails plugin. However, it doesn't work. Here's what I have in my plugin's conf/spring/resources.groovy file:

import org.springframework.aop.scope.ScopedProxyFactoryBean

// Place your Spring DSL code here
beans = {
  baseSvcProxy(ScopedProxyFactoryBean) {
    targetBeanName = 'baseService'
    proxyTargetClass = true
  }
}

However, it seems to be completely ignored. If I move the exact same code to the application's conf/spring/resources.groovy file everything works perfectly. Is there something that needs to be done differently for plugins for this to work?

Answers


In order to modify the spring context from a Grails plugin you need to use the doWithSpring section of your plugin by hooking into the runtime configuration. Resources.groovy is ignored in plugins.


Need Your Help

How can I use Material Design Lite with webpack?

javascript reactjs webpack material-design-lite

I've been playing around with ReactJs and I'm needing to call componentHandler.upgradeDom() in each componentDidMount() handler.

SqlEntityConnection can't find edmgen.exe when compiling on mac osx with mono

entity-framework f# mono type-providers

I have a very simple code that uses the SqlEntityConnection type provider.