/java/

JEE and Swagger UI

2017-09-21 20:34:02

Full example

https://github.com/szalek/JEE-Swagger

Configuration

 

/src/main/java/pl/btbw/core/MyApplication.java

package pl.btbw.core;

import io.swagger.jaxrs.config.BeanConfig;

import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;

@ApplicationPath("/rest")
public class MyApplication extends Application {

    public MyApplication() {
        BeanConfig beanConfig = new BeanConfig();
        beanConfig.setVersion("1.0.0");
        beanConfig.setSchemes(new String[]{"http"});
        beanConfig.setHost("localhost:8080");
        beanConfig.setBasePath("/jee-swagger/rest");
        beanConfig.setResourcePackage("pl.btbw.modules");
        beanConfig.setScan(true);
    }

}

/pom.xml


<dependency>
<groupid>io.swagger</groupid>
<artifactid>swagger-jaxrs</artifactid>
<version>1.5.0</version>
</dependency>