有
插入
class MyService {
String getFrom(){ return 'Service from plugin'}
}
class MyBean {
String getFrom(){ return 'Bean from plugin'}
}
应用程序
class MyAppBean {
String getFrom(){ return 'Bean from App'}
}
package myappwithmyplugin
class MyAppService {
String getFrom(){ return 'Service from App'}
}
资源.groovy
beans = {
myBean(MyAppBean){}
myService(MyAppService){}
}
控制器
class MyController {
def myBean
def myService
def index() {
println myBean.getFrom()
println myService.getFrom()
}
}
为什么结果是:
来自 App 的 Bean
插件服务