知識(shí)分享:Spring底層搭建
流程
1、新建UserService接口 2、新建UserService實(shí)現(xiàn)類 3、通過bean將UserService放入容器 4、通過context的getbean方法拿到UserService對(duì)象
加載基礎(chǔ)包:

學(xué)習(xí)更多知識(shí),請(qǐng)點(diǎn)擊:https://space.bilibili.com/216317641
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?https://space.bilibili.com/701029654
代碼如下:

后刷新Maven.
學(xué)習(xí)更多知識(shí),請(qǐng)點(diǎn)擊:https://space.bilibili.com/216317641
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?https://space.bilibili.com/701029654
配置文件

內(nèi)容:

點(diǎn)右上角提示的“Configure application context”就可以了。?
學(xué)習(xí)更多知識(shí),請(qǐng)點(diǎn)擊:https://space.bilibili.com/216317641
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?https://space.bilibili.com/701029654

編寫代碼
接口類

代碼如下?

新建class文件UserServiceImpl?
學(xué)習(xí)更多知識(shí),請(qǐng)點(diǎn)擊:https://space.bilibili.com/216317641
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?https://space.bilibili.com/701029654

實(shí)現(xiàn)


配置文件

寫mian方法

測(cè)試結(jié)果為

學(xué)習(xí)更多知識(shí),請(qǐng)點(diǎn)擊:https://space.bilibili.com/216317641
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?https://space.bilibili.com/701029654
作者:前程有光
鏈接:https://juejin.cn/post/6944701531497332743
來源:掘金
著作權(quán)歸作者所有。商業(yè)轉(zhuǎn)載請(qǐng)聯(lián)系作者獲得授權(quán),非商業(yè)轉(zhuǎn)載請(qǐng)注明出處。