@Transactional で注釈が付けられた任意のサービスを 1.3.7 の任意のコントローラーに Grails インジェクションすることについて、私は奇妙な質問に巻き込まれました。
SyncSpInfoService:</p>
package test
import org.springframework.transaction.annotation.*
class SyncSpInfoService {
static transactional = false
@Transactional
def syncSpInfoData(def dataSource)throws RuntimeException{
...
}
コントローラ:
package test
class SyncSpInfoController {
def syncSpInfoService
def dataSource
def index = {
try{
syncSpInfoService.syncSpInfoData(dataSource)
render "Success"
return
}catch(RuntimeException e){
e.printStackTrace()
render "Error:"+e.getMessage()
return
}
}
}
コントローラーを実行し、SyncSpInfoService でエラーが発生した場合は、変更して再度実行すると、次のようなエラーが発生します: エラー:test.SyncSpInfoService を test.SyncSpInfoService にキャストできません。
なぜだろう?Plsは私を助けてくれます、thxたくさん...