首页 > 其他分享 >Spring Boot 之 ModelFactory

Spring Boot 之 ModelFactory

时间:2023-12-19 10:31:52浏览次数:19  
标签:sessionAttributesHandler container name Spring ModelFactory request value initMo


1.initModel

        功能:

public void initModel(NativeWebRequest request, ModelAndViewContainer container, HandlerMethod handlerMethod)
			throws Exception {

		Map<String, ?> sessionAttributes = this.sessionAttributesHandler.retrieveAttributes(request);
		container.mergeAttributes(sessionAttributes);
		invokeModelAttributeMethods(request, container);

		for (String name : findSessionAttributeArguments(handlerMethod)) {
			if (!container.containsAttribute(name)) {
				Object value = this.sessionAttributesHandler.retrieveAttribute(request, name);
				if (value == null) {
					throw new HttpSessionRequiredException("Expected session attribute '" + name + "'", name);
				}
				container.addAttribute(name, value);
			}
		}
	}

2.updateModel

标签:sessionAttributesHandler,container,name,Spring,ModelFactory,request,value,initMo
From: https://blog.51cto.com/u_15668812/8884739

相关文章

  • 记一次工作中使用spring jpa遇见的坑。
    报错:RRORoro.hiberate.enoineidcsvisalexceptionhelnerConnectionisread-only,Cueriesleadingtodatamodificationarenotallowedorg.springframework.orm.jpa.JpaSystemException:couldnotexecutestatement;nestedexceptionisorg.hibernate.exception.Gen......
  • 第一章:SpringMVC的概述及简介
    一、springMVC课程介绍二、springMVC导学、回顾三、springMVC的简介和特点......
  • 第二章:SpringMVC的配置文件(web.xml)及访问页面
    一、开发环境二、创建maven工程三、默认方式配置web.xml四、扩展方式配置web.xml五、创建控制器六、配置springMVC配置文件七、访问首页八、访问指定页面九、总结......
  • springboot015粮食仓库管理系统(毕业设计,附数据库和源码)
    一.4开发的技术介绍一.4.1Springboot介绍一.4.2Java语言一.4.3MySQL数据库一.5论文的结构二需求分析二.1需求设计二.2可行性分析二.2.1技术可行性二.2.2经济可行性二.2.3操作可行性二.3功能需求分析表2-1粮食仓库管理系统功能结构图三系统设计三.1数据库概念结构......
  • springboot012响应式企业员工绩效考评系统(vue,毕业设计,附源码和数据库)
    2 关键技术2.1SpringBoot框架2.2 Maven环境2.3Mysql数据库2.4Vue.js框架2.5小结4 系统分析与设计4.1系统架构在对一个系统的开发中,必须全面的考虑用户对学校系统的需求,这个步骤需要开发出系统的功能的用途,每个图应代表系统的一个功能模块。系统架构图:4.2系统功能设......
  • springboot045新闻推荐系统-计算机毕业设计源码+LW文档
    摘要随着信息互联网购物的飞速发展,国内放开了自媒体的政策,一般企业都开始开发属于自己内容分发平台的网站。本文介绍了新闻推荐系统的开发全过程。通过分析企业对于新闻推荐系统的需求,创建了一个计算机管理新闻推荐系统的方案。文章介绍了新闻推荐系统的系统分析部分,包括可行性分......
  • springboot011流浪动物救助网站(vue)
    4需求分析4.1需求调研在教学网站中,能够在网站上运行的流浪动物救助站系统较少,所有很有必要开发一个轻量级的可以在网站上运行的流浪动物救助网站系统。4.2功能模块需求分析本网站最大的特点就功能全面,且结构简单用户在圈子信息框中,用户可以发布信息系统管理员:4.3设计的基本思想4.......
  • 总结篇:SpringBoot常用注解总结
    使用springboot开发的优点,就是不用部署war文件因为内部嵌入了tomcat的,允许通过maven来根据需要的starter,非常的方便,可以自动配置spring,为程序员减少大量时间用于写业务逻辑,更不用担心使用某个依赖的版本问题,springboot全部为你自己选择。springboot的常用注解:1、@SpringBootAppl......
  • Spring中关于@Autowired注解和@Value注解的处理
    Spring是在实例化之后、初始化之前调用BeanPostProcessor处理的。/////////////////////////////////////////////////////////////////////////////AbstractApplicationContext>>>>refresh()///////////////////////////////////////////////////////////////////////////......
  • SpringSession+SpringSecurity中如何保存Authentication到Session中的Attribute
     org.springframework.security.web.context.SecurityContextPersistenceFilter#doFilter(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,javax.servlet.FilterChain) org.springframework.security.web.context.HttpSessionSecurityC......