Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
grails コンソールでサービスを取得するにはどうすればよいですか? 私のビジネス・ルールはサービスに実装されていますが、grails コンソールではそれらにアクセスできません。誰かが私を助ける方法を知っていますか?
SpringApplicationContextはctxコンソールの変数として使用でき、これを使用してサービスなどの Spring Bean にアクセスできます。通常はそうdef myService = ctx.getBean('myService')ですが、Grails はメタクラス ヘルパーを追加するので、次のことができます。def myService = ctx.myService
ApplicationContext
ctx
def myService = ctx.getBean('myService')
def myService = ctx.myService