Merge branch '2.0.x'

pull/13117/head
Andy Wilkinson 7 years ago
commit a41c9eb736

@ -21,6 +21,7 @@ import java.time.Duration;
import io.micrometer.statsd.StatsdFlavor;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
/**
* {@link ConfigurationProperties} for configuring StatsD metrics export.
@ -122,10 +123,13 @@ public class StatsdProperties {
this.pollingFrequency = pollingFrequency;
}
@Deprecated
@DeprecatedConfigurationProperty(reason = "No longer configurable and an unbounded queue will always be used")
public Integer getQueueSize() {
return this.queueSize;
}
@Deprecated
public void setQueueSize(Integer queueSize) {
this.queueSize = queueSize;
}

@ -74,6 +74,7 @@ public class StatsdPropertiesConfigAdapter
}
@Override
@Deprecated
public int queueSize() {
return get(StatsdProperties::getQueueSize, StatsdConfig.super::queueSize);
}

@ -280,7 +280,10 @@
},
{
"name": "management.metrics.export.statsd.queue-size",
"defaultValue": 2147483647
"defaultValue": 2147483647,
"deprecation": {
"level": "error"
}
},
{
"name": "management.trace.http.enabled",

@ -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));
}
}

@ -38,7 +38,6 @@ public class StatsdPropertiesTests {
assertThat(properties.getPort()).isEqualTo(config.port());
assertThat(properties.getMaxPacketLength()).isEqualTo(config.maxPacketLength());
assertThat(properties.getPollingFrequency()).isEqualTo(config.pollingFrequency());
assertThat(properties.getQueueSize()).isEqualTo(config.queueSize());
assertThat(properties.isPublishUnchangedMeters())
.isEqualTo(config.publishUnchangedMeters());
}

@ -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…
Cancel
Save