原创 interface注入及報錯分析

一個小case上面錯誤原因我想大家開發中都遇到過,大致錯誤原因是注入bean時,spring找到2個實例userServiceImplTest、userServiceImpl,無法確認到底使用哪個。問題出在這,原因是什麼呢,在說明前,看下面

原创 淺析ThreadLocal

ThreadLocal是什麼* This class provides thread-local variables. These variables differ from * their normal counterparts in

原创 轉發與重定向

平常開發中時常用到重定向,正好藉此總結一下,上面的圖在開發中以及參考網上文章總結出來的(參考文章見文末)。重定向@RequestMapping(value = "/redirect",method = RequestMethod.GET)

原创 JWT

上圖文字來自https://jwt.io/introduction/ 現項目中的JWT來解析如下: 左邊是生成的token,左邊是其三部分的解析。 項目中的使用,public class JWTSignerUtil { privat

原创 BeanDefinitionRegistryPostProcessor

最近在看spring集成mybatis的代碼,發現MapperScannerConfigurer實現了BeanDefinitionRegistryPostProcessor接口: 很好奇BeanDefinitionRegistryPostP

原创 bean懶加載

Indicates whether or not this bean is to be lazily initialized. If false, it will be instantiated on startup by bean fac

原创 參數校驗

最近開發中遇到一個問題,需要對請求的參數進行校驗,包括身份證號、手機號、是否是數字、是否是整型數字、年齡、性別的校驗,由於Controller層接受參數類型是JSONObject,所以需要考慮使用其他方法解決這個問題,前提排除解析後再通過條

原创 Dubbo服務搭建

之前公司一直用的RPC分佈式框架是新浪的motan,由於在測試環境服務很不穩定,最近已經開始換Dubbo,而且自從阿里宣佈開始從新維護Dubbo後,一直更新不斷,最近 Dubbo Spring Boot Starter也已發佈,期待DUBB

原创 spring、mybatis整合源碼簡單分析

配置<bean id="localDataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">

原创 springboot、redis整合

redis安裝下載: sudo wget http://download.redis.io/releases/redis-3.2.6.tar.gz解壓 sudo tar -zxvf redis-3.2.6.tar.gz安裝gcc sudo