Skip to content

Commit

Permalink
Fix Swagger-UI
Browse files Browse the repository at this point in the history
No mapping found for HTTP request with URI [/swagger-ui.html] in DispatcherServlet with name 'dispatcherServlet'
  • Loading branch information
IDragonfire committed May 1, 2017
1 parent ca9716d commit 06d804f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ dependencies {

runtime("mysql:mysql-connector-java:${mysqlConnectorVersion}")

optional("org.springframework.boot:spring-boot-configuration-processor")

compile("org.thymeleaf:thymeleaf:${thymeleafVersion}")
compile("org.thymeleaf:thymeleaf-spring4:${thymeleafVersion}")

Expand Down
7 changes: 7 additions & 0 deletions src/main/java/com/faforever/api/config/MvcConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver;
Expand All @@ -18,6 +19,12 @@ public void addViewControllers(ViewControllerRegistry registry) {
registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}

@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
}

@Bean
public ClassLoaderTemplateResolver templateResolver() {
ClassLoaderTemplateResolver result = new ClassLoaderTemplateResolver();
Expand Down

0 comments on commit 06d804f

Please sign in to comment.