Grails: Accessing spring beans in the destory closure of Bootstrap code?

后端 未结 3 702
一生所求
一生所求 2020-12-17 01:19

I\'m looking to access a bean in my destroy closure in the Bootstrap.groovy of my grails project. Any ideas on how to achieve this?

I seem to have no access to servl

3条回答
  •  独厮守ぢ
    2020-12-17 02:26

    Hmm, I can't find any examples of anyone even using the destroy block closure in Bootstrap. From the docs:

        It is not guaranteed that {{destroy}} will be called unless the 
    application exits gracefully (for example by using the application 
    server's shutdown command) so don't rely on it too much 
    

    As a guess, I'd have to say that the servletContext has already been destroyed before the {{destroy}} closure of Bootstrap is executed, so that bean you're trying to access is gone already. Can anyone confirm?

提交回复
热议问题