Skip to content

Instantly share code, notes, and snippets.

@shibli049
Last active February 6, 2018 10:43
Show Gist options
  • Save shibli049/e2bb91b365c6fe5b113d42dfbb6bf3a3 to your computer and use it in GitHub Desktop.
Save shibli049/e2bb91b365c6fe5b113d42dfbb6bf3a3 to your computer and use it in GitHub Desktop.

Add swagger2 documentation

Dependencies

  1. io.springfox:springfox-swagger2:2.4.0
  2. io.springfox:springfox-swagger-ui:2.4.0

Configuration

    @Bean
    public Docket api(){
        return new Docket(DocumentationType.SWAGGER_2)
            .groupName("Room")
            .select()
            .apis(RequestHandlerSelectors.basePackage("com.shibli049.services.room"))
            .paths(any())
            .build()
            .apiInfo(
                new ApiInfo("Room Services",
                    "A set of services to provide data access to rooms",
                    "1.0.0",
                    null,
                    new Contact("Ahmed Shibli", "https://twitter.com/shibli049", null),
                    null, null));
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment