@Configuration //表示该类是配置类
@ComponentScan(backPackages={"com.zong.spring"}) //表示注解扫描哪个文件
public class SpringConfig{
}

//加载配置文件

ApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig.class);

Zong
7 声望0 粉丝