當前位置:
首頁 >
前端技术
> javascript
>内容正文
javascript
Core java class in Spring
生活随笔
收集整理的這篇文章主要介紹了
Core java class in Spring
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
做nGOM練習時,
Spring version:
通過web發送過來的get和post請求,通過注入的AdvertisementRepository serve.
這個ads是一個interface,在我們的project里只需定義一個空的interface:
我之前做的時候就很好奇,runtime時候,Spring總得幫我注入一個具體的實現class嘛,這個class類型到底是什么?
類型是這個JdkDynamicAopProxy:
練習里使用的bean container是AnnotationConfigWebApplicationContext,這種容器支持在Java code里手動注冊bean:
在這里,AdvertisementResource bean被register:
這個Resource class里通過@Inject注入了AdvertisementRepository:
這個@Inject在call stack InjectionMetadata.inject里被解析并執行注入:
在這里生成interface的實現class - 創建proxy
總結
以上是生活随笔為你收集整理的Core java class in Spring的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 硬核中国科幻大片!《流浪地球2》宣布第三
- 下一篇: Java multithread 多线程