> -----Original Message----- > From: Sergey Beryozkin [mailto:[email protected]] > Sent: Friday, October 15, 2010 2:38 PM > To: [email protected] > Subject: Re: Annotation to self-register service bean? > > Hi > > Again, I'm not using interfaces. For illustration, here is an excerpt > > of my context, along with a bit of the controller class (with some > > information elided). > > > > ----------- > > <jaxrs:server name="MyDataServer" address="/rest"> > > <jaxrs:providers> > > <ref bean="jacksonJsonProvider"/> > > </jaxrs:providers> > > <jaxrs:serviceBeans> > > <ref bean="serviceCallResultsController"/> > > </jaxrs:serviceBeans> > > </jaxrs:server> > > > > <bean id="serviceCallResultsController" > > class="...ServiceCallResultsController"/> > > ----------- > > ----------- > > @Controller > > @Path("/...") > > @Produces({"application/xml", "application/json"}) > > public class ServiceCallResultsController { > > ---------- > > > > > > I have to admit I'm still not getting what problem you're facing. > You've been referring to the user model and provided the fragment from > the > related documentation > but apparently you're not using it at all (well, I do not see it being > referenced in the fragment you posted) ?
As far as I know, I've never referred to the "user model", you've been referring to that, and I wasn't sure what you were talking about. I've defined exactly what I've shown here. > > I would never expect that I could just remove the "serviceBeans" > element > > and the explicit bean definition for "serviceCallResultsController" > and > > result in the ServiceCallResultsController class being > "autoregistered" > > as a service bean. That would mean that any @Controller-annotated > class > > would be auto-registered, which would be bad if I had controllers > which > > weren't intended to be service beans. > > > > To be honest this is one of the reasons why I've been reluctant so > far to > spend time on any scan-supporting approach. > > Either way, as I've said, it is possible to drop it provided a user > model > refers to a concrete class but it is not the case here. > > > > What WOULD make some sense is if there were a new annotation, with > some > > name like "@JAXRSServerRegistration", whose "value" would have to > > correspond to the "name" attribute of the "jaxrs:server" element. > > > > Just so it's clear, I can see that this can't be done with the > existing > > code base, although I think the implementation of a BeanPostProcessor > to > > make this happen seems straightforward. > > > > Do you see any value in this approach? > > > > I'm wondering, would you really like CXF to support the auto- > discovery of > providers and root resource classes (those annotated with @Provider and > class level @Paths) ? > What I do not quite understand is why you'd like to drop > jaxrs:serviceBeans > while not using interfaces and what value this new annotation will > give. Is > it to do with using @Controllers ? I guess I'm saying that if you could > provide a clear description of what you're trying to do then it would > help I'm defined the jaxrs-server. I'm defining the controller that processes requests. I'm also defining a couple of providers, one for jackson-jaxb mapping, and one for exceptions. That's what I need to work. I started this discussion to see if I could get away with not defining the controller bean and referencing it in the service beans list.
