Java Code Examples for org.springframework.aop.framework.ProxyFactory#setInterfaces()

The following examples show how to use org.springframework.aop.framework.ProxyFactory#setInterfaces() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractCobarClientInternalRouterFactoryBean.java    From cobarclient with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
public void afterPropertiesSet() throws Exception {

    DefaultCobarClientInternalRouter routerToUse = new DefaultCobarClientInternalRouter();

    List<InternalRule> rules = loadRulesFromExternal();

    getRuleLoader().loadRulesAndEquipRouter(rules, routerToUse, getFunctionsMap());

    if (isEnableCache()) {
        ProxyFactory proxyFactory = new ProxyFactory(routerToUse);
        proxyFactory.setInterfaces(new Class[] { ICobarRouter.class });
        RoutingResultCacheAspect advice = new RoutingResultCacheAspect();
        if (cacheSize > 0) {
            advice.setInternalCache(new LRUMap(cacheSize));
        }
        proxyFactory.addAdvice(advice);
        this.router = (ICobarRouter<IBatisRoutingFact>) proxyFactory.getProxy();
    } else {
        this.router = routerToUse;
    }
}
 
Example 2
Source File: ScriptFactoryPostProcessor.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
/**
 * Create a refreshable proxy for the given AOP TargetSource.
 * @param ts the refreshable TargetSource
 * @param interfaces the proxy interfaces (may be {@code null} to
 * indicate proxying of all interfaces implemented by the target class)
 * @return the generated proxy
 * @see RefreshableScriptTargetSource
 */
protected Object createRefreshableProxy(TargetSource ts, Class<?>[] interfaces, boolean proxyTargetClass) {
	ProxyFactory proxyFactory = new ProxyFactory();
	proxyFactory.setTargetSource(ts);
	ClassLoader classLoader = this.beanClassLoader;

	if (interfaces == null) {
		interfaces = ClassUtils.getAllInterfacesForClass(ts.getTargetClass(), this.beanClassLoader);
	}
	proxyFactory.setInterfaces(interfaces);
	if (proxyTargetClass) {
		classLoader = null;  // force use of Class.getClassLoader()
		proxyFactory.setProxyTargetClass(true);
	}

	DelegatingIntroductionInterceptor introduction = new DelegatingIntroductionInterceptor(ts);
	introduction.suppressInterface(TargetSource.class);
	proxyFactory.addAdvice(introduction);

	return proxyFactory.getProxy(classLoader);
}
 
Example 3
Source File: AnnotationTransactionAttributeSourceTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void serializable() throws Exception {
	TestBean1 tb = new TestBean1();
	CallCountingTransactionManager ptm = new CallCountingTransactionManager();
	AnnotationTransactionAttributeSource tas = new AnnotationTransactionAttributeSource();
	TransactionInterceptor ti = new TransactionInterceptor(ptm, tas);

	ProxyFactory proxyFactory = new ProxyFactory();
	proxyFactory.setInterfaces(ITestBean1.class);
	proxyFactory.addAdvice(ti);
	proxyFactory.setTarget(tb);
	ITestBean1 proxy = (ITestBean1) proxyFactory.getProxy();
	proxy.getAge();
	assertEquals(1, ptm.commits);

	ITestBean1 serializedProxy = (ITestBean1) SerializationTestUtils.serializeAndDeserialize(proxy);
	serializedProxy.getAge();
	Advised advised = (Advised) serializedProxy;
	TransactionInterceptor serializedTi = (TransactionInterceptor) advised.getAdvisors()[0].getAdvice();
	CallCountingTransactionManager serializedPtm =
			(CallCountingTransactionManager) serializedTi.getTransactionManager();
	assertEquals(2, serializedPtm.commits);
}
 
Example 4
Source File: ConcurrencyThrottleInterceptorTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void testSerializable() throws Exception {
	DerivedTestBean tb = new DerivedTestBean();
	ProxyFactory proxyFactory = new ProxyFactory();
	proxyFactory.setInterfaces(ITestBean.class);
	ConcurrencyThrottleInterceptor cti = new ConcurrencyThrottleInterceptor();
	proxyFactory.addAdvice(cti);
	proxyFactory.setTarget(tb);
	ITestBean proxy = (ITestBean) proxyFactory.getProxy();
	proxy.getAge();

	ITestBean serializedProxy = (ITestBean) SerializationTestUtils.serializeAndDeserialize(proxy);
	Advised advised = (Advised) serializedProxy;
	ConcurrencyThrottleInterceptor serializedCti =
			(ConcurrencyThrottleInterceptor) advised.getAdvisors()[0].getAdvice();
	assertEquals(cti.getConcurrencyLimit(), serializedCti.getConcurrencyLimit());
	serializedProxy.getAge();
}
 
Example 5
Source File: AbstractAspectJAdvisorFactoryTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
protected Object createProxy(Object target, List<Advisor> advisors, Class<?>... interfaces) {
	ProxyFactory pf = new ProxyFactory(target);
	if (interfaces.length > 1 || interfaces[0].isInterface()) {
		pf.setInterfaces(interfaces);
	}
	else {
		pf.setProxyTargetClass(true);
	}

	// Required everywhere we use AspectJ proxies
	pf.addAdvice(ExposeInvocationInterceptor.INSTANCE);
	pf.addAdvisors(advisors);

	pf.setExposeProxy(true);
	return pf.getProxy();
}
 
Example 6
Source File: AnnotationTransactionAttributeSourceTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void serializable() throws Exception {
	TestBean1 tb = new TestBean1();
	CallCountingTransactionManager ptm = new CallCountingTransactionManager();
	AnnotationTransactionAttributeSource tas = new AnnotationTransactionAttributeSource();
	TransactionInterceptor ti = new TransactionInterceptor(ptm, tas);

	ProxyFactory proxyFactory = new ProxyFactory();
	proxyFactory.setInterfaces(new Class[] {ITestBean.class});
	proxyFactory.addAdvice(ti);
	proxyFactory.setTarget(tb);
	ITestBean proxy = (ITestBean) proxyFactory.getProxy();
	proxy.getAge();
	assertEquals(1, ptm.commits);

	ITestBean serializedProxy = (ITestBean) SerializationTestUtils.serializeAndDeserialize(proxy);
	serializedProxy.getAge();
	Advised advised = (Advised) serializedProxy;
	TransactionInterceptor serializedTi = (TransactionInterceptor) advised.getAdvisors()[0].getAdvice();
	CallCountingTransactionManager serializedPtm =
			(CallCountingTransactionManager) serializedTi.getTransactionManager();
	assertEquals(2, serializedPtm.commits);
}
 
Example 7
Source File: MBeanExporterTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void testExportJdkProxy() throws Exception {
	JmxTestBean bean = new JmxTestBean();
	bean.setName("Rob Harrop");

	ProxyFactory factory = new ProxyFactory();
	factory.setTarget(bean);
	factory.addAdvice(new NopInterceptor());
	factory.setInterfaces(IJmxTestBean.class);

	IJmxTestBean proxy = (IJmxTestBean) factory.getProxy();
	String name = "bean:mmm=whatever";

	Map<String, Object> beans = new HashMap<String, Object>();
	beans.put(name, proxy);

	MBeanExporter exporter = new MBeanExporter();
	exporter.setServer(server);
	exporter.setBeans(beans);
	exporter.registerBeans();

	ObjectName oname = ObjectName.getInstance(name);
	Object nameValue = server.getAttribute(oname, "Name");
	assertEquals("Rob Harrop", nameValue);
}
 
Example 8
Source File: MBeanExporterTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test
public void testExportJdkProxy() throws Exception {
	JmxTestBean bean = new JmxTestBean();
	bean.setName("Rob Harrop");

	ProxyFactory factory = new ProxyFactory();
	factory.setTarget(bean);
	factory.addAdvice(new NopInterceptor());
	factory.setInterfaces(IJmxTestBean.class);

	IJmxTestBean proxy = (IJmxTestBean) factory.getProxy();
	String name = "bean:mmm=whatever";

	Map<String, Object> beans = new HashMap<>();
	beans.put(name, proxy);

	MBeanExporter exporter = new MBeanExporter();
	exporter.setServer(server);
	exporter.setBeans(beans);
	exporter.registerBeans();

	ObjectName oname = ObjectName.getInstance(name);
	Object nameValue = server.getAttribute(oname, "Name");
	assertEquals("Rob Harrop", nameValue);
}
 
Example 9
Source File: AbstractAspectJAdvisorFactoryTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
protected Object createProxy(Object target, List<Advisor> advisors, Class<?>... interfaces) {
	ProxyFactory pf = new ProxyFactory(target);
	if (interfaces.length > 1 || interfaces[0].isInterface()) {
		pf.setInterfaces(interfaces);
	}
	else {
		pf.setProxyTargetClass(true);
	}

	// Required everywhere we use AspectJ proxies
	pf.addAdvice(ExposeInvocationInterceptor.INSTANCE);
	pf.addAdvisors(advisors);

	pf.setExposeProxy(true);
	return pf.getProxy();
}
 
Example 10
Source File: AbstractAspectJAdvisorFactoryTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
protected Object createProxy(Object target, List<Advisor> advisors, Class<?>... interfaces) {
	ProxyFactory pf = new ProxyFactory(target);
	if (interfaces.length > 1 || interfaces[0].isInterface()) {
		pf.setInterfaces(interfaces);
	}
	else {
		pf.setProxyTargetClass(true);
	}

	// Required everywhere we use AspectJ proxies
	pf.addAdvice(ExposeInvocationInterceptor.INSTANCE);

	for (Object a : advisors) {
		pf.addAdvisor((Advisor) a);
	}

	pf.setExposeProxy(true);
	return pf.getProxy();
}
 
Example 11
Source File: ScriptFactoryPostProcessor.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Create a refreshable proxy for the given AOP TargetSource.
 * @param ts the refreshable TargetSource
 * @param interfaces the proxy interfaces (may be {@code null} to
 * indicate proxying of all interfaces implemented by the target class)
 * @return the generated proxy
 * @see RefreshableScriptTargetSource
 */
protected Object createRefreshableProxy(TargetSource ts, @Nullable Class<?>[] interfaces, boolean proxyTargetClass) {
	ProxyFactory proxyFactory = new ProxyFactory();
	proxyFactory.setTargetSource(ts);
	ClassLoader classLoader = this.beanClassLoader;

	if (interfaces != null) {
		proxyFactory.setInterfaces(interfaces);
	}
	else {
		Class<?> targetClass = ts.getTargetClass();
		if (targetClass != null) {
			proxyFactory.setInterfaces(ClassUtils.getAllInterfacesForClass(targetClass, this.beanClassLoader));
		}
	}

	if (proxyTargetClass) {
		classLoader = null;  // force use of Class.getClassLoader()
		proxyFactory.setProxyTargetClass(true);
	}

	DelegatingIntroductionInterceptor introduction = new DelegatingIntroductionInterceptor(ts);
	introduction.suppressInterface(TargetSource.class);
	proxyFactory.addAdvice(introduction);

	return proxyFactory.getProxy(classLoader);
}
 
Example 12
Source File: JndiObjectFactoryBean.java    From spring-analysis-note with MIT License 5 votes vote down vote up
private static Object createJndiObjectProxy(JndiObjectFactoryBean jof) throws NamingException {
	// Create a JndiObjectTargetSource that mirrors the JndiObjectFactoryBean's configuration.
	JndiObjectTargetSource targetSource = new JndiObjectTargetSource();
	targetSource.setJndiTemplate(jof.getJndiTemplate());
	String jndiName = jof.getJndiName();
	Assert.state(jndiName != null, "No JNDI name specified");
	targetSource.setJndiName(jndiName);
	targetSource.setExpectedType(jof.getExpectedType());
	targetSource.setResourceRef(jof.isResourceRef());
	targetSource.setLookupOnStartup(jof.lookupOnStartup);
	targetSource.setCache(jof.cache);
	targetSource.afterPropertiesSet();

	// Create a proxy with JndiObjectFactoryBean's proxy interface and the JndiObjectTargetSource.
	ProxyFactory proxyFactory = new ProxyFactory();
	if (jof.proxyInterfaces != null) {
		proxyFactory.setInterfaces(jof.proxyInterfaces);
	}
	else {
		Class<?> targetClass = targetSource.getTargetClass();
		if (targetClass == null) {
			throw new IllegalStateException(
					"Cannot deactivate 'lookupOnStartup' without specifying a 'proxyInterface' or 'expectedType'");
		}
		Class<?>[] ifcs = ClassUtils.getAllInterfacesForClass(targetClass, jof.beanClassLoader);
		for (Class<?> ifc : ifcs) {
			if (Modifier.isPublic(ifc.getModifiers())) {
				proxyFactory.addInterface(ifc);
			}
		}
	}
	if (jof.exposeAccessContext) {
		proxyFactory.addAdvice(new JndiContextExposingInterceptor(jof.getJndiTemplate()));
	}
	proxyFactory.setTargetSource(targetSource);
	return proxyFactory.getProxy(jof.beanClassLoader);
}
 
Example 13
Source File: MessageBusAdapterConfiguration.java    From spring-bus with Apache License 2.0 5 votes vote down vote up
private <T> T createLazyProxy(ListableBeanFactory beanFactory, Class<T> type) {
	ProxyFactory factory = new ProxyFactory();
	LazyInitTargetSource source = new LazyInitTargetSource();
	source.setTargetClass(type);
	source.setTargetBeanName(getBeanNameFor(beanFactory, MessageBus.class));
	source.setBeanFactory(beanFactory);
	factory.setTargetSource(source);
	factory.addAdvice(new PassthruAdvice());
	factory.setInterfaces(new Class<?>[] { type });
	@SuppressWarnings("unchecked")
	T proxy = (T) factory.getProxy();
	return proxy;
}
 
Example 14
Source File: JndiObjectFactoryBean.java    From java-technology-stack with MIT License 5 votes vote down vote up
private static Object createJndiObjectProxy(JndiObjectFactoryBean jof) throws NamingException {
	// Create a JndiObjectTargetSource that mirrors the JndiObjectFactoryBean's configuration.
	JndiObjectTargetSource targetSource = new JndiObjectTargetSource();
	targetSource.setJndiTemplate(jof.getJndiTemplate());
	String jndiName = jof.getJndiName();
	Assert.state(jndiName != null, "No JNDI name specified");
	targetSource.setJndiName(jndiName);
	targetSource.setExpectedType(jof.getExpectedType());
	targetSource.setResourceRef(jof.isResourceRef());
	targetSource.setLookupOnStartup(jof.lookupOnStartup);
	targetSource.setCache(jof.cache);
	targetSource.afterPropertiesSet();

	// Create a proxy with JndiObjectFactoryBean's proxy interface and the JndiObjectTargetSource.
	ProxyFactory proxyFactory = new ProxyFactory();
	if (jof.proxyInterfaces != null) {
		proxyFactory.setInterfaces(jof.proxyInterfaces);
	}
	else {
		Class<?> targetClass = targetSource.getTargetClass();
		if (targetClass == null) {
			throw new IllegalStateException(
					"Cannot deactivate 'lookupOnStartup' without specifying a 'proxyInterface' or 'expectedType'");
		}
		Class<?>[] ifcs = ClassUtils.getAllInterfacesForClass(targetClass, jof.beanClassLoader);
		for (Class<?> ifc : ifcs) {
			if (Modifier.isPublic(ifc.getModifiers())) {
				proxyFactory.addInterface(ifc);
			}
		}
	}
	if (jof.exposeAccessContext) {
		proxyFactory.addAdvice(new JndiContextExposingInterceptor(jof.getJndiTemplate()));
	}
	proxyFactory.setTargetSource(targetSource);
	return proxyFactory.getProxy(jof.beanClassLoader);
}
 
Example 15
Source File: ScriptFactoryPostProcessor.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Create a refreshable proxy for the given AOP TargetSource.
 * @param ts the refreshable TargetSource
 * @param interfaces the proxy interfaces (may be {@code null} to
 * indicate proxying of all interfaces implemented by the target class)
 * @return the generated proxy
 * @see RefreshableScriptTargetSource
 */
protected Object createRefreshableProxy(TargetSource ts, @Nullable Class<?>[] interfaces, boolean proxyTargetClass) {
	ProxyFactory proxyFactory = new ProxyFactory();
	proxyFactory.setTargetSource(ts);
	ClassLoader classLoader = this.beanClassLoader;

	if (interfaces != null) {
		proxyFactory.setInterfaces(interfaces);
	}
	else {
		Class<?> targetClass = ts.getTargetClass();
		if (targetClass != null) {
			proxyFactory.setInterfaces(ClassUtils.getAllInterfacesForClass(targetClass, this.beanClassLoader));
		}
	}

	if (proxyTargetClass) {
		classLoader = null;  // force use of Class.getClassLoader()
		proxyFactory.setProxyTargetClass(true);
	}

	DelegatingIntroductionInterceptor introduction = new DelegatingIntroductionInterceptor(ts);
	introduction.suppressInterface(TargetSource.class);
	proxyFactory.addAdvice(introduction);

	return proxyFactory.getProxy(classLoader);
}
 
Example 16
Source File: PersistentServiceFactory.java    From jdal with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a default transactional proxy for service with default transacction attributes
 * @param <T>
 * @param service
 * @return a Tx Proxy for service with default tx attributes
 */
@SuppressWarnings("unchecked")
public <T>  PersistentManager<T, Serializable> makeTransactionalProxy(PersistentManager<T, Serializable> service) {
	ProxyFactory factory = new ProxyFactory(service);
	factory.setInterfaces(new Class[] {Dao.class});
	TransactionInterceptor interceptor = new TransactionInterceptor(transactionManager, 
			new MatchAlwaysTransactionAttributeSource()); 
	factory.addAdvice(interceptor);
	factory.setTarget(service);
	return (PersistentManager<T, Serializable>) factory.getProxy();
}
 
Example 17
Source File: RatelClientProducer.java    From Ratel with Apache License 2.0 5 votes vote down vote up
public <T> T produceServiceProxy(final Class<T> serviceContractClass, boolean useCache,
                                  final RetryPolicyConfig retryPolicyConfig, final TimeoutConfig timeout) {

    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.setInterfaces(serviceContractClass);

    if (useCache) {
        proxyFactory.addAdvice(new CacheInvocationHandler());
    }

    if (retryPolicyConfig != null) {
        proxyFactory.addAdvice(new RetryPolicyInvocationHandler(retryPolicyConfig));
    }

    proxyFactory.setTargetSource(new TargetSource() {
        @Override
        public Class<?> getTargetClass() {
            return serviceContractClass;
        }

        @Override
        public boolean isStatic() {
            return false;
        }

        @Override
        public Object getTarget() {
            return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[]
                    {serviceContractClass}, new UnicastingInvocationHandler(fetchStrategy, serviceContractClass,
                    clientProxyGenerator, timeout));
        }

        @Override
        public void releaseTarget(Object o) {
        }
    });

    return (T) proxyFactory.getProxy();
}
 
Example 18
Source File: AmazonS3ProxyFactory.java    From spring-cloud-aws with Apache License 2.0 5 votes vote down vote up
/**
 * Factory-method to create a proxy using the {@link SimpleStorageRedirectInterceptor}
 * that supports redirects for buckets which are in a different region. This proxy
 * uses the amazonS3 parameter as a "prototype" and re-uses the credentials from the
 * passed in {@link AmazonS3} instance. Proxy implementations uses the
 * {@link AmazonS3ClientFactory} to create region specific clients, which are cached
 * by the implementation on a region basis to avoid unnecessary object creation.
 * @param amazonS3 Fully configured AmazonS3 client, the client can be an immutable
 * instance (created by the {@link com.amazonaws.services.s3.AmazonS3ClientBuilder})
 * as this proxy will not change the underlying implementation.
 * @return AOP-Proxy that intercepts all method calls using the
 * {@link SimpleStorageRedirectInterceptor}
 */
public static AmazonS3 createProxy(AmazonS3 amazonS3) {
	Assert.notNull(amazonS3, "AmazonS3 client must not be null");

	if (AopUtils.isAopProxy(amazonS3)) {

		Advised advised = (Advised) amazonS3;
		for (Advisor advisor : advised.getAdvisors()) {
			if (ClassUtils.isAssignableValue(SimpleStorageRedirectInterceptor.class,
					advisor.getAdvice())) {
				return amazonS3;
			}
		}

		try {
			advised.addAdvice(new SimpleStorageRedirectInterceptor(
					(AmazonS3) advised.getTargetSource().getTarget()));
		}
		catch (Exception e) {
			throw new RuntimeException(
					"Error adding advice for class amazonS3 instance", e);
		}

		return amazonS3;
	}

	ProxyFactory factory = new ProxyFactory(amazonS3);
	factory.setInterfaces(AmazonS3.class);
	factory.addAdvice(new SimpleStorageRedirectInterceptor(amazonS3));

	return (AmazonS3) factory.getProxy();
}
 
Example 19
Source File: AbstractStoreFactoryBean.java    From spring-content with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
protected Store<? extends Serializable> createContentStore() {
	Object target = getContentStoreImpl();

	// Create proxy
	ProxyFactory result = new ProxyFactory();
	result.setTarget(target);
	result.setInterfaces(new Class[] { storeInterface, Store.class, ContentStore.class });

	Map<Method, StoreExtension> extensionsMap = new HashMap<>();
	try {
		for (StoreExtension extension : extensions) {
			for (Method method : extension.getMethods()) {
				extensionsMap.put(method, extension);
			}
		}
	}
	catch (Exception e) {
		logger.error("Failed to setup extensions", e);
	}

	this.addProxyAdvice(result, beanFactory);

	StoreMethodInterceptor intercepter = new StoreMethodInterceptor(
			(ContentStore<Object, Serializable>) target,
			getDomainClass(storeInterface), getContentIdClass(storeInterface),
			extensionsMap, publisher);

	intercepter.setStoreFragments(storeFragments);

	result.addAdvice(intercepter);

	return (Store<? extends Serializable>) result.getProxy(classLoader);
}
 
Example 20
Source File: JndiObjectFactoryBean.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
private static Object createJndiObjectProxy(JndiObjectFactoryBean jof) throws NamingException {
	// Create a JndiObjectTargetSource that mirrors the JndiObjectFactoryBean's configuration.
	JndiObjectTargetSource targetSource = new JndiObjectTargetSource();
	targetSource.setJndiTemplate(jof.getJndiTemplate());
	targetSource.setJndiName(jof.getJndiName());
	targetSource.setExpectedType(jof.getExpectedType());
	targetSource.setResourceRef(jof.isResourceRef());
	targetSource.setLookupOnStartup(jof.lookupOnStartup);
	targetSource.setCache(jof.cache);
	targetSource.afterPropertiesSet();

	// Create a proxy with JndiObjectFactoryBean's proxy interface and the JndiObjectTargetSource.
	ProxyFactory proxyFactory = new ProxyFactory();
	if (jof.proxyInterfaces != null) {
		proxyFactory.setInterfaces(jof.proxyInterfaces);
	}
	else {
		Class<?> targetClass = targetSource.getTargetClass();
		if (targetClass == null) {
			throw new IllegalStateException(
					"Cannot deactivate 'lookupOnStartup' without specifying a 'proxyInterface' or 'expectedType'");
		}
		Class<?>[] ifcs = ClassUtils.getAllInterfacesForClass(targetClass, jof.beanClassLoader);
		for (Class<?> ifc : ifcs) {
			if (Modifier.isPublic(ifc.getModifiers())) {
				proxyFactory.addInterface(ifc);
			}
		}
	}
	if (jof.exposeAccessContext) {
		proxyFactory.addAdvice(new JndiContextExposingInterceptor(jof.getJndiTemplate()));
	}
	proxyFactory.setTargetSource(targetSource);
	return proxyFactory.getProxy(jof.beanClassLoader);
}