Migrating spring 4 from spring 3

今天把Spring從3.2.9升級到了4.3.4,SpringSecurity從3.2.5升級到了4.2.0,下面是升級過程遇到的一些問題:

Spring4 刪除了MetadataUtils類,MetadataUtils類中的attributesFor方法移動到了AnnotationConfigUtils中

AuthenticationException 刪除了 getAuthentication、setAuthentication 方法,不用即可

LoginUrlAuthenticationEntryPoint 類刪除了空構造方法,所以member-authorization-security.xml配置中需要將 p:loginFormUrl="/facade/signin” 改成 <constructor-arg value="/facade/signin" index="0”/> 的形式

UnanimousBased 刪除了空構造方法,所以 member-authorization-security.xml 配置中需要將<property name="decisionVoters”> 改成 constructor-arg 的形式

MappingJacksonHttpMessageConverter 被刪除了,由 MappingJackson2HttpMessageConverter 替代,需要修改所有用到的servlet-context.xml

spring4 會調用 freemarker.template.Configuration 的帶Version參數的構造方法,而freemarker-2.3.20.jar 沒有該方法,所以需要升級freemarker版本到至少2.3.21版本,目前升級到了2.3.23

Spring Security 4 會默認開啓安全響應頭和CSRF,其中CSRF要求POST請求需要額外攜帶一個token參數,因改動太多,所以關閉了該功能 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章