换成swagger-2
This commit is contained in:
14
pom.xml
14
pom.xml
@ -163,12 +163,6 @@
|
|||||||
<version>0.11.5</version>
|
<version>0.11.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Spring Security -->
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
|
||||||
<!-- <artifactId>spring-boot-starter-security</artifactId>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
|
|
||||||
<!-- Redis -->
|
<!-- Redis -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
@ -181,6 +175,7 @@
|
|||||||
<version>2.11.1</version> <!-- 可根据需要选择版本 -->
|
<version>2.11.1</version> <!-- 可根据需要选择版本 -->
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- swagger2 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.springfox</groupId>
|
<groupId>io.springfox</groupId>
|
||||||
<artifactId>springfox-swagger2</artifactId>
|
<artifactId>springfox-swagger2</artifactId>
|
||||||
@ -248,13 +243,6 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<source>${java.version}</source>
|
<source>${java.version}</source>
|
||||||
<target>${java.version}</target>
|
<target>${java.version}</target>
|
||||||
<annotationProcessorPaths>
|
|
||||||
<path>
|
|
||||||
<groupId>org.mapstruct</groupId>
|
|
||||||
<artifactId>mapstruct-processor</artifactId>
|
|
||||||
<version>1.5.5.Final</version>
|
|
||||||
</path>
|
|
||||||
</annotationProcessorPaths>
|
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
|||||||
@ -1,44 +0,0 @@
|
|||||||
package com.sczx.store.config;
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.http.converter.HttpMessageConverter;
|
|
||||||
import org.springframework.http.converter.StringHttpMessageConverter;
|
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
|
||||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
|
||||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
//@Configuration
|
|
||||||
//@EnableWebMvc
|
|
||||||
public class WebConfig implements WebMvcConfigurer {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
|
||||||
registry.addResourceHandler("/swagger-ui/**")
|
|
||||||
.addResourceLocations("classpath:/META-INF/resources/webjars/swagger-ui/4.15.5/");
|
|
||||||
registry.addResourceHandler("/swagger-ui.html")
|
|
||||||
.addResourceLocations("classpath:/META-INF/resources/swagger-ui.html");
|
|
||||||
registry.addResourceHandler("/v3/api-docs/**")
|
|
||||||
.addResourceLocations("classpath:/META-INF/resources/swagger-ui/");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
|
||||||
|
|
||||||
converters.add(new StringHttpMessageConverter(StandardCharsets.UTF_8));
|
|
||||||
// 添加支持 application/json;charset=UTF-8 的 Jackson 转换器
|
|
||||||
converters.add(new MappingJackson2HttpMessageConverter() {
|
|
||||||
@Override
|
|
||||||
public List<MediaType> getSupportedMediaTypes() {
|
|
||||||
return Collections.singletonList(MediaType.APPLICATION_JSON_UTF8);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user