- @Component 建立類對象,相當于配置
<bean/>
-
@Service 與@Component 功能相同
2.1 寫在 ServiceImpl 類上
-
@Repository 與@Component 功能相同
3.1 寫在資料通路層類上
- @Controller 與@Component 功能相同
- 1 寫在控制器類上
-
@Resource(不需要寫對象的 get/set)
5.1 java 中的注解
5.2 預設按照 byName 注入,如果沒有名稱對象,按照 byType 注入
5.2.1 建議把對象名稱和 spring 容器中對象名相同
- @Autowired(不需要寫對象的 get/set)
- 1 spring 的注解
- 2 預設按照 byType 注入
- @Value() 擷取 properties 檔案中内容
- @Pointcut() 定義切點
- @Aspect() 定義切面類
- @Before() 前置通知
- @After 後置通知
- @AfterReturning 後置通知,必須切點正确執行
- @AfterThrowing 異常通知
- @Arround 環繞通知