1、
bean
文件配置成对应的
.xml
<inport />对应的xml配置文件
调用就直接用@resource 对应的bean 就可用
2、bean文件配置成对应的.xml
<inport />对应的xml配置文件
@Autowired (装载)
private ApplicationContext applicationContext;
AuthMenu authMenu=(AuthMenu) applicationContext.getBean("authMenu");
3、
直接用 FileSystemXmlApplicationContext 去解析xml转化成对应的bean
ApplicationContext factory=new FileSystemXmlApplicationContext("/src/main/resources/spring/spring-config-auth.xml");
AuthMenu authMenu=(AuthMenu) factory.getBean("authMenu");