I can't really help because I have a spring configuration xml for SOAP services not REST.

In case you can draw any parallels or just rule out this path of debugging here how it looks like:

        <bean id="beaService" class="com.biovista.ws.impl.BEAService">
        </bean>

        <simple:server id="bea" address="/BEAService"
serviceClass="com.biovista.lib.ws.iface.BEAService" serviceBean="#beaService">
                <simple:dataBinding>
<bean class="org.apache.cxf.aegis.databinding.AegisDatabinding" />
                </simple:dataBinding>
        </simple:server>

The serviceClass is the interface and the serviceBean is the implementing class. The name of both are the same but they live in different packages impl vs iface.

Hope that may help somehow...

    Vassilis


On 2016-08-18 17:18, J. Fiala wrote:
Hi,

I defined the implementing class in the spring configuration (as
spring always require to define the implementing class - changing to
the interface will result in
"org.springframework.beans.BeanInstantiationException - Specified
class is an interface"):

<bean id="myController" class="at.hello.HelloWorldServiceImpl" />

and then defined in the jaxrs:server:

<jaxrs:server id="restServer" address="/myserver">
        <jaxrs:serviceBeans>
            <ref bean="myController" />
        </jaxrs:serviceBeans>
        <jaxrs:providers>
            <ref bean="jsonProvider" />

...

Best regards,

Johannes


Am 18.08.2016 um 16:07 schrieb Vassilis Virvilis:
Hi,

jumping in and trying a lucky shot...

Is your packaging information correct? Maybe you have specified the impl class and not the interface on the config file...

    Vassilis


On 08/18/2016 05:01 PM, J. Fiala wrote:
That's exactly what I would like to do - if I remove the annotations
from the implementing class methods, they vanish from the WADL.

Best regards,
Johannes


Am 18.08.2016 um 15:54 schrieb Sergey Beryozkin:
It's invalid per the JAX-RS spec - see its annotation inheritance
section, you can not have JAX-RS annotations spread over the interface
and impl, just keep them all on the interface

Cheers, Sergey
On 18/08/16 14:18, J. Fiala wrote:
Sure:

Interface (generated using wadl2java):

@Path("/helloWorld")
public interface HelloWorldResource {

    @GET
    @Produces("application/json")
    @Path("/find")
    String sayHello(@QueryParam("name") String name);

}

// @Path is read from the interface correctly
public class HelloWorldServiceImpl implements HelloWorldResource {

// if e.g. @GET is removed, the method will no longer appear in the
generated WADL
// so the annotations at the interface method are effectively ignored

    @GET
    @Consumes({ "application/json" })
    @Produces("application/json")
    @Path("/find")
@Description(value = "Say hello service", target = DocTarget.METHOD)
       String sayHello(@QueryParam("name") String name) {

    return "hello " + name;

}

}

I can also assemble a small example project if you need it.

Best regards,
Johannes

Am 18.08.2016 um 13:21 schrieb Sergey Beryozkin:
Can you prototype here an interface and an impl class please

thanks, Sergey
On 18/08/16 12:11, J. Fiala wrote:
Hi,

No, that has nothing to do with Swagger, I'm only working with the
generated WADL here.

The @Path-annotation on the implementing class can be removed, here
picking up from the interface works correctly.

However, if I remove @GET/@Path/@Consumes/@Produces from the method in
the implementing class, it will vanish from the generated WADL.
the spring configuration (as spring always require to define the implementing class - changing to the interface will result in "org.springframework.beans.BeanInstantiationExcept So basically all the annotations at the method level in the interface
are ignored (I'm using CXF 3.1.6).

Verified using Spring CXF Boot + using Jboss EAP 6.

Best regards,

Johannes


Am 18.08.2016 um 00:32 schrieb Sergey Beryozkin:
Hmm is it somehow related to that Swagger related issue ? The
interface annotation inheritance works just fine in CXF as far as I
know, as far as enabling JAX-RS endpoints is concerned

Note we've seen users reporting Swagger2feature can not handle it but a user has just confirmed that it worked fine in the end - we have another pending issue with Swagger not handling multi-bundle case
well, but that is another story

Sergey
On 17/08/16 18:23, J. Fiala wrote:
Currently annotations in the interface are not parsed by CXF (e.g. @Path, @GET, @Produces, @Consumes etc.), it will only read from the
implementing API class.

This is especially annoying if wadl2java is used to generate the API
interfaces automatically.
To make it work, one has to manually add the JAXRS-annotations to
each
implementing class.

It would be nice if CXF would read the annotations in the
interface in
the future as well.

Best regards,
Johannes













Reply via email to