You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by António Mota <am...@gmail.com> on 2013/12/12 14:46:45 UTC

Iinject contexts as static properties

Hi guys, here's a quick one. Is it a good practice to inject contexts as
static properties?

    @Context
    public static HttpServletRequest sc;
 Is there any drawback in this?

Cheers.


* Melhores cumprimentos / Beir beannacht / Best regards *
*______________________________________________________*

*António Manuel dos Santos Mota <http://gplus.to/amsmota>*
*http://www.linkedin.com/in/amsmota* <http://www.linkedin.com/in/amsmota>
*______________________________________________________*

Re: Iinject contexts as static properties

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 12/12/13 13:46, António Mota wrote:
> Hi guys, here's a quick one. Is it a good practice to inject contexts as
> static properties?
>
>      @Context
>      public static HttpServletRequest sc;
>   Is there any drawback in this?

This won't be thread safe

Cheers, Sergey
>
> Cheers.
>
>
> * Melhores cumprimentos / Beir beannacht / Best regards *
> *______________________________________________________*
>
> *António Manuel dos Santos Mota <http://gplus.to/amsmota>*
> *http://www.linkedin.com/in/amsmota* <http://www.linkedin.com/in/amsmota>
> *______________________________________________________*
>