做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