开发
暂时未有相关通用技术能力~
阿里云技能认证
详细说明2020年03月
原因是因为被 spring-security-web中的CsrfFilter拦截了。
spring-security-web中CsrfFilter是这样防止csrf攻击的的:
post和put请求:check下cookie中有没有csrfToken
如果没有,则设置 csrfToken 如果有,则 和和Header中的 csrfToken对比。不相同返回403。
如果服务没有对外网暴露http接口,则设置 spring.security.csrf.enabled = false 如果服务需要外网暴露http接口,前端代码中 post和put请求的header中设置 csrfToken
bootstrap生成的demo工程,velocity/templates/hsf.vm 里面的form 提交时设置csrf Header,防止后来人踩坑
查看 CsrfFilter是spring-security-web-4.2.3.RELEASE
的内容, 然后运行 mvn dependency:tree
查看是否包含 该pom依赖
security-spring-boot-starter
依赖spring-security-config
依赖spring-security-web
其中1和2的版本不一致,导致没有把CsrfFilter加进来
在父pom中指定security-spring-boot-starter
和spring-security-config
版本号
类的static变量初始化失败了
而且static成员变量第一次初始化失败能断到,后面用到这个类时无法不会再次初始化了,直接报NoClassDefFoundError: Could not initialize class
设置 suspend=y,从应用启动时开始断点
slf4j-log4j12 not-exist
-> 不管用org.springframework.boot.logging.logback.LogbackLoggingSystem#configureByResourceUrl
hsf.app.spring
hsf.app.spring
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/WEB-INF/lib/logback-classic-1.2.3.9-struct.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:r.war/WEB-INF/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:twar/WEB-INF/lib/slf4j-nop-1.7.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
不打印日志通常两个原因
log4j 使用
log4j 流程
Logger 对象遍历其中的appender进行打印
slf4j 使用