wkennedy / swagger4spring-web

Swagger support for Spring MVC
89 stars 46 forks source link

Not finding any API controllers #34

Closed andrewrutter closed 10 years ago

andrewrutter commented 10 years ago

Firstly, thanks for putting this together!

I am running into a problem where no controllers at all are being discovered. Using 0.3.0, I just get an empty json response when I hit /api/resourceList. If I switch to 0.2.0, I get the following: {"api_version":"v1","swagger_version":"1.1","base_path":"http://localhost:7001/test-server"}

But, I do not see any API endpoints being identified. I have configured as per the docs, specifically:

pom.xml Added the dependency as well as some exclusions to avoid guava and jackson conflicts

        <dependency>
            <groupId>com.knappsack</groupId>
            <artifactId>swagger4spring-web</artifactId>
            <version>0.2.0</version>
            <exclusions>
                <exclusion>
                   <groupId>com.fasterxml.jackson.core</groupId>
                   <artifactId>jackson-databind</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.google.guava</groupId>
                    <artifactId>guava</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

application-context.xml

    <bean id="documentationController" class="com.knappsack.swagger4springweb.controller.ApiDocumentationController">
        <property name="apiVersion" value="v1" />
        <property name="baseControllerPackage" value="com.testapp.rest.controller" />
        <property name="baseModelPackage" value="com.testapp.core.model" />
    </bean>

spring-mvc.xml To test using 0.3.0 I did add the following:

    <mvc:annotation-driven>
        <mvc:message-converters>
            <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
                <property name="objectMapper">
                    <bean class="com.knappsack.swagger4springweb.util.ScalaObjectMapper"/>
                </property>
            </bean>
        </mvc:message-converters>
    </mvc:annotation-driven>

I have tried with and without annotating a controller using @ApiOperation and @Api but I always end up with an empty set of api endpoints.

Can you please me know if there is something missing in my configuration and/or if there are some known issues with either of these versions that would cause this.

Thanks, Andrew

seawatts commented 10 years ago

I just opened a ticket about this as well. See Issue #33

andrewrutter commented 10 years ago

Closing this as a duplicate