JavaJaxRS.bootstrap.mustache Maven / Gradle / Ivy
package {{apiPackage}};
import io.swagger.jaxrs.config.SwaggerContextService;
import io.swagger.models.*;
import io.swagger.models.auth.*;
import {{javaxPackage}}.servlet.http.HttpServlet;
import {{javaxPackage}}.servlet.ServletContext;
import {{javaxPackage}}.servlet.ServletConfig;
import {{javaxPackage}}.servlet.ServletException;
public class Bootstrap extends HttpServlet {
@Override
public void init(ServletConfig config) throws ServletException {
Info info = new Info()
.title("{{title}}")
.description("{{{appDescription}}}")
.termsOfService("{{termsOfService}}")
.contact(new Contact()
.email("{{infoEmail}}"))
.license(new License()
.name("{{licenseInfo}}")
.url("{{licenseUrl}}"));
ServletContext context = config.getServletContext();
Swagger swagger = new Swagger().info(info);
new SwaggerContextService().withServletConfig(config).updateSwagger(swagger);
}
}