Closed surajchhetry closed 5 years ago
Hi, thanks for your interest!
Yes, dependency scanning is enabled only on application classes by design to optimize startup times. As you already found out, one solution is to copy JAX-RS providers over to application module. Another one is implementing JAX-RS DynamicFeature
in application module and registering all providers through that.
However KumuluzEE 3.1.0 will support additional scanning options. The feature is already implemented in 3.1.0-SNAPSHOT so you can already check it out (#123). This feature was implemented exactly to support the issue you have - separating application logic in different modules. You would need to add the following configuration to your application module config.yml:
kumuluzee:
dev:
scan-libraries:
- common
As for the CORS Filter, there should be no need to implement com.kumuluz.ee.common.Extension class. If above mentioned dependency scanning does not fix your issue I suggest opening another issue at the CORS extension and provide some more details.
Hope this helps!
Hi, Thank you for your replay . I have decided to go with 3.1.0-SNAPSHOT for now and it solve the issue . Waiting for final version . It only support Yml file why not support .properties files as other modules does.
That's great to hear!
It only support Yml file why not support .properties files as other modules does.
What do you mean by that? KumuluzEE supports .properties files.
I mean can we configure using properties file instead of yams file .
Yes, use config.properties instead of config.yml and something like this:
kumuluzee.dev.scan-libraries[0]=common
Okay thanks
Thank you for developing this feature! Unfortunatelly, scan-libraries is not working for me. I am using the latest version 3.1.0. I've created an example on https://github.com/pphtml/cdi-problem-sample. When I run org.superbiz.ServerLauncher, I do get:
2019-02-01 18:08:06.612 WARNING -- org.eclipse.jetty.server.handler.ContextHandler$Context -- unavailable org.jboss.weld.exceptions.IllegalArgumentException: WELD-001408: Unsatisfied dependencies for type SampleService with qualifiers @Default at injection point [BackedAnnotatedField] @Inject com.kumuluz.ee.samples.jaxrs.CustomerResource.sampleService at com.kumuluz.ee.samples.jaxrs.CustomerResource.sampleService(CustomerResource.java:0) at org.jboss.weld.manager.InjectionTargetFactoryImpl.createInjectionTarget(InjectionTargetFactoryImpl.java:83) at org.jboss.weld.manager.InjectionTargetFactoryImpl.createInjectionTarget(InjectionTargetFactoryImpl.java:70) at org.jboss.weld.manager.InjectionTargetFactoryImpl.createInjectionTarget(InjectionTargetFactoryImpl.java:51)
Originally, I was using JDK11, but I had the same behavior with JDK8.
Hi!
I haven't actually ran your project, but at first glance, it seems that you are missing beans.xml file in the model
module. Can you try that?
Thanks Urbim! That was the cause of the problem. Now the CDI is working for me! I've added the missing beans.xml to the module.
That's great to hear! Btw, for CDI beans you don't really need the scan-libraries feature. This feature is meant for JAX-RS Providers and other things that need annotation scanning.
Hi, I have multi modules project as below parent ....+common ......+customers .......+orders
common module contains common JAX-RS configuration like Exception mapping and CORS Filter and customers module uses common module . If I use other server like Payara it will work fine and able to discover JAX-RS configuration but If I switch to KumuluzEE ( 3. 0 ) it is not able to discover those configuration . So in order to solve this I have to copy all the configuration on customers modules then it is working .
I have also checked Kumuluz-cors module I found that I have to implement com.kumuluz.ee.common.Extension
But I don't want any dependency on Kumuluz rather depending standard API. Please suggest how to fix this issue ?