首页>代码>Spring通过配置component-scan base-package实现自动扫码指定路径的类并初始化bean的简单示例>/spring-xml-auto-component-scanning/src/main/java/com/memorynotfound/Main.java
package com.memorynotfound;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Main {

    public static void main(String...args){
    	ApplicationContext context = new ClassPathXmlApplicationContext("app-config.xml");
    	DancerService dancerService = context.getBean(DancerService.class);

    	System.out.println(dancerService.doDance());
    }
}
最近下载更多
最近浏览更多
Canvcer  LV1 2023年3月1日
是阿絮呀 2021年5月8日
暂无贡献等级
sizeking  LV8 2021年4月12日
z1433151083  LV9 2021年2月20日
0592lyj  LV9 2021年2月2日
pxqtsht  LV15 2021年1月20日
TerryGaoBo  LV9 2021年1月19日
喵小兵  LV10 2021年1月8日
jgsu_edu  LV5 2021年1月6日
是数据库  LV3 2021年1月5日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友