Spring程序中,Java Bean一般与Spring是非耦合的,不会依赖于Spring类库。这也是Spring的优点。

实现BeanNameAware接口获取本bean的id属性

BeanNameAware中一个方法setBeanName(String arg0);它会在bean所有参数设置后 init-method之前调用,在bean中声明一个属性接受。

实现BeanFactoryAware可以获取该bean对应的BeanFactory。

demo:

package com.dao.impl;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.BeanNameAware; public class FindBeanName implements BeanNameAware,BeanFactoryAware{
private String beanName;
private BeanFactory beanFactory;
public void setBeanName(String beanName) { this.beanName=beanName;
}
public String getBeanName(){
return beanName;
}
public void setBeanFactory(BeanFactory arg0) throws BeansException {
this.beanFactory=arg0;
}
public BeanFactory getBeanFactory(){
return beanFactory;
} } package com.test; import org.junit.Test;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource; import com.Model.Cat;
import com.dao.impl.FindBeanName; public class TestAware {
@Test
public void GetName(){
XmlBeanFactory factory=new XmlBeanFactory(
new ClassPathResource("com/test/applicationContext.xml"));
FindBeanName dbn=(FindBeanName) factory.getBean("hehe");
System.out.println(dbn.getBeanName());
BeanFactory fa=dbn.getBeanFactory();
Cat cat=(Cat) fa.getBean("cat");
System.out.println(cat.getName());
} }

实现DisposableBean接口执行销毁方法。

被bean中的destory-method属性替代,一般不使用

实现InitializingBean接口执行初始化方法。

被bean的init-method属性替代,一般不使用

BeanFactory对象的几个常用的方法:

boolean containsBean(String):判断指定名称的Bean是否存在

Object getBean(String):返回指定名称的Bean。如果没有,会抛出异常

Object getBean(String,Class):返回指定名称的Bean,并进行类型转换成类对象。两个过程中出错都会异常

boolean isSingleton(String):判断指定名称的Bean是否配置为singleton。没有bean,抛出异常

String[] getAliases(String):获取指定名称bean的所有别名的数组

属性覆盖器

对于一些参数,更实用更简单的方法是使用properties配置,而不是配置在Spring的配置文件中。Spring提供属性替代属性,允许把某些属性配置在properties文件中。

配置PropertyOverrideConfigurer属性覆盖器。

PropertyOverrideConfigure允许把XML配置里的魔偶写参数配置到properties文件中。这些在数据库配置中很常用。配置时需要配置一个PropertyOverrideConfigure对象,指定properties文件的位置,然后把替换的属性用形如${jdbc.url}的字符串替代。

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> <bean id="configproperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<!--<property name="location" value="config.properties"/> 一个properties文件
-->
<property name="locations"> <!-- 多个properties文件 -->
<list>
<value>com/Test/config.properties</value>
<value>config1.properties</value>
</list>
</property>
</bean>
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="properties" ref="configproperties"/>
</bean>
<bean id="cat" class="com.Model.Cat">
<property name="name" value="${C.name}"></property>
<property name="age" value="${C2.age}"></property>
</bean> </beans>

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOUAAADUCAIAAADsjXNJAAAYPklEQVR4nO2da3ATR57A50tqP54/pCrLh6s8NpvjQt1ysLF3rWVxiqoNCVt1uaMuW5BKsEMSXdjsVjB32cABJeOYYAh7meMVLoANuYUTxiYkORST4BJcyuaRLJgQFJ9ctgET8EMysvySLK7mPow00z3dPTMaSaPp8f9XXdSo1d3TQj/39Ej9VwtS9lxpWackSZJ8wWBlY7Ax2Bjs8wWDjZW+YKWv0UKzBadb9AgesbvY3QByQMi2QmfzOvzh2orG4JkzZ4LBSl9jha+xosJXUVHZqKkV8ApavAGrfVYby64N8JV/zPq6e9PW3Zu27t5UPz3YMD3YMNm3J3Ll3f6zG//3k2pfY6OvMehr9PkqKyp9lRWVPp/Px2gm4LXiabfoUaoFvKqm3aLHuvUAj2C+BoPB+vp6armt6/+4+d/PS6P/Q6a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8Xi9HvUhEcbE+gtRQqby6atxmBfed+bkQ/O6cIx9lTpObVQf9jSpgvY0EdNZjnw18/lA22tPhA9Vs1Lba0/EulrPry0ZOPHD82u1Qywx56QMQsrEk/rBLF6UMr/VxAnQ73f07nWy9hXrpmaMNA7zQiLI1B9Aovy56sQ/mPBVfio9GVDzqZ/X8uKryc9fA8se/Xbbr+V0FT+4uu3XgWWPSpLE8tUGsv/dIT7QeV00X3OAF19NcuKZ++X08TP3n3g6k565/8TT6RxJks6vLZGTDf3BcGuwie7rUr7fGjm7KkfVbP5+6/8B0ZZP/LHz7kMAAAAASUVORK5CYII=" alt="" />

Beand的高级特征的更多相关文章

  1. 高级特征工程II

    以下是Coursera上的How to Win a Data Science Competition: Learn from Top Kagglers课程笔记. Statistics and dist ...

  2. Java 类的一些高级特征

    1. 面向对象的特征二:继承性 * 1.为什么要设计继承性? 继承的出现提高了代码的复用性. 继承的出现让类与类之间产生了关系,提供了多态的前提. * 2.通过"class A extend ...

  3. python高级特征:列表生成式;generator, 迭代器。

    Python高级特性 列表生成式:不过一种语法糖 生成器:不过一个方法 迭代器: 列表生成式 Python内置的函数,来创建list. 简单的生成: >>> list(range(1 ...

  4. 高级特征工程I

    Mean encodings 以下是Coursera上的How to Win a Data Science Competition: Learn from Top Kagglers课程笔记. 学习目标 ...

  5. Java 类的高级特征2

    1. static 关键字 static,静态的,可以用来属性.方法.*代码块(或初始化块).*内部类 (1) static修饰属性(类变量):  1.由类创建的所有的对象,都共用这一个属性 2.当其 ...

  6. python_高级特征

    切片 Slice  : 取一个tuple的前三个元素,传统做法如下 : for i in range(3): dataList.append(testTuple[i]) if i == 2: prin ...

  7. python-3高级特征

    1-切片 L = ["qinzb",'fengyong','bingyan'] L[0:3] #截取从索引0开始到索引3结束(不包含索引3) L[:3] #如果索引是从0开始则可省 ...

  8. JavaScript高级特征之面向对象笔记二

    Prototype 1.  当声明一个函数的时候,浏览器会自动为该函数添加一个属性prototype, 2.  该属性的默认值为{} 3.  可以动态的给prototype增加key和value值 4 ...

  9. JavaScript高级特征之面向对象笔记

    Javascript面向对象 函数 * Arguments对象: * Arguments对象是数组对象 * Arguments对象的length属性可以获取参数的个数 * 利用Arguments对象模 ...

随机推荐

  1. Educational Codeforces Round 57 (Rated for Div. 2)

    我好菜啊. A - Find Divisible 好像没什么可说的. #include<cstdio> #include<cstring> #include<algori ...

  2. C# 如何调用启动窗体

    Program.cs中代码如下: using System; using System.Collections.Generic; using System.Windows.Forms; namespa ...

  3. 从零开始的四轴飞行器-开篇flag

    在这里立下flag,我要理解学会四轴飞行器的控制方法.

  4. UVa 11100 旅行2007

    https://vjudge.net/problem/UVA-11100 题意: 给定n个正整数,把它们划分成尽量少的严格递增序列,尽量均分. 思路: 因为必须严格递增,所以先统计每个数字出现的次数, ...

  5. POJ 1018 Communication System(DP)

    http://poj.org/problem?id=1018 题意: 某公司要建立一套通信系统,该通信系统需要n种设备,而每种设备分别可以有m1.m2.m3.....mn个厂家提供生产,而每个厂家生产 ...

  6. 机器学习 MLIA学习笔记(二)之 KNN算法(一)原理入门实例

    KNN=K-Nearest Neighbour 原理:我们取前K个相似的数据(排序过的)中概率最大的种类,作为预测的种类.通常,K不会大于20. 下边是一个简单的实例,具体的含义在注释中: impor ...

  7. Atcoder Yet Another Palindrome Partitioning(状压dp)

    Atcoder Yet Another Palindrome Partitioning 思路: 一个字符串满足条件的情况是奇数字母个数小于等于1,也就是异或起来是1<<j(0<=j& ...

  8. 96D - Police Stations

    96D - Police Stations 思路:bfs,从所有的警察局开始bfs,因为bfs的深度一样,而且题目给的树保证满足条件,所以不用考虑深度. 如果搜索到一个点a,他的下一个点b已经被搜索过 ...

  9. OpenGL入门程序五:三维绘制

    1.现实世界观察一个物体的时候,可能涉及到的三维变化: 1>视图变化------从不同的角度观察. 2>模型变化------移动.旋转物体,计算机中当然还可以对物体进行缩放. 3>投 ...

  10. 递推2--过河卒(Noip2002)

    递推2--过河卒(Noip2002) 一.心得 写出递推公式就OK了,具体编程还是很简单的 二.题目及分析 过河卒(NOIp2002) [问题描述] 棋盘上A点有一个过河卒,需要走到目标B点.卒行走的 ...