mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
enhance spring support
This commit is contained in:
@@ -118,7 +118,7 @@ public class DruidDataSourceFactory implements ObjectFactory {
|
||||
* @param properties the datasource configuration properties
|
||||
* @throws Exception if an error occurs creating the data source
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings({ "deprecation", "rawtypes" })
|
||||
public static DataSource createDataSource(Map properties) throws Exception {
|
||||
DruidDataSource dataSource = new DruidDataSource();
|
||||
String value = null;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.alibaba.druid.support.spring;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
|
||||
import javax.management.MBeanServer;
|
||||
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
|
||||
public class MBeanServerFactoryBean implements FactoryBean {
|
||||
|
||||
public MBeanServer getObject() throws Exception {
|
||||
return ManagementFactory.getPlatformMBeanServer();
|
||||
}
|
||||
|
||||
public Class<?> getObjectType() {
|
||||
return ManagementFactory.getPlatformMBeanServer().getClass();
|
||||
}
|
||||
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user