Skip to content
Snippets Groups Projects
Commit ba4eb276 authored by Jan Tymel's avatar Jan Tymel
Browse files

Add swagger configuration so that its web UI is working

parent 8557247b
No related branches found
No related tags found
No related merge requests found
package com.example.demo.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2).select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build();
}
}
......@@ -26,10 +26,10 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(value = "/adaptive-training-definitions", produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/", produces = MediaType.APPLICATION_JSON_VALUE)
@CrossOrigin(origins = "*", allowCredentials = "true", allowedHeaders = "*",
methods = {RequestMethod.GET, RequestMethod.POST, RequestMethod.DELETE, RequestMethod.PUT})
@Api(value = "/adaptive-training-definitions",
@Api(value = "/",
tags = "Adaptive training definitions",
consumes = MediaType.APPLICATION_JSON_VALUE,
authorizations = @Authorization(value = "bearerAuth"))
......
......@@ -4,5 +4,7 @@
#spring.datasource.password=password
#spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
server.servlet.context-path=/adaptive-training-definitions
spring.h2.console.enabled=true
spring.h2.console.path=/h2-console
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment