Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.jndi;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import javax.naming.Context;
import javax.naming.NamingException;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.beans.SimpleTypeConverter;
import org.springframework.beans.TypeConverter;
import org.springframework.beans.TypeMismatchException;
import org.springframework.beans.factory.BeanClassLoaderAware;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.util.ClassUtils;
/**
* {@link org.springframework.beans.factory.FactoryBean} that looks up a
* JNDI object. Exposes the object found in JNDI for bean references,
* e.g. for data access object's "dataSource" property in case of a
* {@link javax.sql.DataSource}.
*
*
The typical usage will be to register this as singleton factory
* (e.g. for a certain JNDI-bound DataSource) in an application context,
* and give bean references to application services that need it.
*
*
The default behavior is to look up the JNDI object on startup and cache it.
* This can be customized through the "lookupOnStartup" and "cache" properties,
* using a {@link JndiObjectTargetSource} underneath. Note that you need to specify
* a "proxyInterface" in such a scenario, since the actual JNDI object type is not
* known in advance.
*
*
Of course, bean classes in a Spring environment may lookup e.g. a DataSource
* from JNDI themselves. This class simply enables central configuration of the
* JNDI name, and easy switching to non-JNDI alternatives. The latter is
* particularly convenient for test setups, reuse in standalone clients, etc.
*
*
Note that switching to e.g. DriverManagerDataSource is just a matter of
* configuration: Simply replace the definition of this FactoryBean with a
* {@link org.springframework.jdbc.datasource.DriverManagerDataSource} definition!
*
* @author Juergen Hoeller
* @since 22.05.2003
* @see #setProxyInterface
* @see #setLookupOnStartup
* @see #setCache
* @see JndiObjectTargetSource
*/
public class JndiObjectFactoryBean extends JndiObjectLocator
implements FactoryBean