devX
devX

Reputation: 33

Adding common project as a dependency to quarkus projects and expose its classes as a CDI bean

I have a simple maven project

 <dependency>
       <groupId>xyz</groupId>
       <artifactId>common</artifactId>
 </dependency>

which includes common methods(some string operations etc..). And i would like to use it inside of quarkus project by injecting its classes as CDI bean.Could i add this maven project as a dependency to my quarkus project via traditional way in pom.xml or should i convert it to quarkus extension? I have searched for it but there is no good enough documentation as well.

Thanks in advance.

Upvotes: 2

Views: 1403

Answers (1)

Jan Martiška
Jan Martiška

Reputation: 1314

If the dependency contains a META-INF/beans.xml file, it is automatically scanned for CDI beans. If not, you can explicitly mark it to be scanned by adding this to your main application's application.properties:

quarkus.index-dependency.MYDEPENDENCY.group-id=xyz
quarkus.index-dependency.MYDEPENDENCY.artifact-id=common

Upvotes: 4

Related Questions