I am writing a framework on top of it where other teams develop applications.
I want to provide Dependency Injection as part of it. I am making developers uses JSR 330 annotations and my framework can work on DI.
Still i have the following problem
Developer need to write module if i use Guice, beans.xml if I use WELD. This couples specific DI with my developer app code. I want to switch underlying dependency injection in framework without touching any of the application code.
Is there anyway to do it?
If you strictly stick to JSR330 features, it is possible to provide a framework jar that can be used by all three implementing DI-frameworks you mentioned. To allow CDI to scan the module, you should provide a bean.xml, but I wouldn't call that code invasive.
If you need to provide something more than just JSR330, like modules, factories, producer-methods, AutoConfigurations, ... you could offer custom extension modules, so you have "myframework-core" for the implemantation agnostic stuff and "myframework-guice" on top of it providing helpers and modules for guice and so on.