spring
文章平均质量分 52
EditDog
这个作者很懒,什么都没留下…
展开
-
自定义参数内容协商策略使浏览器可以请求响应自定义类型数据
1.在配置文件中开启参数请协商(默认是关闭的) 2.在WebMvcConfigurer配置类中自定义内容协商策略 @Override public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { HashMap<String, MediaType> MediaTypeHashMap = new HashMap<>(); MediaTypeHashMap..原创 2022-01-30 20:17:22 · 502 阅读 · 0 评论 -
自定义MessageConverter实现以自定义格式返回相应数据
1.自定义MessageConverter定制相应规则 规则为如果返回数据是person类型则返回数据为其属性值组成的字符串用逗号隔开属性值 public class myMessageConvert implements HttpMessageConverter<Person> { //实现接口的四个方法 @Override public boolean canRead(Class<?> aClass, MediaType mediaType) { ...原创 2022-01-30 19:34:58 · 705 阅读 · 0 评论 -
spring文件读取操作
1.FileSystemResource 文件的读取 2.ClassPathResource文件读取 默认在resources目录下找原创 2022-01-29 15:48:09 · 718 阅读 · 0 评论