博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Spring 注入 null
阅读量:4049 次
发布时间:2019-05-25

本文共 911 字,大约阅读时间需要 3 分钟。

– Start


package shangbo.spring.core.example26;public class Person {	private String name = "Shangbo";	private int age = 30;	//	// Setter	//	public void setName(String name) {		this.name = name;	}	public void setAge(int age) {		this.age = age;	}	public String toString() {		return "[name=" + name + ", age=" + age + "]";	}}
package shangbo.spring.core.example26;import org.springframework.context.ApplicationContext;import org.springframework.context.support.ClassPathXmlApplicationContext;public class App {	public static void main(String[] args) {		// 实例化 Spring IoC 容器		ApplicationContext context = new ClassPathXmlApplicationContext("example.xml", Person.class);		// 从容器中获得 Person 对象		Person p = context.getBean(Person.class);		// 使用对象		System.out.println(p);	}}

– 声 明:转载请注明出处
– Last Updated on 2017-06-17
– Written by ShangBo on 2017-05-22
– End

你可能感兴趣的文章
Jenkins + Docker + SpringCloud 微服务持续集成(一)
查看>>
Jenkins + Docker + SpringCloud 微服务持续集成 - 单机部署(二)
查看>>
Jenkins + Docker + SpringCloud 微服务持续集成 - 高可用集群部署(三)
查看>>
Golang struct 指针引用用法(声明入门篇)
查看>>
Linux 粘滞位 suid sgid
查看>>
C#控件集DotNetBar安装及破解
查看>>
Winform皮肤控件IrisSkin4.dll使用
查看>>
Winform多线程
查看>>
C# 托管与非托管
查看>>
Node.js中的事件驱动编程详解
查看>>
mongodb 命令
查看>>
MongoDB基本使用
查看>>
mongodb管理与安全认证
查看>>
nodejs内存控制
查看>>
nodejs Stream使用中的陷阱
查看>>
MongoDB 数据文件备份与恢复
查看>>
数据库索引介绍及使用
查看>>
MongoDB数据库插入、更新和删除操作详解
查看>>
MongoDB文档(Document)全局唯一ID的设计思路
查看>>
mongoDB简介
查看>>