Merge pull request #11126 from Johnny Lim

* gh-11126:
  Polish
This commit is contained in:
Andy Wilkinson 2017-11-23 16:00:59 +00:00
commit 3b1d2b0733
13 changed files with 18 additions and 26 deletions

View File

@ -22,8 +22,8 @@ import org.springframework.boot.actuate.endpoint.web.EndpointPathResolver;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
/** /**
* Default {@link EndpointPathResolver} implementation that use the {@link Environment} to * Default {@link EndpointPathResolver} implementation that uses the {@link Environment}
* determine if an endpoint has a custom path. * to determine if an endpoint has a custom path.
* *
* @author Stephane Nicoll * @author Stephane Nicoll
*/ */

View File

@ -63,7 +63,7 @@ public class ThymeleafProperties {
private String suffix = DEFAULT_SUFFIX; private String suffix = DEFAULT_SUFFIX;
/** /**
* Template mode to be applied to templates. See also Thymleaf's TemplateMode enum. * Template mode to be applied to templates. See also Thymeleaf's TemplateMode enum.
*/ */
private String mode = "HTML"; private String mode = "HTML";

View File

@ -136,8 +136,7 @@ public class MongoClientFactoryTests {
Cluster cluster = (Cluster) ReflectionTestUtils.getField(client, "cluster"); Cluster cluster = (Cluster) ReflectionTestUtils.getField(client, "cluster");
ClusterSettings clusterSettings = (ClusterSettings) ReflectionTestUtils ClusterSettings clusterSettings = (ClusterSettings) ReflectionTestUtils
.getField(cluster, "settings"); .getField(cluster, "settings");
List<ServerAddress> allAddresses = clusterSettings.getHosts(); return clusterSettings.getHosts();
return allAddresses;
} }
private void assertServerAddress(ServerAddress serverAddress, String expectedHost, private void assertServerAddress(ServerAddress serverAddress, String expectedHost,

View File

@ -163,8 +163,7 @@ public class MongoPropertiesTests {
Cluster cluster = (Cluster) ReflectionTestUtils.getField(client, "cluster"); Cluster cluster = (Cluster) ReflectionTestUtils.getField(client, "cluster");
ClusterSettings clusterSettings = (ClusterSettings) ReflectionTestUtils ClusterSettings clusterSettings = (ClusterSettings) ReflectionTestUtils
.getField(cluster, "settings"); .getField(cluster, "settings");
List<ServerAddress> allAddresses = clusterSettings.getHosts(); return clusterSettings.getHosts();
return allAddresses;
} }
private void assertServerAddress(ServerAddress serverAddress, String expectedHost, private void assertServerAddress(ServerAddress serverAddress, String expectedHost,

View File

@ -175,8 +175,7 @@ public class ReactiveMongoClientFactoryTests {
private List<ServerAddress> extractServerAddresses(MongoClient client) { private List<ServerAddress> extractServerAddresses(MongoClient client) {
MongoClientSettings settings = client.getSettings(); MongoClientSettings settings = client.getSettings();
ClusterSettings clusterSettings = settings.getClusterSettings(); ClusterSettings clusterSettings = settings.getClusterSettings();
List<ServerAddress> allAddresses = clusterSettings.getHosts(); return clusterSettings.getHosts();
return allAddresses;
} }
private List<MongoCredential> extractMongoCredentials(MongoClient client) { private List<MongoCredential> extractMongoCredentials(MongoClient client) {

View File

@ -18,9 +18,7 @@ package org.springframework.boot.autoconfigure.web;
import java.time.Duration; import java.time.Duration;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.springframework.boot.autoconfigure.web.ResourceProperties.Cache; import org.springframework.boot.autoconfigure.web.ResourceProperties.Cache;
import org.springframework.boot.testsupport.assertj.Matched; import org.springframework.boot.testsupport.assertj.Matched;
@ -39,9 +37,6 @@ public class ResourcePropertiesTests {
private final ResourceProperties properties = new ResourceProperties(); private final ResourceProperties properties = new ResourceProperties();
@Rule
public ExpectedException thrown = ExpectedException.none();
@Test @Test
public void resourceChainNoCustomization() { public void resourceChainNoCustomization() {
assertThat(this.properties.getChain().getEnabled()).isNull(); assertThat(this.properties.getChain().getEnabled()).isNull();

View File

@ -469,7 +469,7 @@ content into your application. Rather, pick only the properties that you need.
spring.thymeleaf.enable-spring-el-compiler=false # Enable the SpringEL compiler in SpringEL expressions. spring.thymeleaf.enable-spring-el-compiler=false # Enable the SpringEL compiler in SpringEL expressions.
spring.thymeleaf.encoding=UTF-8 # Template files encoding. spring.thymeleaf.encoding=UTF-8 # Template files encoding.
spring.thymeleaf.excluded-view-names= # Comma-separated list of view names that should be excluded from resolution. spring.thymeleaf.excluded-view-names= # Comma-separated list of view names that should be excluded from resolution.
spring.thymeleaf.mode=HTML5 # Template mode to be applied to templates. See also Thymleaf's TemplateMode enum. spring.thymeleaf.mode=HTML5 # Template mode to be applied to templates. See also Thymeleaf's TemplateMode enum.
spring.thymeleaf.prefix=classpath:/templates/ # Prefix that gets prepended to view names when building a URL. spring.thymeleaf.prefix=classpath:/templates/ # Prefix that gets prepended to view names when building a URL.
spring.thymeleaf.reactive.chunked-mode-view-names= # Comma-separated list of view names (patterns allowed) that should be the only ones executed in CHUNKED mode when a max chunk size is set. spring.thymeleaf.reactive.chunked-mode-view-names= # Comma-separated list of view names (patterns allowed) that should be the only ones executed in CHUNKED mode when a max chunk size is set.
spring.thymeleaf.reactive.full-mode-view-names= # Comma-separated list of view names (patterns allowed) that should be executed in FULL mode even if a max chunk size is set. spring.thymeleaf.reactive.full-mode-view-names= # Comma-separated list of view names (patterns allowed) that should be executed in FULL mode even if a max chunk size is set.

View File

@ -183,7 +183,7 @@ register an `EndpointFilter` bean.
=== Securing HTTP Endpoints === Securing HTTP Endpoints
You should take care to secure HTTP endpoints in the same way that you would any other You should take care to secure HTTP endpoints in the same way that you would any other
sensitive URL. Spring Boot will not apply any security on your behalf, however, it does sensitive URL. Spring Boot will not apply any security on your behalf, however, it does
provide some convenient `RequestMatcher`s that can be used in combination with Spring provide some convenient ``RequestMatcher``s that can be used in combination with Spring
Security. Security.
A typical Spring Security configuration could look something like this: A typical Spring Security configuration could look something like this:

View File

@ -132,7 +132,7 @@ Maven or Gradle would but without requiring you to use a build tool.
Spring Boot extends this technique further and tries to deduce which libraries to "`grab`" Spring Boot extends this technique further and tries to deduce which libraries to "`grab`"
based on your code. For example, since the `WebApplication` code shown previously uses based on your code. For example, since the `WebApplication` code shown previously uses
`@RestController` annotations, Spring Boot grabs"`Tomcat`" and "`Spring MVC`". `@RestController` annotations, Spring Boot grabs "Tomcat" and "Spring MVC".
The following items are used as "`grab hints`": The following items are used as "`grab hints`":
@ -254,7 +254,7 @@ line:
[source,java,indent=0] [source,java,indent=0]
---- ----
`@DependencyManagementBom('io.spring.platform:platform-bom:1.1.2.RELEASE')`. @DependencyManagementBom('io.spring.platform:platform-bom:1.1.2.RELEASE')
---- ----

View File

@ -1596,8 +1596,8 @@ configuration (for example, `logback-spring.xml` rather than `logback.xml`). If
standard configuration locations, Spring cannot completely control log initialization. standard configuration locations, Spring cannot completely control log initialization.
WARNING: There are known classloading issues with Java Util Logging that cause problems WARNING: There are known classloading issues with Java Util Logging that cause problems
when running from an '`executable jar`'. We recommend that you avoid it when running from when running from an 'executable jar'. We recommend that you avoid it when running from
an '`executable jar`'if at all possible. an 'executable jar' if at all possible.
To help with the customization, some other properties are transferred from the Spring To help with the customization, some other properties are transferred from the Spring
`Environment` to System properties, as described in the following table: `Environment` to System properties, as described in the following table:
@ -5949,7 +5949,7 @@ To test that object JSON serialization and deserialization is working as expecte
use the `@JsonTest` annotation. `@JsonTest` auto-configures the available supported JSON use the `@JsonTest` annotation. `@JsonTest` auto-configures the available supported JSON
mapper, which can be one of the following libraries: mapper, which can be one of the following libraries:
* Jackson `ObjectMapper`, any `@JsonComponent` beans and any Jackson `Modules` * Jackson `ObjectMapper`, any `@JsonComponent` beans and any Jackson ``Module``s
* `Gson` * `Gson`
* `Jsonb` * `Jsonb`
@ -6215,7 +6215,7 @@ bean, which provides an alternative to the standard JPA `EntityManager` that is
specifically designed for tests. If you want to use `TestEntityManager` outside of specifically designed for tests. If you want to use `TestEntityManager` outside of
`@DataJpaTest` instances, you can also use the `@AutoConfigureTestEntityManager` `@DataJpaTest` instances, you can also use the `@AutoConfigureTestEntityManager`
annotation. A `JdbcTemplate` is also available if you need that. The following example annotation. A `JdbcTemplate` is also available if you need that. The following example
shows the `@DataJpaTest`annotation in use: shows the `@DataJpaTest` annotation in use:
[source,java,indent=0] [source,java,indent=0]
---- ----

View File

@ -14,7 +14,7 @@
<description>Spring Boot Parent</description> <description>Spring Boot Parent</description>
<organization> <organization>
<name>Pivotal Software, Inc.</name> <name>Pivotal Software, Inc.</name>
<url>http://www.spring.io</url> <url>https://spring.io</url>
</organization> </organization>
<properties> <properties>
<main.basedir>${basedir}/../..</main.basedir> <main.basedir>${basedir}/../..</main.basedir>

View File

@ -90,7 +90,7 @@ public class ApplicationTemp {
String property = System.getProperty("java.io.tmpdir"); String property = System.getProperty("java.io.tmpdir");
Assert.state(StringUtils.hasLength(property), "No 'java.io.tmpdir' property set"); Assert.state(StringUtils.hasLength(property), "No 'java.io.tmpdir' property set");
File file = new File(property); File file = new File(property);
Assert.state(file.exists(), () -> "Temp directory" + file + " does not exist"); Assert.state(file.exists(), () -> "Temp directory " + file + " does not exist");
Assert.state(file.isDirectory(), Assert.state(file.isDirectory(),
() -> "Temp location " + file + " is not a directory"); () -> "Temp location " + file + " is not a directory");
return file; return file;

View File

@ -784,7 +784,7 @@ public class SpringApplicationTests {
SpringApplication application = new SpringApplication(ExampleConfig.class, SpringApplication application = new SpringApplication(ExampleConfig.class,
ListenerConfig.class); ListenerConfig.class);
application.setApplicationContextClass(SpyApplicationContext.class); application.setApplicationContextClass(SpyApplicationContext.class);
final LinkedHashSet<ApplicationEvent> events = new LinkedHashSet<>(); Set<ApplicationEvent> events = new LinkedHashSet<>();
application.addListeners((ApplicationListener<ApplicationEvent>) events::add); application.addListeners((ApplicationListener<ApplicationEvent>) events::add);
this.context = application.run(); this.context = application.run();
assertThat(events).hasAtLeastOneElementOfType(ApplicationPreparedEvent.class); assertThat(events).hasAtLeastOneElementOfType(ApplicationPreparedEvent.class);
@ -797,7 +797,7 @@ public class SpringApplicationTests {
SpringApplication application = new SpringApplication(ExampleConfig.class, SpringApplication application = new SpringApplication(ExampleConfig.class,
ListenerConfig.class, Multicaster.class); ListenerConfig.class, Multicaster.class);
application.setApplicationContextClass(SpyApplicationContext.class); application.setApplicationContextClass(SpyApplicationContext.class);
final LinkedHashSet<ApplicationEvent> events = new LinkedHashSet<>(); Set<ApplicationEvent> events = new LinkedHashSet<>();
application.addListeners((ApplicationListener<ApplicationEvent>) events::add); application.addListeners((ApplicationListener<ApplicationEvent>) events::add);
this.context = application.run(); this.context = application.run();
assertThat(events).hasAtLeastOneElementOfType(ApplicationPreparedEvent.class); assertThat(events).hasAtLeastOneElementOfType(ApplicationPreparedEvent.class);