在 http://localhost:8012/druid/datasource.html
数据源页面提示:
(*) property for user to setup
代码段:
/**
* 配置DataSource
* @return
* @throws SQLException
*/
@Bean
public DataSource druidDataSource() throws SQLException {
DruidDataSource druidDataSource = new DruidDataSource();
druidDataSource.setUsername("root");
druidDataSource.setPassword("");
druidDataSource.setDriverClassName("com.mysql.jdbc.Driver");
druidDataSource.setUrl("jdbc:mysql://localhost:3306/test1");
druidDataSource.setMaxActive(100);
druidDataSource.setFilters("stat,wall,log4j");
druidDataSource.setInitialSize(10);
return druidDataSource;
}
原因 数据源没有关闭
@Bean(destroyMethod = "close", initMethod = "init")