⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.java

📁 JSP高级程序员网络开发源代码
💻 JAVA
字号:
package com.jspdev.ch20;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;

public class Main {
    public static void main(String[] args) {

        // 直接调用HelloBean
        HelloBean helloBean = new HelloBean();
        System.out.println(helloBean.getHelloWorld());

        // 利用Spring调用HelloBean
        Resource res = new ClassPathResource("com/jspdev/ch20/bean.xml");
        BeanFactory factory = new XmlBeanFactory(res);

        helloBean = (HelloBean) factory.getBean("helloBean");
        System.out.println(helloBean.getHelloWorld());
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -