![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
spring 源码
文章平均质量分 66
yang7678287
无
展开
-
spring加载bean
spring中加载bean是通过DefaultListableBeanFactory,我们可以通过配置文件,DefaultListableBeanFactory回去根据配置去读取配置加载xml文件,然后可以直接去通过注解获取对应的实例,我们想要获取对应的bean实例,也可以通过:@Test @SuppressWarnings("unchecked") public void testCla原创 2016-10-29 10:06:02 · 225 阅读 · 0 评论 -
stringutils功能
1.转化文件目录中的“//”为“/”StringUtils.cleanPath("E:\\java文档\\test.txt")2.判断String类型的数据是否为null,""," ",如果是,返回false,否则返回trueStringUtils源码:public static boolean hasText(String str) { return hasText((Cha原创 2016-10-30 10:34:26 · 1841 阅读 · 0 评论 -
property文件的操作
1.读取property文件:public static void main(String[] args) throws IOException { // 第一中方法 Properties pro = PropertiesLoaderUtils .loadAllProperties("property/test.properties"); System.out.printl原创 2016-10-31 09:04:01 · 519 阅读 · 0 评论 -
通过反射获取java类的实例
package com.test.springmvc.test;import org.springframework.beans.BeanUtils;import org.springframework.util.ClassUtils;public class MainTest { public static void main(String[] args) throws Excep原创 2016-10-31 09:20:57 · 456 阅读 · 0 评论 -
spring BeanFactoryAWare应用
实现aware接口的bean被spring实例化后可以获取相应的资源,实现BeanFactoryAWare接口可以获取BeanFactory的实例,示例:实现BeanFactoryAWare接口package com.test.springmvc.test;import org.springframework.beans.BeansException;import org.spr原创 2016-11-01 22:17:45 · 622 阅读 · 0 评论 -
spring BeanPostProcessor InitializingBean相关
public static void main(String[] args) throws Exception { ApplicationContext ac = new ClassPathXmlApplicationContext( "applicationContext.xml"); TestAware test = (TestAware) ac.getBean("testAw转载 2016-11-02 10:27:31 · 642 阅读 · 0 评论 -
spring加载资源
spring中通过Resource去获取对应的资源,Resource继承了InputStreamSource,查看InputStreamSource源码发现只有一个InputStream getInputStream(),而Resource增加了 /** * Determine whether this resource actually exists in physical form.原创 2016-10-29 11:16:00 · 324 阅读 · 0 评论