久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術文章
文章詳情頁

Spring如何使用xml創建bean對象

瀏覽:138日期:2023-08-22 16:07:14

一、導入JAR包

Spring如何使用xml創建bean對象

二、配置applicationContext.xml的spring核心配置

Spring如何使用xml創建bean對象

三、

public static void main(String[] args) { //1.使用 ApplicationContext 接口,就是在獲取 spring 容器 ApplicationContext ac = new ClassPathXmlApplicationContext('bean.xml'); //2.根據 bean 的 id 獲取對象 IAccountService aService = (IAccountService) ac.getBean('accountService'); System.out.println(aService); IAccountDao aDao = (IAccountDao) ac.getBean('accountDao'); System.out.println(aDao); }

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持好吧啦網。

標簽: Spring
相關文章:
主站蜘蛛池模板: 柯坪县| 章丘市| 贵定县| 确山县| 晋江市| 滦平县| 衡阳市| 三穗县| 民丰县| 武鸣县| 志丹县| 江安县| 泸水县| 兖州市| 阳泉市| 榆树市| 黔南| 丰县| 大竹县| 云龙县| 栾川县| 靖安县| 边坝县| 弥渡县| 桓仁| 金平| 滦平县| 镇远县| 台中县| 祥云县| 寿光市| 澄江县| 金昌市| 铁力市| 贡觉县| 景洪市| 克山县| 揭西县| 阿克陶县| 五大连池市| 依安县|