提交 efaadcc6 编写于 作者: 武汉红喜's avatar 武汉红喜

BeanFactoryTest

上级 9cdf9ff5
package com.itlong.whatsmars.spring.aop;
/**
* Created by shenhongxi on 16/7/2.
*/
public class Aspect1 {
//@Pointcut()
public void route() {}
}
package com.itlong.whatsmars.spring.aop;
import org.aspectj.lang.annotation.Aspect;
/**
* Created by shenhongxi on 16/7/13.
*/
@Aspect
public class RouterAspect {
}
package com.itlong.whatsmars.spring.bean;
import com.itlong.whatsmars.spring.Mars;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;
/**
* Created by shenhongxi on 16/8/23.
*/
public class BeanFactoryTest {
public static void main(String[] args) {
ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
Resource res = resolver.getResource("classpath:spring-test.xml");
BeanFactory bf = new XmlBeanFactory(res);
System.out.println("init BeanFactory");
Mars mars = bf.getBean("mars", Mars.class);
System.out.println(mars.getCnName() + ":" + mars.getAge());
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册