servicefactory.java

来自「开源、门户liferay被portal开发爱好者广泛承认」· Java 代码 · 共 23 行

JAVA
23
字号
package sample.spring;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

public class ServiceFactory {

	private static String[] path = { "classpath:sample/spring/DataSource.xml",
			"classpath:sample/portlet/service/impl/UserService.xml"};
	
	private static ApplicationContext ctx = new FileSystemXmlApplicationContext(path);

	public static synchronized Object getBean(String beanName) {
		try {
			return ctx.getBean(beanName);
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?