首页>代码>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()); } }


微信网友_7442146341474304
3月27日
暂无贡献等级
Canvcer LV1
2023年3月1日
是阿絮呀
2021年5月8日
暂无贡献等级
sizeking LV8
2021年4月12日
z1433151083 LV9
2021年2月20日
0592lyj LV9
2021年2月2日
pxqtsht LV16
2021年1月20日
TerryGaoBo LV9
2021年1月19日
喵小兵 LV10
2021年1月8日
jgsu_edu LV5
2021年1月6日