cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: Any non-obvious reason to declare JAX-RS service beans as prototypes?
Date Thu, 14 Oct 2010 16:50:43 GMT
Hi

On Thu, Oct 14, 2010 at 5:32 PM, KARR, DAVID (ATTSI) <dk068x@att.com> wrote:

> I'm getting back to using CXF again.  I looked at the previous
> application I implemented with it, and I noticed that I defined my
> service bean with prototype scope.  This seemed odd, as there didn't
> appear to be anything in the controller that obviously required that.
> Is there something non-obvious that makes service beans work (or work
> better) with prototype scope?
>

personally I prefer singletons but sometimes users like dealing with
prototypes because it makes it easier for them
to deal with synchronization issues.

By the way, it is likely the prototype scope was ignored by CXF. Probably
starting from 2.2.9 prototypes are properly
supported in that lifecycle methods such as init and destroy will also be
called (at the moment only if @PostCreate and @PreDestroy annotations are
used), please see :

http://cxf.apache.org/docs/jax-rs.html#JAX-RS-Resourcelifecycles

and

http://cxf.apache.org/docs/jax-rs.html#JAX-RS-Lifecyclemanagement

cheers, Sergey

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message