This commit is contained in:
Phillip Webb
2021-05-04 13:37:04 -07:00
parent 711a0c19e6
commit 65c00f373a
22 changed files with 100 additions and 93 deletions

View File

@@ -71,7 +71,7 @@ When your application starts, any `spring.application.json` or `SPRING_APPLICATI
For example, the `SPRING_APPLICATION_JSON` property can be supplied on the command line in a UN{asterisk}X shell as an environment variable:
[indent=0]
[source,shell,indent=0,subs="verbatim"]
----
$ SPRING_APPLICATION_JSON='{"my":{"name":"test"}}' java -jar myapp.jar
----
@@ -80,14 +80,14 @@ In the preceding example, you end up with `my.name=test` in the Spring `Environm
The same JSON can also be provided as a system property:
[indent=0]
[source,shell,indent=0,subs="verbatim"]
----
$ java -Dspring.application.json='{"my":{"name":"test"}}' -jar myapp.jar
----
Or you could supply the JSON by using a command line argument:
[indent=0]
[source,shell,indent=0,subs="verbatim"]
----
$ java -jar myapp.jar --spring.application.json='{"my":{"name":"test"}}'
----
@@ -116,14 +116,14 @@ If you do not like `application` as the configuration file name, you can switch
You can also refer to an explicit location by using the `spring.config.location` environment property (which is a comma-separated list of directory locations or file paths).
The following example shows how to specify a different file name:
[indent=0]
[source,shell,indent=0,subs="verbatim"]
----
$ java -jar myproject.jar --spring.config.name=myproject
----
The following example shows how to specify two locations:
[indent=0]
[source,shell,indent=0,subs="verbatim"]
----
$ java -jar myproject.jar --spring.config.location=optional:classpath:/default.properties,optional:classpath:/override.properties
----

View File

@@ -50,7 +50,7 @@ The default log configuration echoes messages to the console as they are written
By default, `ERROR`-level, `WARN`-level, and `INFO`-level messages are logged.
You can also enable a "`debug`" mode by starting your application with a `--debug` flag.
[indent=0]
[source,shell,indent=0,subs="verbatim"]
----
$ java -jar myapp.jar --debug
----
@@ -107,7 +107,7 @@ For example, to make the text yellow, use the following setting:
[source,indent=0,subs="verbatim"]
----
%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){yellow}
%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){yellow}
----
The following colors and styles are supported:

View File

@@ -77,9 +77,12 @@ Each will be called in order with the `MongoClientSettings.Builder` that is used
You can set the configprop:spring.data.mongodb.uri[] property to change the URL and configure additional settings such as the _replica set_, as shown in the following example:
[source,properties,indent=0,subs="verbatim",configprops]
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
spring.data.mongodb.uri=mongodb://user:secret@mongo1.example.com:12345,mongo2.example.com:23456/test
spring:
data:
mongodb:
uri: "mongodb://user:secret@mongo1.example.com:12345,mongo2.example.com:23456/test"
----
Alternatively, you can specify connection details using discrete properties.

View File

@@ -71,7 +71,7 @@ To do so, you need to <<features#features.external-config,enable the `debug` pro
For instance, if you are running your application by using `java -jar`, you can enable the `debug` property as follows:
[indent=0,subs="verbatim"]
[source,shell,indent=0,subs="verbatim"]
----
$ java -jar myproject-0.0.1-SNAPSHOT.jar --debug
----
@@ -410,7 +410,7 @@ The first available implementation, `FlightRecorderApplicationStartup` is provid
It adds Spring-specific startup events to a Java Flight Recorder session and is meant for profiling applications and correlating their Spring context lifecycle with JVM events (such as allocations, GCs, class loading...).
Once configured, you can record data by running the application with the Flight Recorder enabled:
[source,bash,indent=0,subs="verbatim"]
[source,shell,indent=0,subs="verbatim"]
----
$ java -XX:StartFlightRecording:filename=recording.jfr,duration=10s -jar demo.jar
----

View File

@@ -23,9 +23,9 @@ For instance, to use JDBC as the back-end store, you can configure your applicat
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
spring:
session:
store-type: "jdbc"
spring:
session:
store-type: "jdbc"
----
TIP: You can disable Spring Session by setting the `store-type` to `none`.
@@ -35,10 +35,10 @@ For instance, it is possible to customize the name of the table for the JDBC sto
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
spring:
session:
jdbc:
table-name: "SESSIONS"
spring:
session:
jdbc:
table-name: "SESSIONS"
----
For setting the timeout of the session you can use the configprop:spring.session.timeout[] property.

View File

@@ -74,7 +74,7 @@ The annotation works by <<features#features.testing.spring-boot-applications.det
In addition to `@SpringBootTest` a number of other annotations are also provided for <<features#features.testing.spring-boot-applications.autoconfigured-tests,testing more specific slices>> of an application.
TIP: If you are using JUnit 4, don't forget to also add `@RunWith(SpringRunner.class)` to your test, otherwise the annotations will be ignored.
If you are using JUnit 5, there's no need to add the equivalent `@ExtendWith(SpringExtension.class)` as `@SpringBootTest` and the other `@Test` annotations are already annotated with it.
If you are using JUnit 5, there's no need to add the equivalent `@ExtendWith(SpringExtension.class)` as `@SpringBootTest` and the other `@...Test` annotations are already annotated with it.
By default, `@SpringBootTest` will not start a server.
You can use the `webEnvironment` attribute of `@SpringBootTest` to further refine how your tests run: