外卖项目day02-员工分页查询_代码完善-统一时间处理
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
package com.sky.config;
|
||||
|
||||
import com.sky.interceptor.JwtTokenAdminInterceptor;
|
||||
import com.sky.json.JacksonObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
|
||||
@@ -15,6 +18,8 @@ import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 配置类,注册web层相关组件
|
||||
*/
|
||||
@@ -25,6 +30,17 @@ public class WebMvcConfiguration extends WebMvcConfigurationSupport {
|
||||
@Autowired
|
||||
private JwtTokenAdminInterceptor jwtTokenAdminInterceptor;
|
||||
|
||||
|
||||
@Override
|
||||
protected void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
|
||||
log.info("扩展消息转换器.....【日期】");
|
||||
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
|
||||
//需要为消息转换器设置一个对象转换器,将java对象转为json时的处理
|
||||
converter.setObjectMapper(new JacksonObjectMapper());
|
||||
//将自己的消息转换器,加入到spring的转换器中
|
||||
converters.add(0,converter);//0:表示转换器使用的优先级
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册自定义拦截器
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user