Closes gh-12981
pull/13061/head
Johnny Lim 7 years ago committed by Stephane Nicoll
parent f2d8ca8b3a
commit b941c5f1a6

@ -47,7 +47,7 @@ public class ReactiveWebServerFactoryAutoConfigurationTests {
@Test @Test
public void createFromConfigClass() { public void createFromConfigClass() {
this.contextRunner.withUserConfiguration(MockWebServerAutoConfiguration.class, this.contextRunner.withUserConfiguration(MockWebServerConfiguration.class,
HttpHandlerConfiguration.class).run((context) -> { HttpHandlerConfiguration.class).run((context) -> {
assertThat(context.getBeansOfType(ReactiveWebServerFactory.class)) assertThat(context.getBeansOfType(ReactiveWebServerFactory.class))
.hasSize(1); .hasSize(1);
@ -61,7 +61,7 @@ public class ReactiveWebServerFactoryAutoConfigurationTests {
@Test @Test
public void missingHttpHandler() { public void missingHttpHandler() {
this.contextRunner.withUserConfiguration(MockWebServerAutoConfiguration.class) this.contextRunner.withUserConfiguration(MockWebServerConfiguration.class)
.run((context) -> assertThat(context.getStartupFailure()) .run((context) -> assertThat(context.getStartupFailure())
.isInstanceOf(ApplicationContextException.class) .isInstanceOf(ApplicationContextException.class)
.hasMessageContaining("missing HttpHandler bean")); .hasMessageContaining("missing HttpHandler bean"));
@ -70,7 +70,7 @@ public class ReactiveWebServerFactoryAutoConfigurationTests {
@Test @Test
public void multipleHttpHandler() { public void multipleHttpHandler() {
this.contextRunner this.contextRunner
.withUserConfiguration(MockWebServerAutoConfiguration.class, .withUserConfiguration(MockWebServerConfiguration.class,
HttpHandlerConfiguration.class, TooManyHttpHandlers.class) HttpHandlerConfiguration.class, TooManyHttpHandlers.class)
.run((context) -> assertThat(context.getStartupFailure()) .run((context) -> assertThat(context.getStartupFailure())
.isInstanceOf(ApplicationContextException.class) .isInstanceOf(ApplicationContextException.class)
@ -80,7 +80,7 @@ public class ReactiveWebServerFactoryAutoConfigurationTests {
@Test @Test
public void customizeReactiveWebServer() { public void customizeReactiveWebServer() {
this.contextRunner.withUserConfiguration(MockWebServerAutoConfiguration.class, this.contextRunner.withUserConfiguration(MockWebServerConfiguration.class,
HttpHandlerConfiguration.class, ReactiveWebServerCustomization.class) HttpHandlerConfiguration.class, ReactiveWebServerCustomization.class)
.run((context) -> assertThat( .run((context) -> assertThat(
context.getBean(MockReactiveWebServerFactory.class).getPort()) context.getBean(MockReactiveWebServerFactory.class).getPort())
@ -128,7 +128,7 @@ public class ReactiveWebServerFactoryAutoConfigurationTests {
} }
@Configuration @Configuration
public static class MockWebServerAutoConfiguration { public static class MockWebServerConfiguration {
@Bean @Bean
public MockReactiveWebServerFactory mockReactiveWebServerFactory() { public MockReactiveWebServerFactory mockReactiveWebServerFactory() {

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -66,7 +66,7 @@ public class OptionalLiveReloadServer implements InitializingBean {
} }
/** /**
* Trigger LiveReload if the server is up an running. * Trigger LiveReload if the server is up and running.
*/ */
public void triggerReload() { public void triggerReload() {
if (this.server != null) { if (this.server != null) {

@ -782,7 +782,7 @@ content into your application. Rather, pick only the properties that you need.
spring.jta.atomikos.datasource.xa-data-source-class-name= # Vendor-specific implementation of XAConnectionFactory. spring.jta.atomikos.datasource.xa-data-source-class-name= # Vendor-specific implementation of XAConnectionFactory.
spring.jta.atomikos.datasource.xa-properties= # Vendor-specific XA properties. spring.jta.atomikos.datasource.xa-properties= # Vendor-specific XA properties.
spring.jta.atomikos.properties.allow-sub-transactions=true # Specify whether sub-transactions are allowed. spring.jta.atomikos.properties.allow-sub-transactions=true # Specify whether sub-transactions are allowed.
spring.jta.atomikos.properties.checkpoint-interval=500 # Interval between checkpoints, expressed as the number of log writes between two checkpoint. spring.jta.atomikos.properties.checkpoint-interval=500 # Interval between checkpoints, expressed as the number of log writes between two checkpoints.
spring.jta.atomikos.properties.default-jta-timeout=10000ms # Default timeout for JTA transactions. spring.jta.atomikos.properties.default-jta-timeout=10000ms # Default timeout for JTA transactions.
spring.jta.atomikos.properties.default-max-wait-time-on-shutdown=9223372036854775807 # How long should normal shutdown (no-force) wait for transactions to complete. spring.jta.atomikos.properties.default-max-wait-time-on-shutdown=9223372036854775807 # How long should normal shutdown (no-force) wait for transactions to complete.
spring.jta.atomikos.properties.enable-logging=true # Whether to enable disk logging. spring.jta.atomikos.properties.enable-logging=true # Whether to enable disk logging.

@ -1216,7 +1216,7 @@ If the `dev` profile is enabled, however, `map` contains two entries with keys `
(with a name of `dev name 1` and a description of `my description 1`) and (with a name of `dev name 1` and a description of `my description 1`) and
`key2` (with a name of `dev name 2` and a description of `dev description 2`). `key2` (with a name of `dev name 2` and a description of `dev description 2`).
NOTE: The preceeding merging rules apply to properties from all property sources and not just NOTE: The preceding merging rules apply to properties from all property sources and not just
YAML files. YAML files.
[[boot-features-external-config-conversion]] [[boot-features-external-config-conversion]]

@ -72,11 +72,11 @@ public class ApplicationConversionService extends FormattingConversionService {
} }
/** /**
* Configure the given {@link FormatterRegistry} with formatters and converts * Configure the given {@link FormatterRegistry} with formatters and converters
* appropriate for most Spring Boot applications. * appropriate for most Spring Boot applications.
* @param registry the registry of converters to add to (must also be castable to * @param registry the registry of converters to add to (must also be castable to
* ConversionService, e.g. being a {@link ConfigurableConversionService}) * ConversionService, e.g. being a {@link ConfigurableConversionService})
* @throws ClassCastException if the given ConverterRegistry could not be cast to a * @throws ClassCastException if the given FormatterRegistry could not be cast to a
* ConversionService * ConversionService
*/ */
public static void configure(FormatterRegistry registry) { public static void configure(FormatterRegistry registry) {
@ -88,7 +88,6 @@ public class ApplicationConversionService extends FormattingConversionService {
/** /**
* Add converters useful for most Spring Boot applications. * Add converters useful for most Spring Boot applications.
* {@link DefaultConversionService#addDefaultConverters(ConverterRegistry)}
* @param registry the registry of converters to add to (must also be castable to * @param registry the registry of converters to add to (must also be castable to
* ConversionService, e.g. being a {@link ConfigurableConversionService}) * ConversionService, e.g. being a {@link ConfigurableConversionService})
* @throws ClassCastException if the given ConverterRegistry could not be cast to a * @throws ClassCastException if the given ConverterRegistry could not be cast to a

@ -32,7 +32,7 @@ import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
/** /**
* Configure the HTTP compression on an Reactor Netty request/response handler. * Configure the HTTP compression on a Reactor Netty request/response handler.
* *
* @author Stephane Maldini * @author Stephane Maldini
* @author Phillip Webb * @author Phillip Webb

@ -85,16 +85,16 @@ class ApplicationBuilder {
if (resourcesJar.exists()) { if (resourcesJar.exists()) {
return resourcesJar; return resourcesJar;
} }
JarOutputStream resourcesJarStream = new JarOutputStream( try (JarOutputStream resourcesJarStream = new JarOutputStream(
new FileOutputStream(resourcesJar)); new FileOutputStream(resourcesJar))) {
resourcesJarStream.putNextEntry(new ZipEntry("META-INF/resources/")); resourcesJarStream.putNextEntry(new ZipEntry("META-INF/resources/"));
resourcesJarStream.closeEntry(); resourcesJarStream.closeEntry();
resourcesJarStream.putNextEntry( resourcesJarStream.putNextEntry(
new ZipEntry("META-INF/resources/nested-meta-inf-resource.txt")); new ZipEntry("META-INF/resources/nested-meta-inf-resource.txt"));
resourcesJarStream.write("nested".getBytes()); resourcesJarStream.write("nested".getBytes());
resourcesJarStream.closeEntry(); resourcesJarStream.closeEntry();
resourcesJarStream.close(); return resourcesJar;
return resourcesJar; }
} }
private void writePom(File appFolder, File resourcesJar) throws IOException { private void writePom(File appFolder, File resourcesJar) throws IOException {
@ -103,11 +103,12 @@ class ApplicationBuilder {
context.put("container", this.container); context.put("container", this.container);
context.put("bootVersion", Versions.getBootVersion()); context.put("bootVersion", Versions.getBootVersion());
context.put("resourcesJarPath", resourcesJar.getAbsolutePath()); context.put("resourcesJarPath", resourcesJar.getAbsolutePath());
FileWriter out = new FileWriter(new File(appFolder, "pom.xml")); try (FileWriter out = new FileWriter(new File(appFolder, "pom.xml"));
Mustache.compiler().escapeHTML(false) FileReader templateReader = new FileReader("src/test/resources/pom-template.xml")) {
.compile(new FileReader("src/test/resources/pom-template.xml")) Mustache.compiler().escapeHTML(false)
.execute(context, out); .compile(templateReader)
out.close(); .execute(context, out);
}
} }
private File writeSettingsXml(File appFolder) throws IOException { private File writeSettingsXml(File appFolder) throws IOException {
@ -118,9 +119,10 @@ class ApplicationBuilder {
Map<String, Object> context = new HashMap<>(); Map<String, Object> context = new HashMap<>();
context.put("repository", repository); context.put("repository", repository);
File settingsXml = new File(appFolder, "settings.xml"); File settingsXml = new File(appFolder, "settings.xml");
try (FileWriter out = new FileWriter(settingsXml)) { try (FileWriter out = new FileWriter(settingsXml);
FileReader templateReader = new FileReader("src/test/resources/settings-template.xml")) {
Mustache.compiler().escapeHTML(false) Mustache.compiler().escapeHTML(false)
.compile(new FileReader("src/test/resources/settings-template.xml")) .compile(templateReader)
.execute(context, out); .execute(context, out);
} }
return settingsXml; return settingsXml;

Loading…
Cancel
Save