Merge branch '2.0.x'
This commit is contained in:
commit
a41c9eb736
|
@ -21,6 +21,7 @@ import java.time.Duration;
|
||||||
import io.micrometer.statsd.StatsdFlavor;
|
import io.micrometer.statsd.StatsdFlavor;
|
||||||
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link ConfigurationProperties} for configuring StatsD metrics export.
|
* {@link ConfigurationProperties} for configuring StatsD metrics export.
|
||||||
|
@ -122,10 +123,13 @@ public class StatsdProperties {
|
||||||
this.pollingFrequency = pollingFrequency;
|
this.pollingFrequency = pollingFrequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
@DeprecatedConfigurationProperty(reason = "No longer configurable and an unbounded queue will always be used")
|
||||||
public Integer getQueueSize() {
|
public Integer getQueueSize() {
|
||||||
return this.queueSize;
|
return this.queueSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public void setQueueSize(Integer queueSize) {
|
public void setQueueSize(Integer queueSize) {
|
||||||
this.queueSize = queueSize;
|
this.queueSize = queueSize;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,7 @@ public class StatsdPropertiesConfigAdapter
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
public int queueSize() {
|
public int queueSize() {
|
||||||
return get(StatsdProperties::getQueueSize, StatsdConfig.super::queueSize);
|
return get(StatsdProperties::getQueueSize, StatsdConfig.super::queueSize);
|
||||||
}
|
}
|
||||||
|
|
|
@ -280,7 +280,10 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "management.metrics.export.statsd.queue-size",
|
"name": "management.metrics.export.statsd.queue-size",
|
||||||
"defaultValue": 2147483647
|
"defaultValue": 2147483647,
|
||||||
|
"deprecation": {
|
||||||
|
"level": "error"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "management.trace.http.enabled",
|
"name": "management.trace.http.enabled",
|
||||||
|
|
|
@ -43,9 +43,8 @@ public class MetricsAutoConfigurationWithLog4j2AndLogbackTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void doesNotConfigureLogbackMetrics() {
|
public void doesNotConfigureLogbackMetrics() {
|
||||||
this.contextRunner.run((context) -> {
|
this.contextRunner.run(
|
||||||
assertThat(context).doesNotHaveBean(LogbackMetrics.class);
|
(context) -> assertThat(context).doesNotHaveBean(LogbackMetrics.class));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,6 @@ public class StatsdPropertiesTests {
|
||||||
assertThat(properties.getPort()).isEqualTo(config.port());
|
assertThat(properties.getPort()).isEqualTo(config.port());
|
||||||
assertThat(properties.getMaxPacketLength()).isEqualTo(config.maxPacketLength());
|
assertThat(properties.getMaxPacketLength()).isEqualTo(config.maxPacketLength());
|
||||||
assertThat(properties.getPollingFrequency()).isEqualTo(config.pollingFrequency());
|
assertThat(properties.getPollingFrequency()).isEqualTo(config.pollingFrequency());
|
||||||
assertThat(properties.getQueueSize()).isEqualTo(config.queueSize());
|
|
||||||
assertThat(properties.isPublishUnchangedMeters())
|
assertThat(properties.isPublishUnchangedMeters())
|
||||||
.isEqualTo(config.publishUnchangedMeters());
|
.isEqualTo(config.publishUnchangedMeters());
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
|
|
||||||
package org.springframework.boot.actuate.metrics.cache;
|
package org.springframework.boot.actuate.metrics.cache;
|
||||||
|
|
||||||
import com.hazelcast.core.IMap;
|
|
||||||
import com.hazelcast.spring.cache.HazelcastCache;
|
import com.hazelcast.spring.cache.HazelcastCache;
|
||||||
import io.micrometer.core.instrument.Tag;
|
import io.micrometer.core.instrument.Tag;
|
||||||
import io.micrometer.core.instrument.binder.MeterBinder;
|
import io.micrometer.core.instrument.binder.MeterBinder;
|
||||||
|
@ -32,10 +31,8 @@ public class HazelcastCacheMeterBinderProvider
|
||||||
implements CacheMeterBinderProvider<HazelcastCache> {
|
implements CacheMeterBinderProvider<HazelcastCache> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public MeterBinder getMeterBinder(HazelcastCache cache, Iterable<Tag> tags) {
|
public MeterBinder getMeterBinder(HazelcastCache cache, Iterable<Tag> tags) {
|
||||||
return new HazelcastCacheMetrics((IMap<Object, Object>) cache.getNativeCache(),
|
return new HazelcastCacheMetrics(cache.getNativeCache(), tags);
|
||||||
tags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,8 @@ class HibernateJpaConfiguration extends JpaBaseConfiguration {
|
||||||
ImplicitNamingStrategy implicitNamingStrategy,
|
ImplicitNamingStrategy implicitNamingStrategy,
|
||||||
List<HibernatePropertiesCustomizer> hibernatePropertiesCustomizers) {
|
List<HibernatePropertiesCustomizer> hibernatePropertiesCustomizers) {
|
||||||
if (physicalNamingStrategy != null || implicitNamingStrategy != null) {
|
if (physicalNamingStrategy != null || implicitNamingStrategy != null) {
|
||||||
LinkedList<HibernatePropertiesCustomizer> customizers = new LinkedList<>(hibernatePropertiesCustomizers);
|
LinkedList<HibernatePropertiesCustomizer> customizers = new LinkedList<>(
|
||||||
|
hibernatePropertiesCustomizers);
|
||||||
customizers.addFirst(new NamingStrategiesHibernatePropertiesCustomizer(
|
customizers.addFirst(new NamingStrategiesHibernatePropertiesCustomizer(
|
||||||
physicalNamingStrategy, implicitNamingStrategy));
|
physicalNamingStrategy, implicitNamingStrategy));
|
||||||
return customizers;
|
return customizers;
|
||||||
|
@ -129,9 +130,9 @@ class HibernateJpaConfiguration extends JpaBaseConfiguration {
|
||||||
protected Map<String, Object> getVendorProperties() {
|
protected Map<String, Object> getVendorProperties() {
|
||||||
Supplier<String> defaultDdlMode = () -> this.defaultDdlAutoProvider
|
Supplier<String> defaultDdlMode = () -> this.defaultDdlAutoProvider
|
||||||
.getDefaultDdlAuto(getDataSource());
|
.getDefaultDdlAuto(getDataSource());
|
||||||
return new LinkedHashMap<>(getProperties()
|
return new LinkedHashMap<>(
|
||||||
.getHibernateProperties(new HibernateSettings().ddlAuto(defaultDdlMode)
|
getProperties().getHibernateProperties(new HibernateSettings()
|
||||||
.hibernatePropertiesCustomizers(
|
.ddlAuto(defaultDdlMode).hibernatePropertiesCustomizers(
|
||||||
this.hibernatePropertiesCustomizers)));
|
this.hibernatePropertiesCustomizers)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -278,10 +278,11 @@ public class HibernateJpaAutoConfigurationTests
|
||||||
contextRunner()
|
contextRunner()
|
||||||
.withUserConfiguration(TestPhysicalNamingStrategyConfiguration.class)
|
.withUserConfiguration(TestPhysicalNamingStrategyConfiguration.class)
|
||||||
.run((context) -> {
|
.run((context) -> {
|
||||||
Map<String, Object> hibernateProperties = context.getBean(
|
Map<String, Object> hibernateProperties = context
|
||||||
HibernateJpaConfiguration.class).getVendorProperties();
|
.getBean(HibernateJpaConfiguration.class)
|
||||||
assertThat(hibernateProperties).contains(
|
.getVendorProperties();
|
||||||
entry("hibernate.physical_naming_strategy",
|
assertThat(hibernateProperties)
|
||||||
|
.contains(entry("hibernate.physical_naming_strategy",
|
||||||
context.getBean("testPhysicalNamingStrategy")));
|
context.getBean("testPhysicalNamingStrategy")));
|
||||||
assertThat(hibernateProperties)
|
assertThat(hibernateProperties)
|
||||||
.doesNotContainKeys("hibernate.ejb.naming_strategy");
|
.doesNotContainKeys("hibernate.ejb.naming_strategy");
|
||||||
|
@ -293,10 +294,11 @@ public class HibernateJpaAutoConfigurationTests
|
||||||
contextRunner()
|
contextRunner()
|
||||||
.withUserConfiguration(TestImplicitNamingStrategyConfiguration.class)
|
.withUserConfiguration(TestImplicitNamingStrategyConfiguration.class)
|
||||||
.run((context) -> {
|
.run((context) -> {
|
||||||
Map<String, Object> hibernateProperties = context.getBean(
|
Map<String, Object> hibernateProperties = context
|
||||||
HibernateJpaConfiguration.class).getVendorProperties();
|
.getBean(HibernateJpaConfiguration.class)
|
||||||
assertThat(hibernateProperties).contains(
|
.getVendorProperties();
|
||||||
entry("hibernate.implicit_naming_strategy",
|
assertThat(hibernateProperties)
|
||||||
|
.contains(entry("hibernate.implicit_naming_strategy",
|
||||||
context.getBean("testImplicitNamingStrategy")));
|
context.getBean("testImplicitNamingStrategy")));
|
||||||
assertThat(hibernateProperties)
|
assertThat(hibernateProperties)
|
||||||
.doesNotContainKeys("hibernate.ejb.naming_strategy");
|
.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.physical-strategy:com.example.Physical",
|
||||||
"spring.jpa.hibernate.naming.implicit-strategy:com.example.Implicit")
|
"spring.jpa.hibernate.naming.implicit-strategy:com.example.Implicit")
|
||||||
.run((context) -> {
|
.run((context) -> {
|
||||||
Map<String, Object> hibernateProperties = context.getBean(
|
Map<String, Object> hibernateProperties = context
|
||||||
HibernateJpaConfiguration.class).getVendorProperties();
|
.getBean(HibernateJpaConfiguration.class)
|
||||||
|
.getVendorProperties();
|
||||||
assertThat(hibernateProperties).contains(
|
assertThat(hibernateProperties).contains(
|
||||||
entry("hibernate.physical_naming_strategy",
|
entry("hibernate.physical_naming_strategy",
|
||||||
context.getBean("testPhysicalNamingStrategy")),
|
context.getBean("testPhysicalNamingStrategy")),
|
||||||
|
@ -335,10 +338,12 @@ public class HibernateJpaAutoConfigurationTests
|
||||||
"spring.jpa.hibernate.naming.physical-strategy:com.example.Physical",
|
"spring.jpa.hibernate.naming.physical-strategy:com.example.Physical",
|
||||||
"spring.jpa.hibernate.naming.implicit-strategy:com.example.Implicit")
|
"spring.jpa.hibernate.naming.implicit-strategy:com.example.Implicit")
|
||||||
.run((context) -> {
|
.run((context) -> {
|
||||||
Map<String, Object> hibernateProperties = context.getBean(
|
Map<String, Object> hibernateProperties = context
|
||||||
HibernateJpaConfiguration.class).getVendorProperties();
|
.getBean(HibernateJpaConfiguration.class)
|
||||||
TestHibernatePropertiesCustomizerConfiguration configuration = context.getBean(
|
.getVendorProperties();
|
||||||
TestHibernatePropertiesCustomizerConfiguration.class);
|
TestHibernatePropertiesCustomizerConfiguration configuration = context
|
||||||
|
.getBean(
|
||||||
|
TestHibernatePropertiesCustomizerConfiguration.class);
|
||||||
assertThat(hibernateProperties).contains(
|
assertThat(hibernateProperties).contains(
|
||||||
entry("hibernate.physical_naming_strategy",
|
entry("hibernate.physical_naming_strategy",
|
||||||
configuration.physicalNamingStrategy),
|
configuration.physicalNamingStrategy),
|
||||||
|
@ -349,7 +354,6 @@ public class HibernateJpaAutoConfigurationTests
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@TestAutoConfigurationPackage(City.class)
|
@TestAutoConfigurationPackage(City.class)
|
||||||
static class TestInitializedJpaConfiguration {
|
static class TestInitializedJpaConfiguration {
|
||||||
|
|
Loading…
Reference in New Issue