J'utilise Springfox Swagger. Voilà ce que je vois quand j'accéder http://localhost:8088/myContextRoot/swagger-ui.html:Swagger UI au printemps: seul le fichier HTML est chargé, mais pas les ressources
à savoir seul le fichier HTML swagger-ui.html
est chargé avec succès, d'autres choses (js, css, etc.), qui devait être à http://localhost:8088/myContextRoot/webjars/springfox-swagger-ui retours 404.
Ce que j'ai essayé jusqu'à présent:
web.xml
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/swagger-ui.html</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/webjars/**</url-pattern>
</servlet-mapping>
ressources servlet.xml
<mvc:resources mapping="swagger-ui.html" location="classpath:/META-INF/resources/" />
<mvc:resources mapping="/webjars/**" location="classpath:/META-INF/resources/webjars/" />
Java config
@Configuration
@EnableWebSecurity
@EnableWebMvcSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/v2/api-docs", "/configuration/ui/**", "/swagger-resources", "/configuration/security/**",
"/webjars/**", "/swagger-ui.html")
.permitAll();
}
}
Versions utilisées:
compile "io.springfox:springfox-swagger2:2.6.1"
compile "io.springfox:springfox-swagger-ui:2.6.1"