Skip to content
Closed

Polish #14184

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ application.

[[deployment-whats-next]]
== What to Read Next
Check out the https://www.cloudfoundry.com/[Cloud Foundry],
Check out the https://www.cloudfoundry.org/[Cloud Foundry],
https://www.heroku.com/[Heroku], https://www.openshift.com[OpenShift], and
https://boxfuse.com[Boxfuse] web sites for more information about the kinds of features
that a PaaS can offer. These are just four of the most popular Java PaaS providers. Since
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2055,7 +2055,7 @@ converters. You can also override default converters in the same way.
==== Custom JSON Serializers and Deserializers
If you use Jackson to serialize and deserialize JSON data, you might want to write your
own `JsonSerializer` and `JsonDeserializer` classes. Custom serializers are usually
http://wiki.fasterxml.com/JacksonHowToCustomDeserializers[registered with Jackson through
https://github.com/FasterXML/jackson-docs/wiki/JacksonHowToCustomSerializers[registered with Jackson through
a module], but Spring Boot provides an alternative `@JsonComponent` annotation that makes
it easier to directly register Spring Beans.

Expand Down Expand Up @@ -5785,7 +5785,7 @@ Finally, the most extreme (and rarely used) option is to create your own
== Calling REST Services with `WebClient`
If you have Spring WebFlux on your classpath, you can also choose to use `WebClient` to
call remote REST services. Compared to `RestTemplate`, this client has a more functional
feel and is fully reactive. You can leanr more about the `WebClient` in the dedicated
feel and is fully reactive. You can learn more about the `WebClient` in the dedicated
{spring-reference}web-reactive.html#webflux-client[section in the Spring Framework docs].

Spring Boot creates and pre-configures a `WebClient.Builder` for you; it is strongly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@ authors.
The `spring-boot-devtools` module includes an embedded LiveReload server that can be used
to trigger a browser refresh when a resource is changed. LiveReload browser extensions
are freely available for Chrome, Firefox and Safari from
https://livereload.com/extensions/[livereload.com].
http://livereload.com/extensions/[livereload.com].

If you do not want to start the LiveReload server when your application runs, you can set
the `spring.devtools.livereload.enabled` property to `false`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,8 @@ private void removePropertySources(MutablePropertySources propertySources,
names.add(propertySource.getName());
}
for (String name : names) {
if (!isServletEnvironment) {
propertySources.remove(name);
}
else if (!SERVLET_ENVIRONMENT_SOURCE_NAMES.contains(name)) {
if (!isServletEnvironment
|| !SERVLET_ENVIRONMENT_SOURCE_NAMES.contains(name)) {
propertySources.remove(name);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,13 +376,14 @@ private ConfigurableEnvironment prepareEnvironment(
}

private Class<? extends StandardEnvironment> deduceEnvironmentClass() {
if (this.webApplicationType == WebApplicationType.SERVLET) {
switch (this.webApplicationType) {
case SERVLET:
return StandardServletEnvironment.class;
}
if (this.webApplicationType == WebApplicationType.REACTIVE) {
case REACTIVE:
return StandardReactiveWebEnvironment.class;
default:
return StandardEnvironment.class;
}
return StandardEnvironment.class;
}

private void prepareContext(ConfigurableApplicationContext context,
Expand Down Expand Up @@ -479,13 +480,14 @@ private ConfigurableEnvironment getOrCreateEnvironment() {
if (this.environment != null) {
return this.environment;
}
if (this.webApplicationType == WebApplicationType.SERVLET) {
switch (this.webApplicationType) {
case SERVLET:
return new StandardServletEnvironment();
}
if (this.webApplicationType == WebApplicationType.REACTIVE) {
case REACTIVE:
return new StandardReactiveWebEnvironment();
default:
return new StandardEnvironment();
}
return new StandardEnvironment();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1124,29 +1124,29 @@ public void nonWebApplicationConfiguredViaAPropertyHasTheCorrectTypeOfContextAnd
public void webApplicationConfiguredViaAPropertyHasTheCorrectTypeOfContextAndEnvironment() {
ConfigurableApplicationContext context = new SpringApplication(
ExampleWebConfig.class).run("--spring.main.web-application-type=servlet");
assertThat(context).isInstanceOfAny(WebApplicationContext.class);
assertThat(context).isInstanceOf(WebApplicationContext.class);
assertThat(context.getEnvironment())
.isInstanceOfAny(StandardServletEnvironment.class);
.isInstanceOf(StandardServletEnvironment.class);
}

@Test
public void reactiveApplicationConfiguredViaAPropertyHasTheCorrectTypeOfContextAndEnvironment() {
ConfigurableApplicationContext context = new SpringApplication(
ExampleReactiveWebConfig.class)
.run("--spring.main.web-application-type=reactive");
assertThat(context).isInstanceOfAny(ReactiveWebApplicationContext.class);
assertThat(context).isInstanceOf(ReactiveWebApplicationContext.class);
assertThat(context.getEnvironment())
.isInstanceOfAny(StandardReactiveWebEnvironment.class);
.isInstanceOf(StandardReactiveWebEnvironment.class);
}

@Test
public void environmentIsConvertedIfTypeDoesNotMatch() {
ConfigurableApplicationContext context = new SpringApplication(
ExampleReactiveWebConfig.class)
.run("--spring.profiles.active=withwebapplicationtype");
assertThat(context).isInstanceOfAny(ReactiveWebApplicationContext.class);
assertThat(context).isInstanceOf(ReactiveWebApplicationContext.class);
assertThat(context.getEnvironment())
.isInstanceOfAny(StandardReactiveWebEnvironment.class);
.isInstanceOf(StandardReactiveWebEnvironment.class);
}

@Test
Expand Down