org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver

问题描述 投票:0回答:1

org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver - 已解决 [org.springframework.web.servlet.resource.NoResourceFoundException:没有静态资源 swagger-ui。] 升级到 Spring Boot 版本到 3.2.x 时遇到问题

added the dependencies as part of swagger 3

<dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
            <version>2.6.0</version>
        </dependency>
        
        <!-- https://mvnrepository.com/artifact/org.webjars/swagger-ui -->
<dependency>
    <groupId>org.webjars</groupId>
    <artifactId>swagger-ui</artifactId>
    <version>5.10.3</version>
</dependency>
java spring-boot swagger
1个回答
0
投票
@Configuration
public class WebConfig implements WebMvcConfigurer {
   @Override
   public void addResourceHandlers(ResourceHandlerRegistry registry) {
      registry.addResourceHandler("/webjars/**")
            .addResourceLocations("classpath:/META- 
 INF/resources/webjars/");
   }
}
© www.soinside.com 2019 - 2024. All rights reserved.