Spring boot 弹簧靴Hikari&;刷新端点
使用spring 2.0.2.RELEASE和hikari 2.7.6以及finchley.rc2。 仍然获取Spring boot 弹簧靴Hikari&;刷新端点,spring-boot,hikaricp,Spring Boot,Hikaricp,使用spring 2.0.2.RELEASE和hikari 2.7.6以及finchley.rc2。 仍然获取的原因:java.lang.IllegalStateException:池的配置在启动后即被密封。使用HikariConfigMXBean进行运行时更改。刷新终结点时出错 我无法转到hikari 2.7.4(虽然它解决了我的问题,但我正在跟踪池资源的使用情况,如当前、空闲、挂起的连接以及这些值。那么如何使用hikari 2.7.6呢 有没有办法将hikari排除在refersh之外?或者
的原因:java.lang.IllegalStateException:池的配置在启动后即被密封。使用HikariConfigMXBean进行运行时更改
。刷新终结点时出错
我无法转到hikari 2.7.4(虽然它解决了我的问题,但我正在跟踪池资源的使用情况,如当前、空闲、挂起的连接以及这些值。那么如何使用hikari 2.7.6呢
有没有办法将hikari排除在refersh之外?或者类似的事情
仅供参考:我已经为mysql创建了自定义数据源(读/写拆分)
这是我的数据库属性
@Bean(name = "writeDataSource")
@ConfigurationProperties(prefix = "datasource.write")
public DataSource writeDataSource() {
return DataSourceBuilder.create().build();
}
@Bean(name = "readDataSource")
@ConfigurationProperties(prefix = "datasource.read")
@Primary
public DataSource readDataSource() {
return DataSourceBuilder.create().build();
}
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(@Qualifier("dataSource") DataSource dataSource) {
LocalContainerEntityManagerFactoryBean emfb = new LocalContainerEntityManagerFactoryBean();
emfb.setDataSource(dataSource);
emfb.setPackagesToScan("com.abc");
HibernateJpaVendorAdapter jpaVendorAdapter = new HibernateJpaVendorAdapter();
emfb.setJpaVendorAdapter(jpaVendorAdapter);
/** Setting additional properties */
Properties props = new Properties();
props.put("hibernate.show_sql", "true");
props.put("hibernate.dialect", "org.hibernate.dialect.MySQL5Dialect");
props.put("hibernate.ejb.interceptor", hibernateInterceptor());
props.put("hibernate.id.new_generator_mappings","false");
emfb.setJpaProperties(props);
return emfb;
}
为什么要使用Finchley.RC2?它不是最新的稳定版本,如果升级,您可能会发现该错误已经修复。
@Bean(name = "writeDataSource")
@ConfigurationProperties(prefix = "datasource.write")
public DataSource writeDataSource() {
return DataSourceBuilder.create().build();
}
@Bean(name = "readDataSource")
@ConfigurationProperties(prefix = "datasource.read")
@Primary
public DataSource readDataSource() {
return DataSourceBuilder.create().build();
}
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(@Qualifier("dataSource") DataSource dataSource) {
LocalContainerEntityManagerFactoryBean emfb = new LocalContainerEntityManagerFactoryBean();
emfb.setDataSource(dataSource);
emfb.setPackagesToScan("com.abc");
HibernateJpaVendorAdapter jpaVendorAdapter = new HibernateJpaVendorAdapter();
emfb.setJpaVendorAdapter(jpaVendorAdapter);
/** Setting additional properties */
Properties props = new Properties();
props.put("hibernate.show_sql", "true");
props.put("hibernate.dialect", "org.hibernate.dialect.MySQL5Dialect");
props.put("hibernate.ejb.interceptor", hibernateInterceptor());
props.put("hibernate.id.new_generator_mappings","false");
emfb.setJpaProperties(props);
return emfb;
}