Hi Aruna

Thanks for testing it. To be honest I don't remember a CXF JAX-RS frontend ever having a @Singleton annotation, I found
https://issues.apache.org/jira/browse/CXF-2196

but it was marked as Invalid in the end.

At this stage I'd rather consider trying to find some time to get javax.inject.Singleton supported, etc.

Can you clarify please which CXF version did you see @Singleton in ?

CXF 3.1.11 will be likely released quite soon, in a couple of weeks may be

Sergey
On 14/03/17 08:54, Aruna Kalagnanam wrote:
Hi Sergey

It is working, the JAX-RS resource is now treated as singleton. I also see
that @Singleton is no longer available as part of the cxf frontend rs
module.
Will you be releasing the 3.1.11 version soon ?

Thanks for your help,
Aruna.


On Mon, Mar 13, 2017 at 8:43 PM, Sergey Beryozkin <[email protected]>
wrote:

I deployed the related CXF 3.1.11-SNAPSHOT modules, so please try when you
get a chance...

Cheers, Sergey

On 13/03/17 15:11, Sergey Beryozkin wrote:

Hi

We did some work on the master (3.2.0-SNAPSHOT) for overriding the
default lifecycle of Application.getClasses, using the existing
jaxrs.scope servlet parameter, as part of the SSE work, and I pushed
most of those updated to 3.1.11-SNAPSHOT.
However that is not enough in your case, so I just tweaked a code a bit
more, if you have an empty Application with its getProperties() method
returning "jaxrs.scope"="singleton" then the (auto-discovered)
Application.getClasses will be treated as singletons even if they are
not providers but the resource classes.

I could've also added a CXF specific @Singleton annotation but the
Application.getProperties() is less intrusive and is portable (this
property will simply be ignored with other implementations), while we
also plan with Andriy to introduce a proper support for the alternative
injection strategies (so as to cover for ex CDI Singleton, etc)

Cheers, Sergey

On 13/03/17 11:21, Aruna Kalagnanam wrote:

Hi Sergey

Yes, I'm using the cxf http-sci module and no web.xml.

Thanks,
Aruna.

On Mar 13, 2017 16:23, "Sergey Beryozkin" <[email protected]> wrote:

Hi

On 12/03/17 06:37, Aruna Kalagnanam wrote:

Hello

I'm using Apache CXF 3.1.9 with Tomcat 7. I have written a JAX-RS
application with a JAX-RS resource and subclassed Application class. I
realized that the JAX-RS resource is per-request scoped by default. I
would
like to make it application scoped. Using @Singleton doesnt work.

I could override the getSingletons() method of my Application subclass,
but
doing that turns off auto scanning of @Provider classes. Auto
scanning is
important for my application because I'm using a library which has
filters
that have to be included automatically by scanning.

How can I create a singleton JAX-RS resource and still use auto
scanning
of
@Provider capability.


Can you explain please, how is this Application registered, do you use a
cxf-rt-rs-http-sci module which ships ServletContextInitializer ?

Thanks, Sergey


Thanks,
Aruna.








--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/



Reply via email to