MethodInvokingFactoryBean的用法
来源:互联网 发布:pagerank算法的应用 编辑:程序博客网 时间:2024/06/02 06:36
<?xmlversion="1.0"encoding="UTF-8"?>
<beansxmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<beanid="teacher"class=
"org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<propertyname="staticMethod">
<value>com.teacher.Teacher.setStudentDao</value>
</property>
<propertyname="arguments">
<list>
<refbean="studentDao"/>
</list>
</property>
</bean>
<beanid="studentDao"class="com.teacher.StudentDao">
</bean>
</beans>
package com.teacher;
public class Teacher {
private static StudentDao studentDao;
public static String setStudentDao(StudentDao stuDao) {
Teacher.studentDao = stuDao;
return "hello world";
}
}
package com.teacher;
public class StudentDao {}
package com.teacher;
import org.springframework.test.
AbstractDependencyInjectionSpringContextTests;
public class Test
extends AbstractDependencyInjectionSpringContextTests{
@Override
protected String[] getConfigLocations() {
return new String[]{"applicationContext.xml"};
}
public void test(){
Object o=getApplicationContext().getBeanFactory()
.getBean("teacher");
System.out.println(o);
}
}
MethodInvokingFactoryBean 调用指定的方法 并且得到返回值作为bean对象,如果是void方法,则返回null;
- MethodInvokingFactoryBean的用法
- spring开发 MethodInvokingFactoryBean的学习
- spring开发 MethodInvokingFactoryBean的学习
- spring开发 MethodInvokingFactoryBean的学习
- spring MethodInvokingFactoryBean 的使用和了解,Spring 通过通过方法创建Bean的实例
- spring --MethodInvokingFactoryBean 配置文件解析
- MethodInvokingFactoryBean使用配置
- 高级依赖配置 - MethodInvokingFactoryBean
- Spring中的MethodInvokingFactoryBean使用
- spring学习----MethodInvokingFactoryBean(二)
- Spring 开发之MethodInvokingFactoryBean学习
- Spring MethodInvokingFactoryBean注入Method值
- Spring实战之org.springframework.beans.factory.config.MethodInvokingFactoryBean
- Spring实战之org.springframework.beans.factory.config.MethodInvokingFactoryBean
- ?的用法
- ?的用法
- ---" ~ " 的用法---
- ---" ~ " 的用法---
- cocos2d-x 动作 Spawn(CCSpawn)
- 传智播客-JAVA学科-14年1月份Spring MVC公开课
- 不会,找人教你就好?
- 常用的HTML标签和属性
- 程序员必知的8大排序(java实现)
- MethodInvokingFactoryBean的用法
- 360Email邮件营销:春节EDM发送注意事项
- DLL Injection and WoW64
- Python 3中套接字编程中遇到TypeError: 'str' does not support the buffer interface的解决办法
- 数据结构-双链表
- 移动应用界面设计模式 - 搜索、排序、筛选
- 基于Linux的Samba开源共享解决方案测试(三)
- EGit的安裝和配置
- android底部菜单选项卡TabWidget用法