diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/batch.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/batch.adoc index 2df1dbbf851..c03c8152050 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/batch.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/batch.adoc @@ -23,7 +23,7 @@ For more info about Spring Batch, see the {spring-batch}[Spring Batch project pa === Running Spring Batch Jobs on Startup Spring Batch auto-configuration is enabled by adding `spring-boot-starter-batch` to your application's classpath. -If a single `Job` is found in the application context, it is executed on startup (see {spring-boot-autoconfigure-module-code}/batch/JobLauncherApplicationRunner.java[`JobLauncherApplicationRunner`] for details). +If a single `Job` bean is found in the application context, it is executed on startup (see {spring-boot-autoconfigure-module-code}/batch/JobLauncherApplicationRunner.java[`JobLauncherApplicationRunner`] for details). If multiple `Job` beans are found, the job that should be executed must be specified using configprop:spring.batch.job.name[]. To disable running a `Job` found in the application context, set the configprop:spring.batch.job.enabled[] to `false`. diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/data-initialization.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/data-initialization.adoc index cf7a4a90cee..e2882829707 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/data-initialization.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/data-initialization.adoc @@ -19,11 +19,11 @@ This is controlled through two external properties: [[howto.data-initialization.using-hibernate]] === Initialize a Database Using Hibernate -You can set `spring.jpa.hibernate.ddl-auto` explicitly and the standard Hibernate property values are `none`, `validate`, `update`, `create`, and `create-drop`. +You can set `spring.jpa.hibernate.ddl-auto` explicitly, and the standard Hibernate property values are `none`, `validate`, `update`, `create`, and `create-drop`. Spring Boot chooses a default value for you based on whether it thinks your database is embedded. It defaults to `create-drop` if no schema manager has been detected or `none` in all other cases. An embedded database is detected by looking at the `Connection` type and JDBC url. -`hsqldb`, `h2`, and `derby` are candidates, and others are not. +`hsqldb`, `h2`, and `derby` are candidates, while others are not. Be careful when switching from in-memory to a '`real`' database that you do not make assumptions about the existence of the tables and data in the new platform. You either have to set `ddl-auto` explicitly or use one of the other mechanisms to initialize the database. @@ -41,8 +41,8 @@ It is a Hibernate feature (and has nothing to do with Spring). Spring Boot can automatically create the schema (DDL scripts) of your JDBC `DataSource` or R2DBC `ConnectionFactory` and initialize its data (DML scripts). By default, it loads schema scripts from `optional:classpath*:schema.sql` and data scripts from `optional:classpath*:data.sql`. -The locations of these schema and data scripts can customized using configprop:spring.sql.init.schema-locations[] and configprop:spring.sql.init.data-locations[] respectively. -The `optional:` prefix means that the application will start when the files do not exist. +The locations of these schema and data scripts can be customized using configprop:spring.sql.init.schema-locations[] and configprop:spring.sql.init.data-locations[] respectively. +The `optional:` prefix means that the application will start even when the files do not exist. To have the application fail to start when the files are absent, remove the `optional:` prefix. In addition, Spring Boot processes the `optional:classpath*:schema-$\{platform}.sql` and `optional:classpath*:data-$\{platform}.sql` files (if present), where `$\{platform}` is the value of configprop:spring.sql.init.platform[]. diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/docker-compose.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/docker-compose.adoc index 6d85a95109f..d889637d196 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/docker-compose.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/docker-compose.adoc @@ -33,6 +33,6 @@ With this Docker Compose file in place, the JDBC URL used is `jdbc:postgresql:// === Sharing services between multiple applications If you want to share services between multiple applications, create the `compose.yaml` file in one of the applications and then use the configuration property configprop:spring.docker.compose.file[] in the other applications to reference the `compose.yaml` file. -You should also set configprop:spring.docker.compose.lifecycle-management[] to `start-only`, as it defaults to `start-and-stop` and stopping one application would shut down the shared services for the other still running applications, too. -Setting it to `start-only` won't stop the shared services on application stop, but a caveat is that if you shut down all applications, the services stay running. +You should also set configprop:spring.docker.compose.lifecycle-management[] to `start-only`, as it defaults to `start-and-stop` and stopping one application would shut down the shared services for the other still running applications as well. +Setting it to `start-only` won't stop the shared services on application stop, but a caveat is that if you shut down all applications, the services remain running. You can stop the services manually by running `docker compose stop` on the command line in the directory which contains the `compose.yaml` file. diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/logging.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/logging.adoc index 1f17bc00d6c..5c97fa275c3 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/logging.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/logging.adoc @@ -1,9 +1,9 @@ [[howto.logging]] == Logging Spring Boot has no mandatory logging dependency, except for the Commons Logging API, which is typically provided by Spring Framework's `spring-jcl` module. -To use https://logback.qos.ch[Logback], you need to include it and `spring-jcl` on the classpath. +To use https://logback.qos.ch[Logback], you need to include it and `spring-jcl` in the classpath. The recommended way to do that is through the starters, which all depend on `spring-boot-starter-logging`. -For a web application, you need only `spring-boot-starter-web`, since it depends transitively on the logging starter. +For a web application, you only need `spring-boot-starter-web`, since it depends transitively on the logging starter. If you use Maven, the following dependency adds logging for you: [source,xml,indent=0,subs="verbatim"] @@ -27,7 +27,7 @@ If the only change you need to make to logging is to set the levels of various l org.hibernate: "error" ---- -You can also set the location of a file to which to write the log (in addition to the console) by using `logging.file.name`. +You can also set the location of a file to which the log will be written (in addition to the console) by using `logging.file.name`. To configure the more fine-grained settings of a logging system, you need to use the native configuration format supported by the `LoggingSystem` in question. By default, Spring Boot picks up the native configuration from its default location for the system (such as `classpath:logback.xml` for Logback), but you can set the location of the config file by using the configprop:logging.config[] property. diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/nosql.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/nosql.adoc index c7be21231a0..67fc1d16779 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/nosql.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/nosql.adoc @@ -9,9 +9,9 @@ This section answers questions that arise from using NoSQL with Spring Boot. === Use Jedis Instead of Lettuce By default, the Spring Boot starter (`spring-boot-starter-data-redis`) uses https://github.com/lettuce-io/lettuce-core/[Lettuce]. You need to exclude that dependency and include the https://github.com/xetorthio/jedis/[Jedis] one instead. -Spring Boot manages both of these dependencies so you can switch to Jedis without specifying a version. +Spring Boot manages both of these dependencies, allowing you to switch to Jedis without specifying a version. -The following example shows how to do so in Maven: +The following example shows how to accomplish this in Maven: [source,xml,indent=0,subs="verbatim"] ---- @@ -31,7 +31,7 @@ The following example shows how to do so in Maven: ---- -The following example shows how to do so in Gradle: +The following example shows how to accomplish this in Gradle: [source,gradle,indent=0,subs="verbatim"] ---- diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/security.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/security.adoc index 9f7509e035f..5f813b9c76f 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/security.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/security.adoc @@ -8,7 +8,7 @@ For more about Spring Security, see the {spring-security}[Spring Security projec [[howto.security.switch-off-spring-boot-configuration]] === Switch off the Spring Boot Security Configuration -If you define a `@Configuration` with a `SecurityFilterChain` bean in your application, it switches off the default webapp security settings in Spring Boot. +If you define a `@Configuration` with a `SecurityFilterChain` bean in your application, this action switches off the default webapp security settings in Spring Boot. @@ -17,14 +17,14 @@ If you define a `@Configuration` with a `SecurityFilterChain` bean in your appli If you provide a `@Bean` of type `AuthenticationManager`, `AuthenticationProvider`, or `UserDetailsService`, the default `@Bean` for `InMemoryUserDetailsManager` is not created. This means you have the full feature set of Spring Security available (such as {spring-security-docs}/servlet/authentication/index.html[various authentication options]). -The easiest way to add user accounts is to provide your own `UserDetailsService` bean. +The easiest way to add user accounts is by providing your own `UserDetailsService` bean. [[howto.security.enable-https]] === Enable HTTPS When Running behind a Proxy Server Ensuring that all your main endpoints are only available over HTTPS is an important chore for any application. -If you use Tomcat as a servlet container, then Spring Boot adds Tomcat's own `RemoteIpValve` automatically if it detects some environment settings, and you should be able to rely on the `HttpServletRequest` to report whether it is secure or not (even downstream of a proxy server that handles the real SSL termination). +If you use Tomcat as a servlet container, then Spring Boot adds Tomcat's own `RemoteIpValve` automatically if it detects some environment settings, allowing you to rely on the `HttpServletRequest` to report whether it is secure or not (even downstream of a proxy server that handles the real SSL termination). The standard behavior is determined by the presence or absence of certain request headers (`x-forwarded-for` and `x-forwarded-proto`), whose names are conventional, so it should work with most front-end proxies. You can switch on the valve by adding some entries to `application.properties`, as shown in the following example: diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/testing.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/testing.adoc index 2c76b8689b8..f0a1a1f9232 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/testing.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/testing.adoc @@ -12,7 +12,7 @@ For example, the test in the snippet below will run with an authenticated user t include::code:MySecurityTests[] -Spring Security provides comprehensive integration with Spring MVC Test and this can also be used when testing controllers using the `@WebMvcTest` slice and `MockMvc`. +Spring Security provides comprehensive integration with Spring MVC Test, and this can also be used when testing controllers using the `@WebMvcTest` slice and `MockMvc`. For additional details on Spring Security's testing support, see Spring Security's {spring-security-docs}/servlet/test/index.html[reference documentation].