Olencha
Olencha

Reputation: 418

Override Plugin Impl

There are

plugin

class MyService {
    String getFrom(){ return 'Service from plugin'}
}
class MyBean {
    String getFrom(){ return 'Bean from plugin'} 
}

APP

class MyAppBean {
    String getFrom(){ return 'Bean from App'}
}
package myappwithmyplugin
class MyAppService {
    String getFrom(){ return 'Service from App'}
}

resources.groovy

beans = {
    myBean(MyAppBean){}
    myService(MyAppService){}
}

controller

class MyController {
    def myBean
    def myService

    def index() { 
        println myBean.getFrom()
        println myService.getFrom()
    }
}

Why a result is:

Bean from App

Service from plugin

Upvotes: 1

Views: 53

Answers (1)

Alidad
Alidad

Reputation: 5538

As of 2.2, to support namespacing, Grails register the concatenation of the plugin bean name and the beans like services. To override the service introduced by the plugin you need to use the pluginNameServiceName.

source: jira.grails.org/browse/GRAILS-10091

Upvotes: 2

Related Questions