Skip to content

Commit c713c80

Browse files
author
Phillip Webb
committed
Polish
1 parent ed3df32 commit c713c80

File tree

5 files changed

+79
-82
lines changed

5 files changed

+79
-82
lines changed

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration.java

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -73,26 +73,27 @@ private <T> Collection<T> getBeans(Class<T> type) {
7373
.values();
7474
}
7575

76-
@Configuration
77-
@ConditionalOnClass(ObjectMapper.class)
78-
@EnableConfigurationProperties(HttpMapperProperties.class)
79-
static class JacksonObjectMapperAutoConfiguration {
80-
81-
@Autowired
82-
private HttpMapperProperties properties = new HttpMapperProperties();
83-
84-
@Bean
85-
@Primary
86-
@ConditionalOnMissingBean
87-
public ObjectMapper jacksonObjectMapper() {
88-
ObjectMapper objectMapper = new ObjectMapper();
89-
if (this.properties.isJsonSortKeys()) {
90-
objectMapper.configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true);
91-
}
92-
return objectMapper;
93-
}
94-
95-
}
76+
@Configuration
77+
@ConditionalOnClass(ObjectMapper.class)
78+
@EnableConfigurationProperties(HttpMapperProperties.class)
79+
static class JacksonObjectMapperAutoConfiguration {
80+
81+
@Autowired
82+
private HttpMapperProperties properties = new HttpMapperProperties();
83+
84+
@Bean
85+
@Primary
86+
@ConditionalOnMissingBean
87+
public ObjectMapper jacksonObjectMapper() {
88+
ObjectMapper objectMapper = new ObjectMapper();
89+
if (this.properties.isJsonSortKeys()) {
90+
objectMapper.configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS,
91+
true);
92+
}
93+
return objectMapper;
94+
}
95+
96+
}
9697

9798
@Configuration
9899
@ConditionalOnClass(JodaModule.class)

spring-boot-docs/src/main/asciidoc/build-tool-plugins.adoc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ The following configuration options are available:
405405
|Name |Description
406406

407407
|`enabled`
408-
|Boolean flag to switch the repackager off (sometimes useful if you
408+
|Boolean flag to switch the repackager off (sometimes useful if you
409409
want the other Boot features but not this one)
410410

411411
|`mainClass`
@@ -423,10 +423,9 @@ want the other Boot features but not this one)
423423
the original jar as a dependency in another project, it's best to use an extension to
424424
define the executable archive.
425425

426-
|`withJarTask`
427-
|The name or value of the `Jar` task (defaults to all
428-
tasks of type `Jar`) which is used to locate the archive to
429-
repackage.
426+
|`withJarTask`
427+
|The name or value of the `Jar` task (defaults to all tasks of type `Jar`) which is used
428+
to locate the archive to repackage.
430429

431430
|`customConfiguration`
432431
|The name of the custom configuration whuch is used to populate the nested lib directory

spring-boot-docs/src/main/asciidoc/howto.adoc

Lines changed: 35 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,15 +1581,13 @@ details.
15811581

15821582
[[howto-create-an-additional-executable-jar]]
15831583
=== Create an additional executable JAR
1584+
If you want to use your project as a library jar for other projects to depend on, and in
1585+
addition have an executable (e.g. demo) version of it, you will want to configure the
1586+
build in a slightly different way.
15841587

1585-
If you want to use your project as a library jar for other projects to
1586-
depend on, and in addition have an executable (e.g. demo) version of
1587-
it, you will want to configure the build in a slightly different way.
1588-
1589-
For Maven the normal JAR plugin and the Spring Boot plugin both have a
1590-
"classifier" configuration that you can add to create an additional JAR.
1591-
Example (using the Spring Boot Starter Parent to manage the plugin
1592-
versions and other configuration defaults):
1588+
For Maven the normal JAR plugin and the Spring Boot plugin both have a ``classifier''
1589+
configuration that you can add to create an additional JAR. Example (using the Spring
1590+
Boot Starter Parent to manage the plugin versions and other configuration defaults):
15931591

15941592
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
15951593
----
@@ -1606,28 +1604,27 @@ versions and other configuration defaults):
16061604
</build>
16071605
----
16081606

1609-
Two jars are produced, the default one, and an executable one using
1610-
the Boot plugin with classifier "exec".
1607+
Two jars are produced, the default one, and an executable one using the Boot plugin with
1608+
classifier ``exec''.
16111609

16121610
For Gradle users the steps are similar. Example:
16131611

16141612
[source,groovy,indent=0,subs="verbatim,attributes"]
16151613
----
1616-
bootRepackage {
1617-
classifier = 'exec'
1618-
}
1614+
bootRepackage {
1615+
classifier = 'exec'
1616+
}
16191617
----
16201618

1619+
1620+
16211621
[[howto-create-a-nonexecutable-jar]]
16221622
=== Create a non-executable JAR with exclusions
1623+
Often if you have an executable and a non-executable jar as build products, the executable
1624+
version will have additional configuration files that are not needed in a library jar.
1625+
E.g. the `application.yml` configuration file might excluded from the non-executable JAR.
16231626

1624-
Often if you have an executable and a non-executable jar
1625-
as build products, the executable version will have additional
1626-
configuration files that are not needed in a library jar. E.g. the
1627-
`application.yml` configuration file might excluded from the
1628-
non-executable JAR.
1629-
1630-
Here's how to do that in Maven
1627+
Here's how to do that in Maven:
16311628

16321629
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
16331630
----
@@ -1672,30 +1669,31 @@ Here's how to do that in Maven
16721669
</build>
16731670
----
16741671

1675-
In Gradle you can create a new JAR archive with standard task DSL
1676-
features, and then have the `bootRepackage` task depend on that one
1677-
using its `withJarTask` property:
1672+
In Gradle you can create a new JAR archive with standard task DSL features, and then have
1673+
the `bootRepackage` task depend on that one using its `withJarTask` property:
16781674

16791675
[source,groovy,indent=0,subs="verbatim,attributes"]
16801676
----
1681-
jar {
1682-
baseName = 'spring-boot-sample-profile'
1683-
version = '0.0.0'
1684-
excludes = ['**/application.yml']
1685-
}
1677+
jar {
1678+
baseName = 'spring-boot-sample-profile'
1679+
version = '0.0.0'
1680+
excludes = ['**/application.yml']
1681+
}
16861682
1687-
task('execJar', type:Jar, dependsOn: 'jar') {
1688-
baseName = 'spring-boot-sample-profile'
1689-
version = '0.0.0'
1690-
classifier = 'exec'
1691-
from sourceSets.main.output
1692-
}
1683+
task('execJar', type:Jar, dependsOn: 'jar') {
1684+
baseName = 'spring-boot-sample-profile'
1685+
version = '0.0.0'
1686+
classifier = 'exec'
1687+
from sourceSets.main.output
1688+
}
16931689
1694-
bootRepackage {
1695-
withJarTask = tasks['execJar']
1696-
}
1690+
bootRepackage {
1691+
withJarTask = tasks['execJar']
1692+
}
16971693
----
16981694

1695+
1696+
16991697
[[howto-remote-debug-maven-run]]
17001698
=== Remote debug a Spring Boot application started with Maven
17011699
To attach a remote debugger to a Spring Boot application started with Maven you can use

spring-boot-integration-tests/src/test/java/org/springframework/boot/gradle/FlatdirTests.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
/**
2929
* Tests for using the Gradle plugin's support for flat directory repos
30-
*
30+
*
3131
* @author Dave Syer
3232
*/
3333
public class FlatdirTests {
@@ -36,26 +36,26 @@ public class FlatdirTests {
3636

3737
private File libs = new File("target/flatdir/lib");
3838

39-
private static final String BOOT_VERSION = ManagedDependencies.get().find(
40-
"spring-boot").getVersion();
41-
39+
private static final String BOOT_VERSION = ManagedDependencies.get()
40+
.find("spring-boot").getVersion();
41+
4242
@Before
4343
public void init() {
44-
if (libs.exists()) {
45-
FileSystemUtils.deleteRecursively(libs);
44+
if (this.libs.exists()) {
45+
FileSystemUtils.deleteRecursively(this.libs);
4646
}
4747
}
4848

4949
@Test
5050
public void flatdir() throws Exception {
51-
project = new ProjectCreator().createProject("flatdir");
52-
if (!libs.exists()) {
53-
libs.mkdirs();
51+
this.project = new ProjectCreator().createProject("flatdir");
52+
if (!this.libs.exists()) {
53+
this.libs.mkdirs();
5454
}
55-
FileCopyUtils.copy(new File("src/test/resources/foo.jar"),
56-
new File(libs, "foo-1.0.0.jar"));
57-
project.newBuild().forTasks("build").withArguments(
58-
"-PbootVersion=" + BOOT_VERSION, "--stacktrace").run();
55+
FileCopyUtils.copy(new File("src/test/resources/foo.jar"), new File(this.libs,
56+
"foo-1.0.0.jar"));
57+
this.project.newBuild().forTasks("build")
58+
.withArguments("-PbootVersion=" + BOOT_VERSION, "--stacktrace").run();
5959
}
6060

6161
}

spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/exclude/ApplyExcludeRules.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,10 @@ public void execute(Configuration configuration) {
4949
if (!VersionManagedDependencies.CONFIGURATION.equals(configuration.getName())) {
5050
configuration.getIncoming().beforeResolve(
5151
new Action<ResolvableDependencies>() {
52-
5352
@Override
5453
public void execute(ResolvableDependencies resolvableDependencies) {
5554
resolvableDependencies.getDependencies().all(
5655
new Action<Dependency>() {
57-
5856
@Override
5957
public void execute(Dependency dependency) {
6058
applyExcludeRules(dependency);
@@ -72,11 +70,12 @@ private void applyExcludeRules(Dependency dependency) {
7270
}
7371

7472
private void applyExcludeRules(ModuleDependency dependency) {
75-
ManagedDependencies managedDependencies = versionManagedDependencies.getManagedDependencies();
73+
ManagedDependencies managedDependencies = versionManagedDependencies
74+
.getManagedDependencies();
7675
// flat directory repositories do not have groups
7776
if (dependency.getGroup() != null) {
78-
org.springframework.boot.dependency.tools.Dependency managedDependency = managedDependencies.find(
79-
dependency.getGroup(), dependency.getName());
77+
org.springframework.boot.dependency.tools.Dependency managedDependency = managedDependencies
78+
.find(dependency.getGroup(), dependency.getName());
8079
if (managedDependency != null) {
8180
for (Exclusion exclusion : managedDependency.getExclusions()) {
8281
addExcludeRule(dependency, exclusion);
@@ -109,8 +108,8 @@ private void addImplicitExcludeRules(ModuleDependency dependency) {
109108

110109
private boolean isStarter(ModuleDependency dependency) {
111110
return (dependency.getGroup() != null
112-
&& dependency.getGroup().equals("org.springframework.boot") && dependency.getName().startsWith(
113-
"spring-boot-starter"));
111+
&& dependency.getGroup().equals("org.springframework.boot") && dependency
112+
.getName().startsWith("spring-boot-starter"));
114113
}
115114

116115
}

0 commit comments

Comments
 (0)