From cb9a8113636309f38e2569d6617ab44bcb736789 Mon Sep 17 00:00:00 2001 From: Alvaro Gonzalez Date: Tue, 24 Oct 2023 10:11:21 +0300 Subject: [PATCH] Fix swagger UI (#51) * Downgrade springfox-swagger.version for tests. Do not use this * Followed https://github.com/springfox/springfox\#migrating-from-earlier-snapshot * Added Guava back --- pom.xml | 7 ++++++- .../tesk/config/security/ResourceServerConfiguration.java | 2 +- .../java/uk/ac/ebi/tsc/tesk/tes/api/HomeController.java | 4 ++-- src/main/resources/application.properties | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 2e100e2..a3dfc52 100644 --- a/pom.xml +++ b/pom.xml @@ -83,9 +83,14 @@ test - + + + io.springfox + springfox-boot-starter ${springfox-swagger.version} diff --git a/src/main/java/uk/ac/ebi/tsc/tesk/config/security/ResourceServerConfiguration.java b/src/main/java/uk/ac/ebi/tsc/tesk/config/security/ResourceServerConfiguration.java index 1d942c3..1bac6e2 100644 --- a/src/main/java/uk/ac/ebi/tsc/tesk/config/security/ResourceServerConfiguration.java +++ b/src/main/java/uk/ac/ebi/tsc/tesk/config/security/ResourceServerConfiguration.java @@ -40,7 +40,7 @@ public class ResourceServerConfiguration extends ResourceServerConfigurerAdapter private final ErrorAttributes errorAttributes; private final HttpMessageConverters messageConverters; private final AuthorisationProperties authorisationProperties; - private final String[] ALLOWED_URLS = {"/", "/v2/api-docs", "/configuration/ui", "/swagger-resources/**", "/configuration/**", "/swagger-ui.html", "/webjars/**"}; + private final String[] ALLOWED_URLS = {"/", "/v2/api-docs", "/configuration/ui", "/swagger-resources/**", "/configuration/**", "/swagger-ui/**", "/webjars/**"}; private final String baseUrl; public ResourceServerConfiguration(ErrorAttributes errorAttributes, HttpMessageConverters messageConverters, diff --git a/src/main/java/uk/ac/ebi/tsc/tesk/tes/api/HomeController.java b/src/main/java/uk/ac/ebi/tsc/tesk/tes/api/HomeController.java index d9fc01a..29d3632 100644 --- a/src/main/java/uk/ac/ebi/tsc/tesk/tes/api/HomeController.java +++ b/src/main/java/uk/ac/ebi/tsc/tesk/tes/api/HomeController.java @@ -11,6 +11,6 @@ public class HomeController { @RequestMapping(value = "/") public String index() { - return "redirect:swagger-ui.html"; + return "redirect:swagger-ui/index.html"; } -} \ No newline at end of file +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index bc606d0..6e7ec31 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -7,7 +7,7 @@ spring.jackson.deserialization.fail_on_unknown_properties=true #Make Spring throw 404 for unknown paths (but we had to disable mapping to static resources, apart from swagger) #404 will be handled uniformly in CustomErrorHandler advice spring.mvc.throw-exception-if-no-handler-found=true -spring.mvc.static-path-pattern=/swagger-ui.html +#spring.mvc.static-path-pattern=/swagger-ui.html #spring.resources.add-mappings=false spring.mvc.pathmatch.matching-strategy=ant_path_matcher spring.main.allow-bean-definition-overriding=true