spring-mvc的疑惑(持续更新)

1.@SessionAttribute注解

以下是官方文档的解释:

If you need access to pre-existing session attributes that are managed globally, i.e. outside the controller (e.g. by a filter), and may or may not be present use the @SessionAttribute annotation on a method parameter:

关键在于and may or may not be present翻译过来是:可能存在也可能不存在
而在实际使用时若session无法获取到该属性是会报400错误的:

Missing session attribute ‘user’ of type User

2.@RequestBody

关于该注解还是由于自己底层知识不够造成的,昨天在编写代码的过程中发现会报一个Stream close的错误,想尝试Debug发现根本没进入自己写的方法,然后就是各种百度,依旧没找到答案……
没办法有bug也得解决啊,既然没进入方法肯定是spring mvc赋值时的问题呗,然后一个一个删参数,发现当参数中有两个@RequestBody时会发生这个错误,后来一想也是一次请求怎么可能会有两个请求体呢?
后来的解决方法是利用map结束值,然后再手动赋值给对象