@Configuration //示意该类是配置类
@ComponentScan(backPackages={"com.zong.spring"}) //示意注解扫描哪个文件
public class SpringConfig{
}
//加载配置文件
ApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig.class);
@Configuration //示意该类是配置类
@ComponentScan(backPackages={"com.zong.spring"}) //示意注解扫描哪个文件
public class SpringConfig{
}
//加载配置文件
ApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig.class);
发表回复