spring學習十九 常用註解
阿新 • • 發佈:2018-10-06
com 數據訪問 auto 建議 round back 沒有 con 內容
6.1 spring 的註解
6.2 默認按照 byType 註入.
7. @Value() 獲取 properties 文件中內容
8. @Pointcut() 定義切點
9. @Aspect() 定義切面類
10. @Before() 前置通知
11. @After 後置通知
12. @AfterReturning 後置通知,必須切點正確執行
13. @AfterThrowing 異常通知
14. @Arround 環繞通知
1. @Component 創建類對象,相當於配置<bean/>
2. @Service 與@Component 功能相同.
2.1 寫在 ServiceImpl 類上.
3. @Repository 與@Component 功能相同.
3.1 寫在數據訪問層類上.
4. @Controller 與@Component 功能相同.
4.1 寫在控制器類上.
5. @Resource(不需要寫對象的 get/set)
5.1 java 中的註解
5.2 默認按照 byName 註入,如果沒有名稱對象,按照 byType 註入, 建議把對象名稱和 spring 容器中對象名相同
6. @Autowired(不需要寫對象的 get/set)
6.1 spring 的註解
6.2 默認按照 byType 註入.
7. @Value() 獲取 properties 文件中內容
8. @Pointcut() 定義切點
9. @Aspect() 定義切面類
10. @Before() 前置通知
11. @After 後置通知
12. @AfterReturning 後置通知,必須切點正確執行
13. @AfterThrowing 異常通知
14. @Arround 環繞通知
spring學習十九 常用註解