All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.bridgeli.masterslavedbselector.MasterSlaveDataSource Maven / Gradle / Ivy

package cn.bridgeli.masterslavedbselector;

import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

/**
 * 主从数据源
 */
public class MasterSlaveDataSource extends AbstractRoutingDataSource {

    private MasterSlaveSelector masterSlaveSelector;

    /**
     * @see org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource#determineCurrentLookupKey()
     */
    @Override
    protected Object determineCurrentLookupKey() {
        return masterSlaveSelector.get();
    }

    /**
     * Setter method for property masterSlaveSelector.
     *
     * @param masterSlaveSelector value to be assigned to property masterSlaveSelector
     */
    public void setMasterSlaveSelector(MasterSlaveSelector masterSlaveSelector) {
        this.masterSlaveSelector = masterSlaveSelector;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy