Search code examples
guicemybatisquarkus

How to bootstrap Guice Injector within Quarkus?


for my project I use Mybatis as persistance layer . Considering Quarkus Arc (CDI) may not be quite stable, I'm trying to use Guice as DI tool within quarkus. I'm using MyBatis-Guice. But from quarkus doc, I only see startup event as application initialization and seems custom main-method is not supported as entry point by Quarkus. (https://github.com/quarkusio/quarkus/issues/284 ; https://github.com/quarkusio/quarkus/issues/5291)

Any advice on how to bootstrap Guice Injector within quarkus?


Solution

  • Considering Quarkus Arc (CDI) may not be quite stable

    This statement is totally untrue. ArC is totally stable and at the core of Quarkus. If it wasn't stable, well, Quarkus wouldn't work at all as ArC is used everywhere inside the framework.

    ArC has been specifically designed for Quarkus, build time injection and GraalVM so you should really use that one instead of trying to shoe in another injection framework - which probably won't work very well, and in any case, won't be as optimized as ArC for the Quarkus architecture.

    And if, by any chance, you encounter any bug with ArC, just open a GitHub issue and things will get fixed quickly.