Merge branch '2.0.x'
This commit is contained in:
commit
b17c58b114
|
@ -64,22 +64,24 @@ public class FreeMarkerAutoConfiguration {
|
|||
|
||||
@PostConstruct
|
||||
public void checkTemplateLocationExists() {
|
||||
if (this.properties.isCheckTemplateLocation()) {
|
||||
TemplateLocation templatePathLocation = null;
|
||||
List<TemplateLocation> locations = new ArrayList<>();
|
||||
for (String templateLoaderPath : this.properties.getTemplateLoaderPath()) {
|
||||
TemplateLocation location = new TemplateLocation(templateLoaderPath);
|
||||
locations.add(location);
|
||||
if (location.exists(this.applicationContext)) {
|
||||
templatePathLocation = location;
|
||||
break;
|
||||
if (logger.isWarnEnabled()) {
|
||||
if (this.properties.isCheckTemplateLocation()) {
|
||||
TemplateLocation templatePathLocation = null;
|
||||
List<TemplateLocation> locations = new ArrayList<>();
|
||||
for (String templateLoaderPath : this.properties.getTemplateLoaderPath()) {
|
||||
TemplateLocation location = new TemplateLocation(templateLoaderPath);
|
||||
locations.add(location);
|
||||
if (location.exists(this.applicationContext)) {
|
||||
templatePathLocation = location;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (templatePathLocation == null) {
|
||||
logger.warn("Cannot find template location(s): " + locations
|
||||
+ " (please add some templates, "
|
||||
+ "check your FreeMarker configuration, or set "
|
||||
+ "spring.freemarker.checkTemplateLocation=false)");
|
||||
}
|
||||
}
|
||||
if (templatePathLocation == null) {
|
||||
logger.warn("Cannot find template location(s): " + locations
|
||||
+ " (please add some templates, "
|
||||
+ "check your FreeMarker configuration, or set "
|
||||
+ "spring.freemarker.checkTemplateLocation=false)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public class DispatcherServletAutoConfigurationTests {
|
|||
assertThat(context.getBean(DispatcherServlet.class)).isNotNull();
|
||||
ServletRegistrationBean<?> registration = context
|
||||
.getBean(ServletRegistrationBean.class);
|
||||
assertThat(registration.getUrlMappings().toString()).isEqualTo("[/]");
|
||||
assertThat(registration.getUrlMappings()).containsExactly("/");
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -72,11 +72,11 @@ public class DispatcherServletAutoConfigurationTests {
|
|||
// from the default one, we're registering one anyway
|
||||
@Test
|
||||
public void registrationOverrideWithDispatcherServletWrongName() {
|
||||
this.contextRunner.withUserConfiguration(CustomDispatcherServletWrongName.class)
|
||||
this.contextRunner.withUserConfiguration(CustomDispatcherServletDifferentName.class)
|
||||
.run((context) -> {
|
||||
ServletRegistrationBean<?> registration = context
|
||||
.getBean(ServletRegistrationBean.class);
|
||||
assertThat(registration.getUrlMappings().toString()).isEqualTo("[/]");
|
||||
assertThat(registration.getUrlMappings()).containsExactly("/");
|
||||
assertThat(registration.getServletName())
|
||||
.isEqualTo("dispatcherServlet");
|
||||
assertThat(context).getBeanNames(DispatcherServlet.class).hasSize(2);
|
||||
|
@ -89,8 +89,8 @@ public class DispatcherServletAutoConfigurationTests {
|
|||
.run((context) -> {
|
||||
ServletRegistrationBean<?> registration = context
|
||||
.getBean(ServletRegistrationBean.class);
|
||||
assertThat(registration.getUrlMappings().toString())
|
||||
.isEqualTo("[/foo]");
|
||||
assertThat(registration.getUrlMappings())
|
||||
.containsExactly("/foo");
|
||||
assertThat(registration.getServletName())
|
||||
.isEqualTo("customDispatcher");
|
||||
assertThat(context).hasSingleBean(DispatcherServlet.class);
|
||||
|
@ -104,8 +104,8 @@ public class DispatcherServletAutoConfigurationTests {
|
|||
assertThat(context.getBean(DispatcherServlet.class)).isNotNull();
|
||||
ServletRegistrationBean<?> registration = context
|
||||
.getBean(ServletRegistrationBean.class);
|
||||
assertThat(registration.getUrlMappings().toString())
|
||||
.isEqualTo("[/spring/*]");
|
||||
assertThat(registration.getUrlMappings())
|
||||
.containsExactly("/spring/*");
|
||||
assertThat(registration.getMultipartConfig()).isNull();
|
||||
assertThat(context.getBean(DispatcherServletPathProvider.class)
|
||||
.getServletPath()).isEqualTo("/spring");
|
||||
|
@ -189,7 +189,7 @@ public class DispatcherServletAutoConfigurationTests {
|
|||
}
|
||||
|
||||
@Configuration
|
||||
protected static class CustomDispatcherServletWrongName {
|
||||
protected static class CustomDispatcherServletDifferentName {
|
||||
|
||||
@Bean
|
||||
public DispatcherServlet customDispatcherServlet() {
|
||||
|
|
|
@ -1420,7 +1420,6 @@ content into your application. Rather, pick only the properties that you need.
|
|||
management.metrics.export.statsd.polling-frequency=10s # How often gauges will be polled. When a gauge is polled, its value is recalculated and if the value has changed (or publishUnchangedMeters is true), it is sent to the StatsD server.
|
||||
management.metrics.export.statsd.port=8125 # Port of the StatsD server to receive exported metrics.
|
||||
management.metrics.export.statsd.publish-unchanged-meters=true # Whether to send unchanged meters to the StatsD server.
|
||||
management.metrics.export.statsd.queue-size=2147483647 # Maximum size of the queue of items waiting to be sent to the StatsD server.
|
||||
management.metrics.export.wavefront.api-token= # API token used when publishing metrics directly to the Wavefront API host.
|
||||
management.metrics.export.wavefront.batch-size=10000 # Number of measurements per request to use for this backend. If more measurements are found, then multiple requests will be made.
|
||||
management.metrics.export.wavefront.connect-timeout=1s # Connection timeout for requests to this backend.
|
||||
|
|
|
@ -1619,7 +1619,7 @@ environment that forwards metrics data to the Wavefront API host:
|
|||
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
management.metrics.export.uri=proxy://localhost:2878
|
||||
management.metrics.export.wavefront.uri=proxy://localhost:2878
|
||||
----
|
||||
|
||||
TIP: If publishing metrics to a Wavefront proxy (as described in
|
||||
|
|
|
@ -17,7 +17,9 @@
|
|||
package org.springframework.boot.configurationmetadata;
|
||||
|
||||
import java.text.BreakIterator;
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Utility to extract the first sentence of a text.
|
||||
|
@ -45,11 +47,7 @@ class SentenceExtractor {
|
|||
|
||||
private String removeSpaceBetweenLine(String text) {
|
||||
String[] lines = text.split(System.lineSeparator());
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String line : lines) {
|
||||
sb.append(line.trim()).append(" ");
|
||||
}
|
||||
return sb.toString().trim();
|
||||
return Arrays.stream(lines).map(String::trim).collect(Collectors.joining(" "));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public class ZipHeaderPeekInputStreamTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void hasZipHeaderReturnsFalseWheStreamDoesNotStartWithZipHeader()
|
||||
public void hasZipHeaderReturnsFalseWhenStreamDoesNotStartWithZipHeader()
|
||||
throws IOException {
|
||||
try (ZipHeaderPeekInputStream in = new ZipHeaderPeekInputStream(
|
||||
new ByteArrayInputStream(new byte[] { 0, 1, 2, 3, 4, 5 }))) {
|
||||
|
|
|
@ -496,7 +496,7 @@ public class JarFileTests {
|
|||
.openConnection().getInputStream().close();
|
||||
this.thrown.expect(FileNotFoundException.class);
|
||||
new URL(context, "jar:" + this.rootJarFile.toURI() + "!/no.dat")
|
||||
.openConnection().getInputStream().close();
|
||||
.openConnection().getInputStream();
|
||||
}
|
||||
finally {
|
||||
JarURLConnection.setUseFastExceptions(false);
|
||||
|
|
|
@ -252,8 +252,7 @@ public class Binder {
|
|||
}
|
||||
|
||||
private <T> Object bindObject(ConfigurationPropertyName name, Bindable<T> target,
|
||||
BindHandler handler, Context context, boolean allowRecursiveBinding)
|
||||
throws Exception {
|
||||
BindHandler handler, Context context, boolean allowRecursiveBinding) {
|
||||
ConfigurationProperty property = findProperty(name, context);
|
||||
if (property == null && containsNoDescendantOf(context.streamSources(), name)) {
|
||||
return null;
|
||||
|
|
|
@ -414,7 +414,7 @@ public class CollectionBinderTests {
|
|||
this.sources.add(source);
|
||||
Bindable<ClonedArrayBean> target = Bindable.of(ClonedArrayBean.class);
|
||||
ClonedArrayBean bean = this.binder.bind("foo", target).get();
|
||||
assertThat(bean.getBar()).contains("hello");
|
||||
assertThat(bean.getBar()).containsExactly("hello");
|
||||
}
|
||||
|
||||
public static class ExampleCollectionBean {
|
||||
|
|
Loading…
Reference in New Issue