Search code examples
micronaut

How do I implement an async @PostConstruct method in Micronaut?


How can I implement an async post-construct method in micronaut? Ie I want to be able to return a Completable or similar from the method and Micronaut should not consider the bean to be initialized until it has completed.

In eg vert.x u get a "callback handle" to signal completeness to, but I have not found anything similar in Micronaut.

BR / Jonas


Solution

  • Returning a reactive type or a completion stage from a post construct method is not supported. Micronaut cannot continue processing until the method returns so I don't see much value in doing so.