@Configuration //表示该类是配置类
@ComponentScan(backPackages={\"com.zong.spring\"}) //表示注解扫描哪个文件
public class SpringConfig{
}
//加载配置文件
ApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig.class);原文:https://www.cnblogs.com/ipython258/p/14887576.html