Spring boot and @EnableSwagger2: ClassOrApiAnnotationResourceGrouping deprecated #1307

Closed
niroussel opened this Issue May 11, 2016 · 13 comments

Projects

None yet

5 participants

@niroussel

Hi guys,

I'm using the last release of Springfox (2.4.0) with Spring Boot (1.3.2), and when adding the @EnableSwagger2 tag on a @Configuration class, I get the following warning:

Description Resource    Path    Location    Type
Class 'springfox.documentation.swagger.web.ClassOrApiAnnotationResourceGrouping' is marked deprecated

How can I prevent this from happening? I've tried to follow the instruction given in the reference, but I still get this warning.

Thanks,
Nicolas

@dilipkrish
Member

Where are you seeing this? Are you trying to build from source?

@dilipkrish dilipkrish added the question label May 16, 2016
@dilipkrish dilipkrish added this to the 2.5.0 milestone May 16, 2016
@niroussel

I'm just using the @EnableSwagger2 in a "Hello World" Spring Boot Project.

I can see that this annotation imports "ResourceGroupingStrategy", which imports "SpringfoxWebMvcConfiguration". This one has @EnablePluginRegistries (.... ResourceGroupingStrategy).

The interface ResourceGroupingStrategy is deprecated and has 2 implementations:

  • SpringGroupingStrategy
  • ClassOrApiAnnotationResourceGrouping (deprecated)

Why is "ClassOrApiAnnotationResourceGrouping " used? Should I add a "SpringGroupingStrategy" bean?

@dilipkrish dilipkrish closed this Jun 2, 2016
@Fabrice-Deshayes-aka-Xtream

Hello.
Just switch from 2.4.0 to 2.5.0 hoping this problem was solved but this warning is still present. Should i rise a new defect ?
regards.

@dilipkrish
Member

@Fabrice-Deshayes-aka-Xtream no. We won't be removing deprecated APIs until the next major release

@Fabrice-Deshayes-aka-Xtream

i'm sorry @dilipkrish but i'm not sure to well understand. i'm not using this deprecated api intentionally and only want to remove this warning from my IDE. As pointed by last @niroussel comment, is it @EnablerSwagger2 annotation which used this deprecated api ? (so swagger-fox annotation use swagger-fox deprecated api?)

@dilipkrish
Member

@Fabrice-Deshayes-aka-Xtream the deprecated warning shouldn't show up in your IDE unless of course you're building springfox from source. Not sure why the warning is showing up for you. My guess is that its an IDE setting that you can turn off.

@Fabrice-Deshayes-aka-Xtream

@dilipkrish, i confirm that i'm not building from springfox source, only add maven dependency to use springfox to generate my swagger json file and provide swagger-ui in my spring-boot application. This warning was not here when i start my project last september. i will look in my Eclipse to see if i can find something (or maybe related to eclipse spring plugin that i've installed recently, which probably look deeper in the code...). Thanks for your answer. Regards.

@niroussel

@Fabrice-Deshayes-aka-Xtream, I'm not building from springfox source either. I'm using Spring Tool Suite.

@Fabrice-Deshayes-aka-Xtream

@niroussel and @dilipkrish, i'm using eclipse with Spring IDE plugin (so it's similar to Spring Tool Suite IDE). The type of the problem in problem view is "Spring Beans Problem" which is only visible when you have spring IDE features.

If i comment @EnableSwagger2 annotation, the problem disappear.

Is it a real potential problem shown by Spring IDE feature which does a more deeper code inspection than standard Eclipse IDE or is it a false positive... that is the question. For sure, it works, even with this warning.

@elcodedocle

Probably a false positive, but I am also picking up this warning after installing Spring IDE Eclipse component. I am using springfox latest release at the moment, maven dependencies as follows:


        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.5.0</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.5.0</version>
        </dependency>
@dilipkrish
Member

It is true that its a deprecated class but at the same time, the IDE should only pick up deprecations in the app itself. Not the dependent libraries. Its an IDE specific issue and should most likely be ignored.

@jonbuck16

@dilipkrish Whilst I appreciate that these warnings can be ignored I and probably others like to have clean workspaces and these warnings are just whitenoise in amongst genuine warnings or errors...

This is not really a Springfox issue so for information for anyone else finding this issue you can remove these warnings by disabling the Spring Beans Validator - Bean Deprecation Rule. To do this in eclipse open the Preferences page and navigate to the Spring -> Validation page, within the Project Validators tab expand the Beans Validator item and then uncheck the Beans Deprecation Rule checkbox. Once you click on OK you will need to force a re-build of your project as this change will not cause the project to recompile automatically. Once the project has been built the warnings will dissapear from the problems view.

@dilipkrish
Member

@jonbuck16 thanks for the update for those of us who are Eclipse challenged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment