org.springframework.jdbc.datasource.lookup.RoutingDataSource Maven / Gradle / Ivy
package org.springframework.jdbc.datasource.lookup;
import java.lang.reflect.Constructor;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.util.Assert;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
/**
*
* PropertiesConfigurationFactory propertiesConfigurationFactory = new PropertiesConfigurationFactory(DataSourceProperties.class);
* propertiesConfigurationFactory.setPropertySources(new PropertySourcesBinder(new ResourcePropertySource(resource)).getPropertySources());
* DataSource dataSource = propertiesConfigurationFactory.getObject().initializeDataSourceBuilder().build();
*
*
* @see net.ttddyy.dsproxy.listener.AbstractQueryLoggingListener
* @see net.ttddyy.dsproxy.listener.CommonsQueryLoggingListener
* @see net.ttddyy.dsproxy.listener.SLF4JQueryLoggingListener
* @see net.ttddyy.dsproxy.listener.SLF4JQueryLoggingListener
* @see org.springframework.beans.BeanUtils#instantiate(Class)
* @see org.springframework.util.ReflectionUtils#findMethod(Class, String)
* @see org.springframework.util.ReflectionUtils#invokeMethod(java.lang.reflect.Method,
* Object, Object...)
* @see org.springframework.core.Constants#asString(String)
* @see org.springframework.util.CollectionUtils#toMultiValueMap(Map)
*/
public final class RoutingDataSource extends org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource {
private final MultiValueMap readOnly = new LinkedMultiValueMap();
private final int size;
/**
* @see java.util.Collections#addAll(Collection, Object...)
* @see java.util.Collections#synchronizedList(List)
* @see org.springframework.core.io.ContextResource#getPathWithinContext()
*/
public RoutingDataSource(Map