首页>代码>spring通过p-namespace的方式实现xml配置bean的属性实例>/spring-p-namespace-xml-configuration-shortcut/src/main/java/com/memorynotfound/spring/Run.java
package com.memorynotfound.spring;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Run {

    public static void main(String... args){
        ApplicationContext context = new ClassPathXmlApplicationContext(new String[]{"app-config.xml"});

        // get bean with property
        CoffeeMachine coffeeMachine = context.getBean("coffeeMachine", CoffeeMachine.class);
        System.out.println(coffeeMachine);

        // get bean with p-namespace
        CoffeeMachine pCoffeeMachine = context.getBean("pCoffeeMachine", CoffeeMachine.class);
        System.out.println(pCoffeeMachine);

    }
}
最近下载更多
最近浏览更多
szf123  LV12 2023年5月30日
马克思 2022年12月5日
暂无贡献等级
sleary  LV3 2021年5月4日
sink122406  LV12 2021年3月20日
939867966  LV1 2021年2月25日
5564331  LV1 2021年1月22日
qazwsxedcrfvtgb1  LV2 2021年1月17日
stellafull  LV2 2021年1月17日
欠踹de背影  LV25 2021年1月13日
是数据库  LV3 2021年1月13日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友