I looked at the code, if you rely on @ComponentScan discovering all
Spring components (annotated with @Component or implicit) then it is not
possible at the moment to enforce the package restrictions.
@ComponentScan itself can be parameterized with a list of packages but I
could not figure out how to get that configuration done dynamically. So
we'd need to eventually replace @ComponentScan with the direct use of
the Spring component scanner. It's impossible to figure out the package
names of the beans returned by @ComponentScan without instantiating them
- but that will break Spring scope restrictions...
But if you remove @Component from the resources then the list of
packages will be enforced, CXF Spring scan utility will discover the
Classes and thus the packages can be enforced
Sergey
On 12/01/17 18:31, Sergey Beryozkin wrote:
Hi Dennis,
Are you annotating these resources as @Component/@Service ?
Cheers, Sergey
On 05/01/17 09:50, Dennis Kieselhorst wrote:
Hi,
I have an application that exposes some JAX-RS resources and uses some
JAX-RS clients to access backend systems. The application is
configured with
component-scan=true and classes-scan-packages with a list of packages
of the
application. However after the component scan CXF ignores the given
packages
and tries to expose all classes from the application context as resources
(also the ones from client since they are part of the application context
and annotated with @Path).
Doesn't it make sense to restrict the component scan to the given
packages
in AbstractSpringComponentScanServer? Or is there another way to avoid
this?
Cheers
Dennis
--
View this message in context:
http://cxf.547215.n5.nabble.com/Limit-JAX-RS-Spring-component-scan-to-certain-packages-tp5776205.html
Sent from the cxf-user mailing list archive at Nabble.com.
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/