我在使用Grails中的服務使用依賴注入時遇到問題。Grails依賴注入問題
class ExampleService{
def example2Service
def example3Service
def method1(){
def result = example2Service.method2()
}
}
class ExampleService{
def example3Service
def method2(){
def result = example3Service.method3()
return result
}
}
class Example3Service{
def method3(){
return true
}
}
基本上在Example2Service,我試圖調用方法3在Example3Service時得到一個空指針異常。
我希望得到任何幫助比任何人都可以給我這個問題
感謝
你檢查明顯的事實:即該test3Service名爲Test3Service並適當命名的文件? – hvgotcodes 2010-10-24 22:08:10
是的,它的名字是正確的。如果我從TestService調用它,但是我需要能夠從Test2Service調用方法 – MTH 2010-10-25 04:18:04