On 28 November 2013 16:54, Sergey Beryozkin <[email protected]> wrote:

>
>>
>> You must be doing something sophisticated; FYI, you can register either
> Application itself or services and providers as simple servlet parameters,
> not sure where is the complexity you are referring to is coming from
>
>
Well, I don't have a term of comparison for complexity, our current app has
38 REST resources with 288 sub-resources in total, and those 38 resources
have 71 beans injected. Hence my worries about having the beans
instantiated and injected in a easy and clean manner.


That seems way too complicated, since I have easier ways to instantiate the
>> services without the use of a Factory:
>>
>> 1- let the Application instantiate the services, they are instantiated
>> per-request and if I want DI I have to do it every time by using some
>> @Context
>>
>> 2- let the JAXRSServerFactoryBean create the endpoints without Application
>> and setting the already autowired services (as Singletons) in it
>>
>> 3- let the JAXRSServerFactoryBean create the endpoints with a Application
>> and use the getSingletons (instead getClasses) to set the already
>> autowired
>> services
>>
>> Am I correct in this? If yes, 1 will be a "pure" independent JAX-RS way to
>> do it, but with the overhead of always have to inject what I need. 2 will
>> be totally CXF dependent and not JAX-RS portable. 2 will be only slightly
>> CXF dependent, in a way that is portable to other JAX-RS containers.
>>
>> So, since I have to use Spring as a DI container anyway, it seems 3 is a
>> good choice for my case scenario.
>>
>>
> I'm just sure what is happening in your case, so if you are happy with 3
> then it is good enough for me :-)
>
>
Well, my problem is not so much about happiness but choosing the best way
to do things, and the best way should be as close as possible to standards.
It is possible that this option looks now the best option but it may happen
that I'm not seeing the complete picture, or that I'm ignorant of other
ways to do the same things... I'm by no means a expert in JAX-RS or CXF or
Jersey (even if I work with REST-based architectures from quite a number of
years now).

On the other hand way, you *are* a expert in CXF, that's why is usefull to
hear what to have to say :)


Thanks again for you support.

Reply via email to