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

org.ladsn.jdbc.plugin.endpoint.DataSourceEndpoint Maven / Gradle / Ivy

The newest version!
package org.ladsn.jdbc.plugin.endpoint;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import javax.sql.DataSource;

import org.ladsn.jdbc.config.DynamicDataSourceContextHolder;
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
import org.springframework.stereotype.Component;

@Component
@Endpoint(id = "dataSource")
public class DataSourceEndpoint {

	private static final Map MAP = new ConcurrentHashMap<>(16);

	public DataSourceEndpoint() {
		Map customDataSources = DynamicDataSourceContextHolder.customDataSources;

		for (Map.Entry entry : customDataSources.entrySet()) {
			Object key = entry.getKey();
			Object value = entry.getValue();
			MAP.put((String) key, (DataSource) value);
		}
	}

	@ReadOperation
	public static Map getMAP() {
		return MAP;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy