Re: [Jersey] Re: Spring framework support for Jersey 2

  • From: cowwoc <cowwoc@...>
  • To: dev@...
  • Subject: Re: [Jersey] Re: Spring framework support for Jersey 2
  • Date: Thu, 04 Jul 2013 12:34:47 -0400


Not to hijack this conversation, but we're past this point with Guice integration. We have Guice-HK2 integration but this will not work without some changes in the Jersey codebase.

When are we going to get some official responses from the Jersey team on adding this code? I believe the same code will service both Guice and Spring integration.

Gili

On 04/07/2013 11:45 AM, Miroslav Fuksa wrote:
Hi Marko,

sorry for a late answer.

I have checked your updated pull request. Thanks.

It is fine that you have written an email prior to some further development. There is a news, that HK2 should soon support Spring integration which could simplify the development on the Jersey side. There will still be needed some work on Jersey to integrate with Spring but lot of problems could be already solved by HK2. We will have to check the status and investigate some documentation. Based on this, I would suggest that you don't continue with the development now and we will see which functionality HK2 will offer to us. In the meantime you can sign the OCA (Oracle Contributor Agreement). This is needed in order to contribute to Jersey.

See this link: http://www.oracle.com/technetwork/community/oca-486395.html

This is summary of requirements from injection perspective:

1. inject Spring beans into jersey JAX-RS resource classes and providers (filters, interceptors, ...)
    - injection by @Autowire
    - injection by @Inject
2. allow JAX-RS resource classes and providers to be managed by Spring instead of Jersey
3. inject Jersey injections into the Spring managed JAX-RS resource classes and providers (these mentioned in point 2)
- inject by @Inject and @Context (this is needed as resource classes must still be compliant with JAX-RS spec which allows injection of JAX-RS providers be these annotations). This means Spring managed beans will support these injections.
- and of course allow standard Spring injection for these Spring managed beans with @Autowire, definition by xml (applicationContext.xml), @Inject

We will also need to migrate Jersey 1 samples as you have written.

I have some more comments below....

Thanks
Mira

On 06/29/2013 11:47 PM, Marko Asplund wrote:
Hi,

I was finally able to find some time to work with Jersey 2 Spring integration again.

Now, the prototype implementation supports the following features:
- inject Spring beans into Jersey managed JAX-RS resource classes
yes - point 1.
- allow JAX-RS resource classes to be managed by Spring instead of Jersey
yes - point 2.
- support singleton and request scopes for both of the above
yes, the scopes should be supported. This means when you annotate the resource or provider with @RequestScope, @Singleton or @PerLookup, the scoping should work correctly for spring managed resources and providers as it currently works for jersey managed ones. I am now not exactly sure how to managed spring definition of scopes but probably this should be still managed by spring in the spring way but might be overriden by Jersey scope annotations. But I am not sure about this point.

I haven't yet ported the Jersey 1 Spring integration test cases, but I could try to look into this later.

Before starting to work on the test cases, would it be possible for you, or some other person in the Jersey development team, to take a look at the integration prototype? Just to see if it meets the functional requirements and that the design is viable?

The code can be found here:
https://github.com/marko-asplund/jersey/tree/master/ext/jersey-spring/jersey-spring
https://github.com/marko-asplund/jersey/tree/master/examples/helloworld-spring


best regards,

marko




Re: [Jersey] Re: Spring framework support for Jersey 2

Miroslav Fuksa 07/04/2013

Re: [Jersey] Re: Spring framework support for Jersey 2

cowwoc 07/04/2013

Re: [Jersey] Re: Spring framework support for Jersey 2

Marko Asplund 07/06/2013
Terms of Use; Privacy Policy; Copyright ©2013-2014 (revision 20131025.e7cbc9d)
 
 
Close
loading
Please Confirm
Close