public class BaseApplication extends Object
| 限定符和类型 | 类和说明 |
|---|---|
class |
BaseApplication.ScheduleConfig |
class |
BaseApplication.WebConfigBeans
前端提交日期字符串转到后台为Date类型处理器
注意,此方法必须包含web容器才能使用
|
| 构造器和说明 |
|---|
BaseApplication() |
| 限定符和类型 | 方法和说明 |
|---|---|
org.springframework.boot.autoconfigure.http.HttpMessageConverters |
fastJsonHttpMessageConverters()
返回结果使用 fastjson
|
org.springframework.session.web.http.CookieSerializer |
httpSessionIdResolver(org.springframework.boot.autoconfigure.web.ServerProperties serverProperties)
spring-session 2.x 中 Cookie里面引入了SameSite, 用来防止CSRF攻击,它有三个值:Strict、Lax、None,默认值为Lax, 本方法将默认值改为None
|
org.springframework.data.redis.core.RedisTemplate |
redisTemplate(org.springframework.data.redis.connection.RedisConnectionFactory redisConnectionFactory)
设置 redis 默认 RedisSerializer
|
org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory |
webServerFactory()
解决异常信息:
java.lang.IllegalArgumentException:
Invalid character found in the request target.
|
@Bean public org.springframework.boot.autoconfigure.http.HttpMessageConverters fastJsonHttpMessageConverters()
@Bean public org.springframework.data.redis.core.RedisTemplate redisTemplate(org.springframework.data.redis.connection.RedisConnectionFactory redisConnectionFactory)
redisConnectionFactory - @Bean public org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory webServerFactory()
@Bean public org.springframework.session.web.http.CookieSerializer httpSessionIdResolver(org.springframework.boot.autoconfigure.web.ServerProperties serverProperties)
Copyright © 2021. All rights reserved.