2021年12月12日

SpringBoot - 自定义内容协商(HttpMessageConverter)

摘要: 内容协商:根据客户端接收能力不同,返回不同媒体类型的数据。 使返回的数据支持已xml方式返回 <dependency> <groupId>com.fasterxml.jackson.dataformat</groupId> <artifactId>jackson-dataformat-xml</ar 阅读全文

posted @ 2021-12-12 23:09 每天积极向上 阅读(337) 评论(0) 推荐(0) 编辑

SpringBoot - Converter(转换器)

摘要: 自定义转换器 @Configuration(proxyBeanMethods=false) public class AppConfig { @Bean public WebMvcConfigurer getWebMvcConfigurer() { return new WebMvcConfigur 阅读全文

posted @ 2021-12-12 21:42 每天积极向上 阅读(766) 评论(0) 推荐(0) 编辑

SpringMvc - @ModelAttribute注解

摘要: 在SpringMVC的Controller中使用@ModelAttribute时,其位置包括下面三种: 应用在方法上,应用在方法的参数上,应用在方法上并且方法也使用了@RequestMapping 被@ModelAttribute注解的方法会在Controller每个方法执行之前都执行,因此对于一个 阅读全文

posted @ 2021-12-12 15:29 每天积极向上 阅读(82) 评论(0) 推荐(0) 编辑

SpringMvc - @SessionAttributes注解

摘要: @SessionAttributes 默认情况下Spring MVC将模型中的数据存储到request域中。当一个请求结束后,数据就失效了。如果要跨页面使用。那么需要使用到session。而@SessionAttributes注解就可以使得模型中的数据存储一份到session域中。 有三个参数: 1 阅读全文

posted @ 2021-12-12 15:08 每天积极向上 阅读(44) 评论(0) 推荐(0) 编辑

导航