Hi Francesco

Thanks for the feedback,

On 21/04/14 08:30, Francesco Chicchiriccò wrote:
Hi all,
as reported by [1], with 3.0.0-milestone2 it is possible to enable
JAX-RS services auto-discovery by setting:

<jaxrs:server address="/customers" basePackages="a.b.c"/>

First question: are packages in 'basePackages' to be considered subtree
roots or leaf nodes? I.e. can classes to be auto-discovered be placed,
say, in a.b.c.d?

It all depends on Spring PathMatchingResourcePatternResolver, I wonder does it support Ant style patterns ?

Another option is to list multiple packages:

basePackages="a.b.c, a.b.c.d, a.b.c.e"

This specific option can be limiting but I guess in most cases root resources for a given endpoint can be found in the close 'proximity' to each other

Moreover, I've been playing a bit with such feature, but found that only
concrete classes (not interfaces) annotated with @Path are actually
recognized: is this correct?

Does this mean that there is no way to let the auto-discovery mechanism
deal with a situation where an annotated service interface is defined -
for shared usage with client code - and a concrete non-annotated class
implementing that interface are provided?

Say, for example:

@Path("/")
@Produces(MediaType.APPLICATION_ATOM_XML)
public interface Core {
...
}

then, in a different package:

public class CoreImpl implements Core {
...
}

I guess the auto-discovery does not really work well with such cases, even if we have the interface and implementation classes located in the same package, Spring would probably need to load many classes to assert the hierarchy.

However I'm looking at the CXF source - I guess we might be able to support a simple case where an implementation class implements the @Path annotated interface

We will investigate
Cheers, Sergey



TIA
Regards.

[1]
https://cxf.apache.org/docs/jaxrs-services-configuration.html#JAXRSServicesConfiguration-Auto-discoveryofrootresourcesandproviders



Reply via email to