title: How does the swagger ui web jar work in spring project?
body: <p>Below is my swagger related configuration in pom.xml.</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;io.springfox&lt;/groupId&gt;
      &lt;artifactId&gt;springfox-swagger2&lt;/artifactId&gt;
      &lt;version&gt;2.5.0&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;io.springfox&lt;/groupId&gt;
      &lt;artifactId&gt;springfox-swagger-ui&lt;/artifactId&gt;
      &lt;version&gt;2.5.0&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>Below is the web config.</p>
  
  <pre><code>@Configuration
  @EnableWebMvc
  @ComponentScan(basePackages = {"com.xxxxx"})
  @Import(value = {SwaggerConfig.class})
  public class WebConfig extends WebMvcConfigurerAdapter {
      @Override
      public void addResourceHandlers(final ResourceHandlerRegistry registry) {
           // swagger ui configuration
           registry.addResourceHandler("swagger-ui.html")
                   .addResourceLocations("classpath:/META-INF/resources/");
           registry.addResourceHandler("/webjars/**")
                   .addResourceLocations("classpath:/META-INF/resources/webjars/");
      }
  
  }
  </code></pre>
  
  <p>I can not understand the below two methods.</p>
  
  <pre><code> registry.addResourceHandler("swagger-ui.html")
                   .addResourceLocations("classpath:/META-INF/resources/");
           registry.addResourceHandler("/webjars/**")
                   .addResourceLocations("classpath:/META-INF/resources/webjars/");
  </code></pre>
  
  <p>Below is the swagger ui jar in the classpath, I opened it by 7zip.
  <a href="https://i.stack.imgur.com/WgKqq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WgKqq.png" alt="enter image description here"></a></p>
  
  <p>Why the path <strong>classpath:/META-INF/resources/</strong> can direct to files under springfox-swagger-ui-2.5.0.jar? What if there is another jar that contains <strong>/META-INF/resources/</strong> and <strong>/META-INF/resources/webjars</strong>?</p>