首页>代码>Spring使用@Primary处理多个@Autowire申明的相同bean>/handling-multiple-autowire-candidates-spring-primary-example/src/main/java/com/memorynotfound/spring/core/autowired/RunWithAnnotationConfigApplicationContext.java
package com.memorynotfound.spring.core.autowired;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class RunWithAnnotationConfigApplicationContext {

    public static void main(String... args) {
        AnnotationConfigApplicationContext annotationConfigApplicationContext = new AnnotationConfigApplicationContext();
        annotationConfigApplicationContext.register(Config.class);
        annotationConfigApplicationContext.refresh();
        Person person = annotationConfigApplicationContext.getBean(Person.class);
        System.out.println(person);
    }
}
最近下载更多
最代码-宋家辉  LV61 2021年11月8日
最近浏览更多
全栈小白  LV33 2023年1月8日
ming_123_9715  LV23 2022年12月11日
daimazui951  LV1 2022年10月8日
19878648897  LV1 2022年6月28日
kingoneyang  LV13 2022年3月18日
暂无贡献等级
ztkqwert  LV1 2022年1月1日
君知否  LV17 2021年11月11日
最代码-宋家辉  LV61 2021年11月2日
liuyu-zui  LV4 2021年8月25日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友