Guice , afterPropertiesSet

前端 未结 4 482
不思量自难忘°
不思量自难忘° 2021-01-07 05:19

Someone knows some way that how can I achieve the same functionality in Guice as the \'afterPropertiesSet\' interface in spring ? ( its a post construction hook )

4条回答
  •  失恋的感觉
    2021-01-07 05:45

    I guess using @PostConstruct is the way to go.

    Here is a related blog post : http://macstrac.blogspot.com/2008/10/adding-support-for-postconstruct.html

    And here is an addon library that provides the support : http://code.google.com/p/guiceyfruit/

    Adding lifecycle support via Guiceyfruit is described here : http://code.google.com/p/guiceyfruit/wiki/Lifecycle

提交回复
热议问题