首页>代码>Spring通过@Required注解实现在容器启动时对bean进行依赖校验>/spring-@required-annotation-example/src/main/java/com/memorynotfound/spring/core/required/Main.java
package com.memorynotfound.spring.core.required;

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");
        StarWars starWars = (StarWars)context.getBean("luke");
        System.out.println(starWars);

        starWars = (StarWars)context.getBean("c3po");
        System.out.println(starWars);
    }
}
最近下载更多
最近浏览更多
fuyouou  LV5 2023年7月6日
and123456  LV11 2022年3月16日
最代码-宋家辉  LV61 2021年11月11日
xiao菜  LV2 2021年6月2日
3399509525  LV5 2021年4月14日
liuqingfang  LV2 2021年4月2日
水光浮藻  LV6 2021年3月25日
gfdgjkfodijigidfj  LV1 2021年2月10日
a1525723924  LV3 2021年2月7日
hhhhllll12 2021年2月7日
暂无贡献等级
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友