增加MediaType转换
This commit is contained in:
parent
391819be11
commit
41eb246b89
|
|
@ -6,6 +6,7 @@ import io.netty.buffer.Unpooled;
|
|||
import org.apache.commons.beanutils.BeanUtilsBean;
|
||||
import org.apache.commons.beanutils.Converter;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.MediaType;
|
||||
|
||||
@Configuration
|
||||
public class CommonConfiguration {
|
||||
|
|
@ -26,6 +27,14 @@ public class CommonConfiguration {
|
|||
return convert(aClass, JSON.toJSONBytes(o));
|
||||
}
|
||||
}, ByteBuf.class);
|
||||
|
||||
BeanUtilsBean.getInstance().getConvertUtils().register(new Converter() {
|
||||
@Override
|
||||
public <T> T convert(Class<T> aClass, Object o) {
|
||||
return (T) MediaType.valueOf(String.valueOf(o));
|
||||
}
|
||||
}, MediaType.class);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue