cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeffrey Crump <>
Subject Swagger2Feature not finding @Api annotations in interfaces
Date Fri, 05 Aug 2016 22:54:07 GMT

I'm trying to use the Swagger2Feature on my CXF application.  I've got
interfaces defined in an "api" module, and the implementation classes in an
"impl" module (different maven modules, different JARs).

My Swagger annotations are on the interface definitions, not on the
implementation classes. The interface definitions don't seem to be getting

When I put some fake annotations on the implementation classes, though,
they are found correctly -- even though I have set the resource package to
my API module.

The interface looks like this:

public interface MyResource {
  public String getSomething(String id);

The implementation class (in a different JAR) looks like this:

public class MyResourceImpl implements MyResource {

The generated swagger.json does not include this method.

However, when I put some fake annotations in the implementation class, e.g.:

public class MyResourceImpl implements MyResource {
  public String getSomething(String id) {

all of the methods implemented in MyResourceImpl show up in the
swagger.json (as "fake" and not "real")

@Autowired MyResource res;

JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean();

Swagger2Feature feature = new Swagger2Feature();

How do I get CXF Swagger2Feature to look at those interfaces and not the
concrete implementation classes?

Also, it doesn't seem to matter what I use as the endpoint address, it's
being ignored (but CXF throws if it's not supplied.  So I'm not quite sure
if I'm doing that part correctly.

Thanks for your help.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message