1
votes

I am new in quarkus and have a question regarding dependency injection with quarkus.

I am on a project to migrate an application to quarkus. The old application uses spring and runs on JBoss. My goal is to migrate it to quarkus. For several weeks now, I have faced a problem concerning dependence injections. The old application uses an external xml file for the configuration of these beans (like their scope ...). There is therefore no annotation in the bean classes apart from @Named on each bean. My current problem is that I cannot modify certain dependencies to add annotations (such as @Requestscoped, @ApplicationScoped ...) so that I can inject them into my classes because they are external dependencies. Does quarkus have a way to add annotations to beans without modifying the class where these beans were defined ?

Thanks.

Expected behavior : Being able to inject beans that only have the @Named annotation into my code.

Actual behavior : Beans are not injected because they have no @RequestScoped, @Dependent... annotation

quarkus version : 1.5.1.FINAL

Output of java -version : openjdk version "1.8.0_252" OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_252-b09) OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.252-b09, mixed mode)

Output of mvn --version : Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f) Maven home: C:\MAVEN\apache-maven-3.6.3\bin.. Java version: 1.8.0_252, vendor: AdoptOpenJDK, runtime: C:\Program Files\AdoptOpenJDK\jdk-8.0.252.09-hotspot\jre Default locale: en_IE, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

1

1 Answers

1
votes

There is no config property or so. However, you can write a Quarkus extension that leverages build-time APIs to transform the annotations of your classes, possibly based on the external file configuration.