Polish
This commit is contained in:
parent
ba16f135a6
commit
c826310fd1
|
@ -43,9 +43,8 @@ public class MetricsAutoConfigurationWithLog4j2AndLogbackTests {
|
|||
|
||||
@Test
|
||||
public void doesNotConfigureLogbackMetrics() {
|
||||
this.contextRunner.run((context) -> {
|
||||
assertThat(context).doesNotHaveBean(LogbackMetrics.class);
|
||||
});
|
||||
this.contextRunner.run(
|
||||
(context) -> assertThat(context).doesNotHaveBean(LogbackMetrics.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
package org.springframework.boot.actuate.metrics.cache;
|
||||
|
||||
import com.hazelcast.core.IMap;
|
||||
import com.hazelcast.spring.cache.HazelcastCache;
|
||||
import io.micrometer.core.instrument.Tag;
|
||||
import io.micrometer.core.instrument.binder.MeterBinder;
|
||||
|
@ -32,10 +31,8 @@ public class HazelcastCacheMeterBinderProvider
|
|||
implements CacheMeterBinderProvider<HazelcastCache> {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public MeterBinder getMeterBinder(HazelcastCache cache, Iterable<Tag> tags) {
|
||||
return new HazelcastCacheMetrics((IMap<Object, Object>) cache.getNativeCache(),
|
||||
tags);
|
||||
return new HazelcastCacheMetrics(cache.getNativeCache(), tags);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -112,7 +112,8 @@ class HibernateJpaConfiguration extends JpaBaseConfiguration {
|
|||
ImplicitNamingStrategy implicitNamingStrategy,
|
||||
List<HibernatePropertiesCustomizer> hibernatePropertiesCustomizers) {
|
||||
if (physicalNamingStrategy != null || implicitNamingStrategy != null) {
|
||||
LinkedList<HibernatePropertiesCustomizer> customizers = new LinkedList<>(hibernatePropertiesCustomizers);
|
||||
LinkedList<HibernatePropertiesCustomizer> customizers = new LinkedList<>(
|
||||
hibernatePropertiesCustomizers);
|
||||
customizers.addFirst(new NamingStrategiesHibernatePropertiesCustomizer(
|
||||
physicalNamingStrategy, implicitNamingStrategy));
|
||||
return customizers;
|
||||
|
@ -129,9 +130,9 @@ class HibernateJpaConfiguration extends JpaBaseConfiguration {
|
|||
protected Map<String, Object> getVendorProperties() {
|
||||
Supplier<String> defaultDdlMode = () -> this.defaultDdlAutoProvider
|
||||
.getDefaultDdlAuto(getDataSource());
|
||||
return new LinkedHashMap<>(getProperties()
|
||||
.getHibernateProperties(new HibernateSettings().ddlAuto(defaultDdlMode)
|
||||
.hibernatePropertiesCustomizers(
|
||||
return new LinkedHashMap<>(
|
||||
getProperties().getHibernateProperties(new HibernateSettings()
|
||||
.ddlAuto(defaultDdlMode).hibernatePropertiesCustomizers(
|
||||
this.hibernatePropertiesCustomizers)));
|
||||
}
|
||||
|
||||
|
|
|
@ -278,10 +278,11 @@ public class HibernateJpaAutoConfigurationTests
|
|||
contextRunner()
|
||||
.withUserConfiguration(TestPhysicalNamingStrategyConfiguration.class)
|
||||
.run((context) -> {
|
||||
Map<String, Object> hibernateProperties = context.getBean(
|
||||
HibernateJpaConfiguration.class).getVendorProperties();
|
||||
assertThat(hibernateProperties).contains(
|
||||
entry("hibernate.physical_naming_strategy",
|
||||
Map<String, Object> hibernateProperties = context
|
||||
.getBean(HibernateJpaConfiguration.class)
|
||||
.getVendorProperties();
|
||||
assertThat(hibernateProperties)
|
||||
.contains(entry("hibernate.physical_naming_strategy",
|
||||
context.getBean("testPhysicalNamingStrategy")));
|
||||
assertThat(hibernateProperties)
|
||||
.doesNotContainKeys("hibernate.ejb.naming_strategy");
|
||||
|
@ -293,10 +294,11 @@ public class HibernateJpaAutoConfigurationTests
|
|||
contextRunner()
|
||||
.withUserConfiguration(TestImplicitNamingStrategyConfiguration.class)
|
||||
.run((context) -> {
|
||||
Map<String, Object> hibernateProperties = context.getBean(
|
||||
HibernateJpaConfiguration.class).getVendorProperties();
|
||||
assertThat(hibernateProperties).contains(
|
||||
entry("hibernate.implicit_naming_strategy",
|
||||
Map<String, Object> hibernateProperties = context
|
||||
.getBean(HibernateJpaConfiguration.class)
|
||||
.getVendorProperties();
|
||||
assertThat(hibernateProperties)
|
||||
.contains(entry("hibernate.implicit_naming_strategy",
|
||||
context.getBean("testImplicitNamingStrategy")));
|
||||
assertThat(hibernateProperties)
|
||||
.doesNotContainKeys("hibernate.ejb.naming_strategy");
|
||||
|
@ -312,8 +314,9 @@ public class HibernateJpaAutoConfigurationTests
|
|||
"spring.jpa.hibernate.naming.physical-strategy:com.example.Physical",
|
||||
"spring.jpa.hibernate.naming.implicit-strategy:com.example.Implicit")
|
||||
.run((context) -> {
|
||||
Map<String, Object> hibernateProperties = context.getBean(
|
||||
HibernateJpaConfiguration.class).getVendorProperties();
|
||||
Map<String, Object> hibernateProperties = context
|
||||
.getBean(HibernateJpaConfiguration.class)
|
||||
.getVendorProperties();
|
||||
assertThat(hibernateProperties).contains(
|
||||
entry("hibernate.physical_naming_strategy",
|
||||
context.getBean("testPhysicalNamingStrategy")),
|
||||
|
@ -335,10 +338,12 @@ public class HibernateJpaAutoConfigurationTests
|
|||
"spring.jpa.hibernate.naming.physical-strategy:com.example.Physical",
|
||||
"spring.jpa.hibernate.naming.implicit-strategy:com.example.Implicit")
|
||||
.run((context) -> {
|
||||
Map<String, Object> hibernateProperties = context.getBean(
|
||||
HibernateJpaConfiguration.class).getVendorProperties();
|
||||
TestHibernatePropertiesCustomizerConfiguration configuration = context.getBean(
|
||||
TestHibernatePropertiesCustomizerConfiguration.class);
|
||||
Map<String, Object> hibernateProperties = context
|
||||
.getBean(HibernateJpaConfiguration.class)
|
||||
.getVendorProperties();
|
||||
TestHibernatePropertiesCustomizerConfiguration configuration = context
|
||||
.getBean(
|
||||
TestHibernatePropertiesCustomizerConfiguration.class);
|
||||
assertThat(hibernateProperties).contains(
|
||||
entry("hibernate.physical_naming_strategy",
|
||||
configuration.physicalNamingStrategy),
|
||||
|
@ -349,7 +354,6 @@ public class HibernateJpaAutoConfigurationTests
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
@Configuration
|
||||
@TestAutoConfigurationPackage(City.class)
|
||||
static class TestInitializedJpaConfiguration {
|
||||
|
|
Loading…
Reference in New Issue