Java Code Examples for org.springframework.jndi.JndiObjectFactoryBean#setProxyInterface()

The following examples show how to use org.springframework.jndi.JndiObjectFactoryBean#setProxyInterface() . 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: ShardingSpringBootConfiguration.java    From seata-samples with Apache License 2.0 6 votes vote down vote up
private DataSource getJndiDataSource(final String jndiName) throws NamingException {
    JndiObjectFactoryBean bean = new JndiObjectFactoryBean();
    bean.setResourceRef(true);
    bean.setJndiName(jndiName);
    bean.setProxyInterface(DataSource.class);
    bean.afterPropertiesSet();
    return (DataSource) bean.getObject();
}
 
Example 2
Source File: DataSourceConfig.java    From Project with Apache License 2.0 5 votes vote down vote up
/**
* <p>描述:jndi数据源;生产环境</p>
* @return
* @author LZC
* @date   2019-02-14 17:38
 */
@Bean
@Profile("prod")
public DataSource jndiDataSource() {
	JndiObjectFactoryBean jndiObjectFactoryBean = new JndiObjectFactoryBean();
	jndiObjectFactoryBean.setJndiName("jdbc/myDS");
	jndiObjectFactoryBean.setResourceRef(true);
	jndiObjectFactoryBean.setProxyInterface(DataSource.class);
	return (DataSource) jndiObjectFactoryBean.getObject();
}
 
Example 3
Source File: DataSourceMapSetter.java    From shardingsphere with Apache License 2.0 5 votes vote down vote up
private static DataSource getJNDIDataSource(final String jndiName) throws NamingException {
    JndiObjectFactoryBean bean = new JndiObjectFactoryBean();
    bean.setResourceRef(true);
    bean.setJndiName(jndiName);
    bean.setProxyInterface(DataSource.class);
    bean.afterPropertiesSet();
    return (DataSource) bean.getObject();
}