| PortletBeanFactoryPostProcessor.java |
1 /**
2 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License as published by the Free
6 * Software Foundation; either version 2.1 of the License, or (at your option)
7 * any later version.
8 *
9 * This library is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 * details.
13 */
14
15 package com.liferay.portal.spring.context;
16
17 import com.liferay.portal.kernel.portlet.PortletClassLoaderUtil;
18 import com.liferay.portal.kernel.util.AggregateClassLoader;
19 import com.liferay.portal.kernel.util.PortalClassLoaderUtil;
20 import com.liferay.portal.spring.util.FilterClassLoader;
21
22 import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
23 import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
24
25 /**
26 * <a href="PortletBeanFactoryPostProcessor.java.html"><b><i>View Source</i></b>
27 * </a>
28 *
29 * @author Brian Wing Shun Chan
30 */
31 public class PortletBeanFactoryPostProcessor
32 implements BeanFactoryPostProcessor {
33
34 public void postProcessBeanFactory(
35 ConfigurableListableBeanFactory beanFactory) {
36
37 ClassLoader beanClassLoader =
38 AggregateClassLoader.getAggregateClassLoader(
39 new ClassLoader[] {
40 PortletClassLoaderUtil.getClassLoader(),
41 PortalClassLoaderUtil.getClassLoader()
42 });
43
44 beanClassLoader = new FilterClassLoader(beanClassLoader);
45
46 beanFactory.setBeanClassLoader(beanClassLoader);
47 }
48
49 }