Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weld integration #32

Closed
marciodel opened this issue Mar 6, 2017 · 11 comments
Closed

Weld integration #32

marciodel opened this issue Mar 6, 2017 · 11 comments
Assignees
Labels
Milestone

Comments

@marciodel
Copy link

In order to Weld work with Jrestless I needed to change the packages to include META-INF/beans.xml.

Is it possible to include those files in next release?

Thanks!

@bbilger
Copy link
Owner

bbilger commented Mar 6, 2017

Hi @marciodel ,
Can you provide some minimal example, then I'll check.
Isn't it sufficient when the package (jar/zip) you create contains META-INF/beans.xml?

Thanks!

@marciodel
Copy link
Author

marciodel commented Mar 6, 2017

Hi @bbilger,

I have included "org.jboss.weld.se:weld-se-core:2.4.2.SP1" and "org.glassfish.jersey.ext.cdi:jersey-weld2-se:2.25.1" in my project dependencies .

In the request handler I have added Weld initialization.

		Weld weld = new Weld();
		weld.initialize();
		
               config = new JAXRSApplication().register(GatewayFeature.class);

		init(config); 
		start();

Adding META-INF/beans.xml in each .jar made it work. I've dowloaded the project and made the changes to include it.

I'm not a CDI expert, just a regular user. :) But what I've understood is that Weld (I don´t know about other CDI implementation) scans the .jar implementations that contains the META-INF/beans.xml.

Best regards

@bbilger
Copy link
Owner

bbilger commented Mar 6, 2017

Hi @marciodel ,
Thanks!
I am a little busy at the moment but I will try to take a look as soon as possible.

@marciodel
Copy link
Author

marciodel commented Mar 6, 2017

Just a remark. I am deploying to AWS lambda a zip file containing a lib folder with the dependencies inside it.

my.zip:
   com/
      ... 
   lib/
      *.jar

@marciodel
Copy link
Author

marciodel commented Mar 6, 2017

Thanks!

Take your time. I have managed to make my project work with those changes.

Congratulations for this great project!

bbilger added a commit that referenced this issue Mar 8, 2017
@bbilger bbilger added this to the 0.5.0 milestone Mar 8, 2017
@bbilger
Copy link
Owner

bbilger commented Mar 9, 2017

I think I found the issue: the filters injected the request using @Inject which does not seem to work when using CDI/Weld (http://stackoverflow.com/questions/13419887/injection-of-httpservletrequest/13420108#13420108). So I switched to inject it using @context (I used @Inject by mistake).
As far as I can see so far we do not need to have a beans.xml in every module.

(I hope to be finally able to release JRestless 0.5.0 at the end of this week or at the beginning of next week; I will provide an example for CDI afterwards - will leave the bug open until then)

@bbilger bbilger self-assigned this Mar 9, 2017
@bbilger bbilger added the bug label Mar 9, 2017
@bbilger
Copy link
Owner

bbilger commented Mar 12, 2017

Hi @marciodel ,
I just released 0.5.0 including this fix and added a CDI/Weld example: https://github.com/bbilger/jrestless-examples/tree/master/aws/gateway/aws-gateway-cdi

Hope this solves your problem!

@bbilger
Copy link
Owner

bbilger commented Mar 20, 2017

assuming fixed - if not, then please re-open

@bbilger bbilger closed this as completed Mar 20, 2017
@marciodel
Copy link
Author

Hi bbilger, sorry for the delayed answer. I was on vacation. I'll test it and provide a feedback as soon as possible. Thanks!

@marciodel
Copy link
Author

I've tested with the version 0.5.1 and it is working flawlessly.

Thanks!

@bbilger
Copy link
Owner

bbilger commented Apr 26, 2017

Hi @marciodel ,
thanks for the feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants