Commit 05cf7fbb authored by Phillip Webb's avatar Phillip Webb

Use new backend features for extracted samples

Update extracted samples to make use of code folding and chomping.

See gh-6313
parent 1f3acd45
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
:numbered: :numbered:
:sectanchors: :sectanchors:
:sectnums: :sectnums:
:icons: font
:hide-uri-scheme: :hide-uri-scheme:
:docinfo: shared,private :docinfo: shared,private
:chomp: tags formatters headers packages
:spring-boot-artifactory-repo: snapshot :spring-boot-artifactory-repo: snapshot
:github-tag: master :github-tag: master
......
...@@ -15,7 +15,7 @@ In many situations, you can delegate to the static `SpringApplication.run` metho ...@@ -15,7 +15,7 @@ In many situations, you can delegate to the static `SpringApplication.run` metho
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/springapplication/main/run/MyApplication.java[tag=*] include::{include-springbootfeatures}/springapplication/main/run/MyApplication.java[]
---- ----
When your application starts, you should see something similar to the following output: When your application starts, you should see something similar to the following output:
...@@ -176,7 +176,7 @@ For example, to turn off the banner, you could write: ...@@ -176,7 +176,7 @@ For example, to turn off the banner, you could write:
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/springapplication/main/custom/MyApplication.java[tag=*] include::{include-springbootfeatures}/springapplication/main/custom/MyApplication.java[]
---- ----
NOTE: The constructor arguments passed to `SpringApplication` are configuration sources for Spring beans. NOTE: The constructor arguments passed to `SpringApplication` are configuration sources for Spring beans.
...@@ -251,7 +251,7 @@ For example, we can export the "Readiness" state of the application to a file so ...@@ -251,7 +251,7 @@ For example, we can export the "Readiness" state of the application to a file so
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/springapplication/availability/ReadinessStateExporter.java[tag=*] include::{include-springbootfeatures}/springapplication/availability/ReadinessStateExporter.java[]
---- ----
We can also update the state of the application, when the application breaks and cannot recover: We can also update the state of the application, when the application breaks and cannot recover:
...@@ -343,7 +343,7 @@ The `ApplicationArguments` interface provides access to both the raw `String[]` ...@@ -343,7 +343,7 @@ The `ApplicationArguments` interface provides access to both the raw `String[]`
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/springapplication/ApplicationArgumentsExample.java[tag=*] include::{include-springbootfeatures}/springapplication/ApplicationArgumentsExample.java[]
---- ----
TIP: Spring Boot also registers a `CommandLinePropertySource` with the Spring `Environment`. TIP: Spring Boot also registers a `CommandLinePropertySource` with the Spring `Environment`.
...@@ -364,7 +364,7 @@ The following example shows a `CommandLineRunner` with a `run` method: ...@@ -364,7 +364,7 @@ The following example shows a `CommandLineRunner` with a `run` method:
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/springapplication/CommandLineRunnerExample.java[tag=*] include::{include-springbootfeatures}/springapplication/CommandLineRunnerExample.java[]
---- ----
If several `CommandLineRunner` or `ApplicationRunner` beans are defined that must be called in a specific order, you can additionally implement the `org.springframework.core.Ordered` interface or use the `org.springframework.core.annotation.Order` annotation. If several `CommandLineRunner` or `ApplicationRunner` beans are defined that must be called in a specific order, you can additionally implement the `org.springframework.core.Ordered` interface or use the `org.springframework.core.annotation.Order` annotation.
...@@ -381,7 +381,7 @@ This exit code can then be passed to `System.exit()` to return it as a status co ...@@ -381,7 +381,7 @@ This exit code can then be passed to `System.exit()` to return it as a status co
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/springapplication/exitcode/MyApplication.java[tag=*] include::{include-springbootfeatures}/springapplication/exitcode/MyApplication.java[]
---- ----
Also, the `ExitCodeGenerator` interface may be implemented by exceptions. Also, the `ExitCodeGenerator` interface may be implemented by exceptions.
...@@ -470,7 +470,7 @@ To provide a concrete example, suppose you develop a `@Component` that uses a `n ...@@ -470,7 +470,7 @@ To provide a concrete example, suppose you develop a `@Component` that uses a `n
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/externalizedconfiguration/valueinjection/MyBean.java[tag=*] include::{include-springbootfeatures}/externalizedconfiguration/valueinjection/MyBean.java[]
---- ----
On your application classpath (for example, inside your jar) you can have an `application.properties` file that provides a sensible default property value for `name`. On your application classpath (for example, inside your jar) you can have an `application.properties` file that provides a sensible default property value for `name`.
...@@ -1037,7 +1037,7 @@ It is possible to bind a bean declaring standard JavaBean properties as shown in ...@@ -1037,7 +1037,7 @@ It is possible to bind a bean declaring standard JavaBean properties as shown in
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/externalizedconfiguration/javabeanbinding/AcmeProperties.java[tag=*] include::{include-springbootfeatures}/externalizedconfiguration/javabeanbinding/AcmeProperties.java[]
---- ----
The preceding POJO defines the following properties: The preceding POJO defines the following properties:
...@@ -1078,7 +1078,7 @@ The example in the previous section can be rewritten in an immutable fashion as ...@@ -1078,7 +1078,7 @@ The example in the previous section can be rewritten in an immutable fashion as
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/externalizedconfiguration/constructorbinding/AcmeProperties.java[tag=*] include::{include-springbootfeatures}/externalizedconfiguration/constructorbinding/AcmeProperties.java[]
---- ----
In this setup, the `@ConstructorBinding` annotation is used to indicate that constructor binding should be used. In this setup, the `@ConstructorBinding` annotation is used to indicate that constructor binding should be used.
...@@ -1118,7 +1118,7 @@ This can be done on any `@Configuration` class, as shown in the following exampl ...@@ -1118,7 +1118,7 @@ This can be done on any `@Configuration` class, as shown in the following exampl
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/externalizedconfiguration/enable/MyConfiguration.java[tag=*] include::{include-springbootfeatures}/externalizedconfiguration/enable/MyConfiguration.java[]
---- ----
To use configuration property scanning, add the `@ConfigurationPropertiesScan` annotation to your application. To use configuration property scanning, add the `@ConfigurationPropertiesScan` annotation to your application.
...@@ -1128,7 +1128,7 @@ If you want to define specific packages to scan, you can do so as shown in the f ...@@ -1128,7 +1128,7 @@ If you want to define specific packages to scan, you can do so as shown in the f
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/externalizedconfiguration/enable/MyApplication.java[tag=*] include::{include-springbootfeatures}/externalizedconfiguration/enable/MyApplication.java[]
---- ----
[NOTE] [NOTE]
...@@ -1164,7 +1164,7 @@ To work with `@ConfigurationProperties` beans, you can inject them in the same w ...@@ -1164,7 +1164,7 @@ To work with `@ConfigurationProperties` beans, you can inject them in the same w
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/externalizedconfiguration/use/MyService.java[tag=*] include::{include-springbootfeatures}/externalizedconfiguration/use/MyService.java[]
---- ----
TIP: Using `@ConfigurationProperties` also lets you generate metadata files that can be used by IDEs to offer auto-completion for your own keys. TIP: Using `@ConfigurationProperties` also lets you generate metadata files that can be used by IDEs to offer auto-completion for your own keys.
...@@ -1181,7 +1181,7 @@ To configure a bean from the `Environment` properties, add `@ConfigurationProper ...@@ -1181,7 +1181,7 @@ To configure a bean from the `Environment` properties, add `@ConfigurationProper
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/externalizedconfiguration/ThirdPartyConfiguration.java[tag=*] include::{include-springbootfeatures}/externalizedconfiguration/ThirdPartyConfiguration.java[]
---- ----
Any JavaBean property defined with the `another` prefix is mapped onto that `AnotherComponent` bean in manner similar to the preceding `AcmeProperties` example. Any JavaBean property defined with the `another` prefix is mapped onto that `AnotherComponent` bean in manner similar to the preceding `AcmeProperties` example.
...@@ -1197,7 +1197,7 @@ As an example, consider the following `@ConfigurationProperties` class: ...@@ -1197,7 +1197,7 @@ As an example, consider the following `@ConfigurationProperties` class:
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/externalizedconfiguration/relaxed/OwnerProperties.java[tag=*] include::{include-springbootfeatures}/externalizedconfiguration/relaxed/OwnerProperties.java[]
---- ----
With the preceding code, the following properties names can all be used: With the preceding code, the following properties names can all be used:
...@@ -1428,7 +1428,7 @@ Consider the following example: ...@@ -1428,7 +1428,7 @@ Consider the following example:
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/externalizedconfiguration/duration/javabeanbinding/AppSystemProperties.java[tag=*] include::{include-springbootfeatures}/externalizedconfiguration/duration/javabeanbinding/AppSystemProperties.java[]
---- ----
To specify a session timeout of 30 seconds, `30`, `PT30S` and `30s` are all equivalent. To specify a session timeout of 30 seconds, `30`, `PT30S` and `30s` are all equivalent.
...@@ -1451,7 +1451,7 @@ If you prefer to use constructor binding, the same properties can be exposed, as ...@@ -1451,7 +1451,7 @@ If you prefer to use constructor binding, the same properties can be exposed, as
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/externalizedconfiguration/duration/constructorbinding/AppSystemProperties.java[tag=*] include::{include-springbootfeatures}/externalizedconfiguration/duration/constructorbinding/AppSystemProperties.java[]
---- ----
...@@ -1492,7 +1492,7 @@ Consider the following example: ...@@ -1492,7 +1492,7 @@ Consider the following example:
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/externalizedconfiguration/datasize/javabeanbinding/AppIoProperties.java[tag=*] include::{include-springbootfeatures}/externalizedconfiguration/datasize/javabeanbinding/AppIoProperties.java[]
---- ----
To specify a buffer size of 10 megabytes, `10` and `10MB` are equivalent. To specify a buffer size of 10 megabytes, `10` and `10MB` are equivalent.
...@@ -1513,7 +1513,7 @@ If you prefer to use constructor binding, the same properties can be exposed, as ...@@ -1513,7 +1513,7 @@ If you prefer to use constructor binding, the same properties can be exposed, as
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/externalizedconfiguration/datasize/constructorbinding/AppIoProperties.java[tag=*] include::{include-springbootfeatures}/externalizedconfiguration/datasize/constructorbinding/AppIoProperties.java[]
---- ----
TIP: If you are upgrading a `Long` property, make sure to define the unit (using `@DataSizeUnit`) if it isn't bytes. TIP: If you are upgrading a `Long` property, make sure to define the unit (using `@DataSizeUnit`) if it isn't bytes.
...@@ -1529,7 +1529,7 @@ To do so, ensure that a compliant JSR-303 implementation is on your classpath an ...@@ -1529,7 +1529,7 @@ To do so, ensure that a compliant JSR-303 implementation is on your classpath an
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/externalizedconfiguration/validate/AcmeProperties.java[tag=*] include::{include-springbootfeatures}/externalizedconfiguration/validate/AcmeProperties.java[]
---- ----
TIP: You can also trigger validation by annotating the `@Bean` method that creates the configuration properties with `@Validated`. TIP: You can also trigger validation by annotating the `@Bean` method that creates the configuration properties with `@Validated`.
...@@ -1539,7 +1539,7 @@ The following example builds on the preceding `AcmeProperties` example: ...@@ -1539,7 +1539,7 @@ The following example builds on the preceding `AcmeProperties` example:
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/externalizedconfiguration/validate/nested/AcmeProperties.java[tag=*] include::{include-springbootfeatures}/externalizedconfiguration/validate/nested/AcmeProperties.java[]
---- ----
You can also add a custom Spring `Validator` by creating a bean definition called `configurationPropertiesValidator`. You can also add a custom Spring `Validator` by creating a bean definition called `configurationPropertiesValidator`.
...@@ -1596,7 +1596,7 @@ Any `@Component`, `@Configuration` or `@ConfigurationProperties` can be marked w ...@@ -1596,7 +1596,7 @@ Any `@Component`, `@Configuration` or `@ConfigurationProperties` can be marked w
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/profiles/ProductionConfiguration.java[tag=*] include::{include-springbootfeatures}/profiles/ProductionConfiguration.java[]
---- ----
NOTE: If `@ConfigurationProperties` beans are registered via `@EnableConfigurationProperties` instead of automatic scanning, the `@Profile` annotation needs to be specified on the `@Configuration` class that has the `@EnableConfigurationProperties` annotation. NOTE: If `@ConfigurationProperties` beans are registered via `@EnableConfigurationProperties` instead of automatic scanning, the `@Profile` annotation needs to be specified on the `@Configuration` class that has the `@EnableConfigurationProperties` annotation.
...@@ -2230,7 +2230,7 @@ The following code shows a typical `@RestController` that serves JSON data: ...@@ -2230,7 +2230,7 @@ The following code shows a typical `@RestController` that serves JSON data:
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/webapplications/servlet/MyRestController.java[tag=*] include::{include-springbootfeatures}/webapplications/servlet/MyRestController.java[]
---- ----
Spring MVC is part of the core Spring Framework, and detailed information is available in the {spring-framework-docs}/web.html#mvc[reference documentation]. Spring MVC is part of the core Spring Framework, and detailed information is available in the {spring-framework-docs}/web.html#mvc[reference documentation].
...@@ -2280,7 +2280,7 @@ If you need to add or customize converters, you can use Spring Boot's `HttpMessa ...@@ -2280,7 +2280,7 @@ If you need to add or customize converters, you can use Spring Boot's `HttpMessa
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/webapplications/HttpMessageConvertersConfiguration.java[tag=*] include::{include-springbootfeatures}/webapplications/HttpMessageConvertersConfiguration.java[]
---- ----
Any `HttpMessageConverter` bean that is present in the context is added to the list of converters. Any `HttpMessageConverter` bean that is present in the context is added to the list of converters.
...@@ -2298,7 +2298,7 @@ You can also use it on classes that contain serializers/deserializers as inner c ...@@ -2298,7 +2298,7 @@ You can also use it on classes that contain serializers/deserializers as inner c
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/webapplications/json/MyJsonComponent.java[tag=*] include::{include-springbootfeatures}/webapplications/json/MyJsonComponent.java[]
---- ----
All `@JsonComponent` beans in the `ApplicationContext` are automatically registered with Jackson. All `@JsonComponent` beans in the `ApplicationContext` are automatically registered with Jackson.
...@@ -2311,7 +2311,7 @@ The example above can be rewritten to use `JsonObjectSerializer`/`JsonObjectDese ...@@ -2311,7 +2311,7 @@ The example above can be rewritten to use `JsonObjectSerializer`/`JsonObjectDese
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/webapplications/json/object/MyJsonComponent.java[tag=*] include::{include-springbootfeatures}/webapplications/json/object/MyJsonComponent.java[]
---- ----
...@@ -2558,7 +2558,7 @@ You can also define a class annotated with `@ControllerAdvice` to customize the ...@@ -2558,7 +2558,7 @@ You can also define a class annotated with `@ControllerAdvice` to customize the
[source,java,indent=0,subs="verbatim,quotes,attributes"] [source,java,indent=0,subs="verbatim,quotes,attributes"]
---- ----
include::{include-springbootfeatures}/webapplications/servlet/MyControllerAdvice.java[tag=*] include::{include-springbootfeatures}/webapplications/servlet/MyControllerAdvice.java[]
---- ----
In the preceding example, if `YourException` is thrown by a controller defined in the same package as `AcmeController`, a JSON representation of the `CustomErrorType` POJO is used instead of the `ErrorAttributes` representation. In the preceding example, if `YourException` is thrown by a controller defined in the same package as `AcmeController`, a JSON representation of the `CustomErrorType` POJO is used instead of the `ErrorAttributes` representation.
...@@ -2605,7 +2605,7 @@ For more complex mappings, you can also add beans that implement the `ErrorViewR ...@@ -2605,7 +2605,7 @@ For more complex mappings, you can also add beans that implement the `ErrorViewR
[source,java,indent=0,subs="verbatim,quotes,attributes"] [source,java,indent=0,subs="verbatim,quotes,attributes"]
---- ----
include::{include-springbootfeatures}/webapplications/servlet/MyErrorViewResolver.java[tag=*] include::{include-springbootfeatures}/webapplications/servlet/MyErrorViewResolver.java[]
---- ----
You can also use regular Spring MVC features such as {spring-framework-docs}/web.html#mvc-exceptionhandlers[`@ExceptionHandler` methods] and {spring-framework-docs}/web.html#mvc-ann-controller-advice[`@ControllerAdvice`]. You can also use regular Spring MVC features such as {spring-framework-docs}/web.html#mvc-exceptionhandlers[`@ExceptionHandler` methods] and {spring-framework-docs}/web.html#mvc-ann-controller-advice[`@ControllerAdvice`].
...@@ -2620,14 +2620,14 @@ This abstraction works directly with the underlying embedded servlet container a ...@@ -2620,14 +2620,14 @@ This abstraction works directly with the underlying embedded servlet container a
[source,java,indent=0,subs="verbatim,quotes,attributes"] [source,java,indent=0,subs="verbatim,quotes,attributes"]
---- ----
include::{include-springbootfeatures}/webapplications/servlet/ErrorPageConfiguration.java[tag=*] include::{include-springbootfeatures}/webapplications/servlet/ErrorPageConfiguration.java[]
---- ----
NOTE: If you register an `ErrorPage` with a path that ends up being handled by a `Filter` (as is common with some non-Spring web frameworks, like Jersey and Wicket), then the `Filter` has to be explicitly registered as an `ERROR` dispatcher, as shown in the following example: NOTE: If you register an `ErrorPage` with a path that ends up being handled by a `Filter` (as is common with some non-Spring web frameworks, like Jersey and Wicket), then the `Filter` has to be explicitly registered as an `ERROR` dispatcher, as shown in the following example:
[source,java,indent=0,subs="verbatim,quotes,attributes"] [source,java,indent=0,subs="verbatim,quotes,attributes"]
---- ----
include::{include-springbootfeatures}/webapplications/servlet/ServletFilterConfiguration.java[tag=*] include::{include-springbootfeatures}/webapplications/servlet/ServletFilterConfiguration.java[]
---- ----
Note that the default `FilterRegistrationBean` does not include the `ERROR` dispatcher type. Note that the default `FilterRegistrationBean` does not include the `ERROR` dispatcher type.
...@@ -2671,7 +2671,7 @@ Using {spring-framework-docs}/web.html#mvc-cors-controller[controller method COR ...@@ -2671,7 +2671,7 @@ Using {spring-framework-docs}/web.html#mvc-cors-controller[controller method COR
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/webapplications/servlet/CorsConfiguration.java[tag=*] include::{include-springbootfeatures}/webapplications/servlet/CorsConfiguration.java[]
---- ----
...@@ -2686,19 +2686,19 @@ The annotation-based one is quite close to the Spring MVC model, as shown in the ...@@ -2686,19 +2686,19 @@ The annotation-based one is quite close to the Spring MVC model, as shown in the
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/webapplications/webflux/MyRestController.java[tag=*] include::{include-springbootfeatures}/webapplications/webflux/MyRestController.java[]
---- ----
"`WebFlux.fn`", the functional variant, separates the routing configuration from the actual handling of the requests, as shown in the following example: "`WebFlux.fn`", the functional variant, separates the routing configuration from the actual handling of the requests, as shown in the following example:
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/webapplications/webflux/fn/RoutingConfiguration.java[tag=*] include::{include-springbootfeatures}/webapplications/webflux/fn/RoutingConfiguration.java[]
---- ----
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/webapplications/webflux/fn/UserHandler.java[tag=*] include::{include-springbootfeatures}/webapplications/webflux/fn/UserHandler.java[]
---- ----
WebFlux is part of the Spring Framework and detailed information is available in its {spring-framework-docs}/web-reactive.html#webflux-fn[reference documentation]. WebFlux is part of the Spring Framework and detailed information is available in its {spring-framework-docs}/web-reactive.html#webflux-fn[reference documentation].
...@@ -2742,7 +2742,7 @@ If you need to add or customize codecs, you can create a custom `CodecCustomizer ...@@ -2742,7 +2742,7 @@ If you need to add or customize codecs, you can create a custom `CodecCustomizer
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/webapplications/webflux/CodecConfiguration.java[tag=*] include::{include-springbootfeatures}/webapplications/webflux/CodecConfiguration.java[]
---- ----
You can also leverage <<boot-features-json-components,Boot's custom JSON serializers and deserializers>>. You can also leverage <<boot-features-json-components,Boot's custom JSON serializers and deserializers>>.
...@@ -2815,7 +2815,7 @@ Because a `WebExceptionHandler` is quite low-level, Spring Boot also provides a ...@@ -2815,7 +2815,7 @@ Because a `WebExceptionHandler` is quite low-level, Spring Boot also provides a
[source,java,indent=0,subs="verbatim,quotes,attributes"] [source,java,indent=0,subs="verbatim,quotes,attributes"]
---- ----
include::{include-springbootfeatures}/webapplications/webflux/CustomErrorWebExceptionHandler.java[tag=*] include::{include-springbootfeatures}/webapplications/webflux/CustomErrorWebExceptionHandler.java[]
---- ----
For a more complete picture, you can also subclass `DefaultErrorWebExceptionHandler` directly and override specific methods. For a more complete picture, you can also subclass `DefaultErrorWebExceptionHandler` directly and override specific methods.
...@@ -3058,7 +3058,7 @@ The following example shows how to customize `TomcatServletWebServerFactory` tha ...@@ -3058,7 +3058,7 @@ The following example shows how to customize `TomcatServletWebServerFactory` tha
[source,java,indent=0,subs="verbatim,quotes,attributes"] [source,java,indent=0,subs="verbatim,quotes,attributes"]
---- ----
include::{include-springbootfeatures}/webapplications/TomcatServerCustomizer.java[tag=*] include::{include-springbootfeatures}/webapplications/TomcatServerCustomizer.java[]
---- ----
...@@ -3312,7 +3312,7 @@ For example, you can customize your security configuration by adding something l ...@@ -3312,7 +3312,7 @@ For example, you can customize your security configuration by adding something l
[source,java,pending-extract=true,indent=0] [source,java,pending-extract=true,indent=0]
---- ----
include::{include-springbootfeatures}/security/CustomWebFluxSecurityConfiguration.java[tag=*] include::{include-springbootfeatures}/security/CustomWebFluxSecurityConfiguration.java[]
---- ----
...@@ -4467,7 +4467,7 @@ To enable transaction management, the following bean must be defined in your con ...@@ -4467,7 +4467,7 @@ To enable transaction management, the following bean must be defined in your con
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/nosql/Neo4jReactiveTransactionManagerConfiguration.java[tag=*] include::{include-springbootfeatures}/nosql/Neo4jReactiveTransactionManagerConfiguration.java[]
---- ----
==== ====
...@@ -5154,7 +5154,7 @@ The following example shows a customizer that configures a specific entry expira ...@@ -5154,7 +5154,7 @@ The following example shows a customizer that configures a specific entry expira
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/nosql/CouchbaseCacheManagerConfiguration.java[tag=*] include::{include-springbootfeatures}/nosql/CouchbaseCacheManagerConfiguration.java[]
---- ----
...@@ -5185,7 +5185,7 @@ The following example shows a customizer that configures a specific time to live ...@@ -5185,7 +5185,7 @@ The following example shows a customizer that configures a specific time to live
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/nosql/RedisCacheManagerConfiguration.java[tag=*] include::{include-springbootfeatures}/nosql/RedisCacheManagerConfiguration.java[]
---- ----
...@@ -5752,7 +5752,7 @@ To use the factory bean, wire `StreamsBuilder` into your `@Bean` as shown in the ...@@ -5752,7 +5752,7 @@ To use the factory bean, wire `StreamsBuilder` into your `@Bean` as shown in the
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/messaging/KafkaStreamsConfiguration.java[tag=*] include::{include-springbootfeatures}/messaging/KafkaStreamsConfiguration.java[]
---- ----
By default, the streams managed by the `StreamBuilder` object it creates are started automatically. By default, the streams managed by the `StreamBuilder` object it creates are started automatically.
...@@ -5907,7 +5907,7 @@ The following example shows a customizer that configures the use of a proxy for ...@@ -5907,7 +5907,7 @@ The following example shows a customizer that configures the use of a proxy for
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/resttemplate/RestTemplateProxyCustomizer.java[tag=*] include::{include-springbootfeatures}/resttemplate/RestTemplateProxyCustomizer.java[]
---- ----
Finally, you can also create your own `RestTemplateBuilder` bean. Finally, you can also create your own `RestTemplateBuilder` bean.
...@@ -5916,7 +5916,7 @@ The following example exposes a `RestTemplateBuilder` with what Spring Boot woul ...@@ -5916,7 +5916,7 @@ The following example exposes a `RestTemplateBuilder` with what Spring Boot woul
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/resttemplate/RestTemplateBuilderConfiguration.java[tag=*] include::{include-springbootfeatures}/resttemplate/RestTemplateBuilderConfiguration.java[]
---- ----
The most extreme (and rarely used) option is to create your own `RestTemplateBuilder` bean without using a configurer. The most extreme (and rarely used) option is to create your own `RestTemplateBuilder` bean without using a configurer.
...@@ -6581,7 +6581,7 @@ have `@SpringBootTest` inject them using the `args` attribute. ...@@ -6581,7 +6581,7 @@ have `@SpringBootTest` inject them using the `args` attribute.
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/testing/ApplicationArgumentTests.java[tag=*] include::{include-springbootfeatures}/testing/ApplicationArgumentTests.java[]
---- ----
...@@ -6593,7 +6593,7 @@ If you have web endpoints that you want to test against this mock environment, y ...@@ -6593,7 +6593,7 @@ If you have web endpoints that you want to test against this mock environment, y
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/testing/MockMvcTests.java[tag=*] include::{include-springbootfeatures}/testing/MockMvcTests.java[]
---- ----
TIP: If you want to focus only on the web layer and not start a complete `ApplicationContext`, consider <<boot-features-testing-spring-boot-applications-testing-autoconfigured-mvc-tests,using `@WebMvcTest` instead>>. TIP: If you want to focus only on the web layer and not start a complete `ApplicationContext`, consider <<boot-features-testing-spring-boot-applications-testing-autoconfigured-mvc-tests,using `@WebMvcTest` instead>>.
...@@ -6602,7 +6602,7 @@ Alternatively, you can configure a {spring-framework-docs}/testing.html#webtestc ...@@ -6602,7 +6602,7 @@ Alternatively, you can configure a {spring-framework-docs}/testing.html#webtestc
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/testing/MockWebTestClientTests.java[tag=*] include::{include-springbootfeatures}/testing/MockWebTestClientTests.java[]
---- ----
[TIP] [TIP]
...@@ -6627,7 +6627,7 @@ For convenience, tests that need to make REST calls to the started server can ad ...@@ -6627,7 +6627,7 @@ For convenience, tests that need to make REST calls to the started server can ad
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/testing/RandomPortWebTestClientTests.java[tag=*] include::{include-springbootfeatures}/testing/RandomPortWebTestClientTests.java[]
---- ----
This setup requires `spring-webflux` on the classpath. This setup requires `spring-webflux` on the classpath.
...@@ -6635,7 +6635,7 @@ If you can't or won't add webflux, Spring Boot also provides a `TestRestTemplate ...@@ -6635,7 +6635,7 @@ If you can't or won't add webflux, Spring Boot also provides a `TestRestTemplate
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/testing/RandomPortTestRestTemplateTests.java[tag=*] include::{include-springbootfeatures}/testing/RandomPortTestRestTemplateTests.java[]
---- ----
...@@ -6654,7 +6654,7 @@ If such test needs access to an `MBeanServer`, consider marking it dirty as well ...@@ -6654,7 +6654,7 @@ If such test needs access to an `MBeanServer`, consider marking it dirty as well
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/testing/jmx/SampleJmxTests.java[tag=*] include::{include-springbootfeatures}/testing/jmx/SampleJmxTests.java[]
---- ----
...@@ -7477,14 +7477,14 @@ You can inject it by using `@Autowired` and use it in your tests as you normally ...@@ -7477,14 +7477,14 @@ You can inject it by using `@Autowired` and use it in your tests as you normally
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/testing/restdocs/webclient/UsersDocumentationTests.java[tag=*] include::{include-springbootfeatures}/testing/restdocs/webclient/UsersDocumentationTests.java[]
---- ----
If you require more control over Spring REST Docs configuration than offered by the attributes of `@AutoConfigureRestDocs`, you can use a `RestDocsWebTestClientConfigurationCustomizer` bean, as shown in the following example: If you require more control over Spring REST Docs configuration than offered by the attributes of `@AutoConfigureRestDocs`, you can use a `RestDocsWebTestClientConfigurationCustomizer` bean, as shown in the following example:
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/testing/restdocs/webclient/AdvancedRestDocsConfiguration.java[tag=*] include::{include-springbootfeatures}/testing/restdocs/webclient/AdvancedRestDocsConfiguration.java[]
---- ----
...@@ -7496,14 +7496,14 @@ You can inject it by using `@Autowired` and use it in your tests as you normally ...@@ -7496,14 +7496,14 @@ You can inject it by using `@Autowired` and use it in your tests as you normally
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/testing/restdocs/restassured/UserDocumentationTests.java[tag=*] include::{include-springbootfeatures}/testing/restdocs/restassured/UserDocumentationTests.java[]
---- ----
If you require more control over Spring REST Docs configuration than offered by the attributes of `@AutoConfigureRestDocs`, a `RestDocsRestAssuredConfigurationCustomizer` bean can be used, as shown in the following example: If you require more control over Spring REST Docs configuration than offered by the attributes of `@AutoConfigureRestDocs`, a `RestDocsRestAssuredConfigurationCustomizer` bean can be used, as shown in the following example:
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/testing/restdocs/restassured/AdvancedRestDocsConfiguration.java[tag=*] include::{include-springbootfeatures}/testing/restdocs/restassured/AdvancedRestDocsConfiguration.java[]
---- ----
...@@ -7697,7 +7697,7 @@ To use add `@ExtendWith(OutputCaptureExtension.class)` and inject `CapturedOutpu ...@@ -7697,7 +7697,7 @@ To use add `@ExtendWith(OutputCaptureExtension.class)` and inject `CapturedOutpu
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/testing/OutputCaptureTests.java[tag=*] include::{include-springbootfeatures}/testing/OutputCaptureTests.java[]
---- ----
...@@ -7742,7 +7742,7 @@ Any URLs that do not specify a host and port automatically connect to the embedd ...@@ -7742,7 +7742,7 @@ Any URLs that do not specify a host and port automatically connect to the embedd
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/testing/webclient/SampleWebClientTests.java[tag=*] include::{include-springbootfeatures}/testing/webclient/SampleWebClientTests.java[]
---- ----
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration; package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration;
//tag::code[]
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
...@@ -31,7 +30,7 @@ public class ThirdPartyConfiguration { ...@@ -31,7 +30,7 @@ public class ThirdPartyConfiguration {
} }
} }
// end::code[] // @chomp:file
class AnotherComponent { class AnotherComponent {
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.constructorbinding; package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.constructorbinding;
//tag::code[]
import java.net.InetAddress; import java.net.InetAddress;
import java.util.List; import java.util.List;
...@@ -28,18 +27,22 @@ import org.springframework.boot.context.properties.bind.DefaultValue; ...@@ -28,18 +27,22 @@ import org.springframework.boot.context.properties.bind.DefaultValue;
@ConfigurationProperties("acme") @ConfigurationProperties("acme")
public class AcmeProperties { public class AcmeProperties {
// @fold:on // fields...
private final boolean enabled; private final boolean enabled;
private final InetAddress remoteAddress; private final InetAddress remoteAddress;
private final Security security; private final Security security;
// @fold:off
public AcmeProperties(boolean enabled, InetAddress remoteAddress, Security security) { public AcmeProperties(boolean enabled, InetAddress remoteAddress, Security security) {
this.enabled = enabled; this.enabled = enabled;
this.remoteAddress = remoteAddress; this.remoteAddress = remoteAddress;
this.security = security; this.security = security;
} }
// @fold:on // getters...
public boolean isEnabled() { public boolean isEnabled() {
return this.enabled; return this.enabled;
} }
...@@ -51,21 +54,26 @@ public class AcmeProperties { ...@@ -51,21 +54,26 @@ public class AcmeProperties {
public Security getSecurity() { public Security getSecurity() {
return this.security; return this.security;
} }
// @fold:off
public static class Security { public static class Security {
// @fold:on // fields...
private final String username; private final String username;
private final String password; private final String password;
private final List<String> roles; private final List<String> roles;
// @fold:off
public Security(String username, String password, @DefaultValue("USER") List<String> roles) { public Security(String username, String password, @DefaultValue("USER") List<String> roles) {
this.username = username; this.username = username;
this.password = password; this.password = password;
this.roles = roles; this.roles = roles;
} }
// @fold:on // getters...
public String getUsername() { public String getUsername() {
return this.username; return this.username;
} }
...@@ -77,8 +85,8 @@ public class AcmeProperties { ...@@ -77,8 +85,8 @@ public class AcmeProperties {
public List<String> getRoles() { public List<String> getRoles() {
return this.roles; return this.roles;
} }
// @fold:off
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.datasize.constructorbinding; package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.datasize.constructorbinding;
// tag::code[]
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.ConstructorBinding; import org.springframework.boot.context.properties.ConstructorBinding;
import org.springframework.boot.context.properties.bind.DefaultValue; import org.springframework.boot.context.properties.bind.DefaultValue;
...@@ -28,16 +27,19 @@ import org.springframework.util.unit.DataUnit; ...@@ -28,16 +27,19 @@ import org.springframework.util.unit.DataUnit;
@ConstructorBinding @ConstructorBinding
public class AppIoProperties { public class AppIoProperties {
// @fold:on // fields...
private final DataSize bufferSize; private final DataSize bufferSize;
private final DataSize sizeThreshold; private final DataSize sizeThreshold;
// @fold:off
public AppIoProperties(@DataSizeUnit(DataUnit.MEGABYTES) @DefaultValue("2MB") DataSize bufferSize, public AppIoProperties(@DataSizeUnit(DataUnit.MEGABYTES) @DefaultValue("2MB") DataSize bufferSize,
@DefaultValue("512B") DataSize sizeThreshold) { @DefaultValue("512B") DataSize sizeThreshold) {
this.bufferSize = bufferSize; this.bufferSize = bufferSize;
this.sizeThreshold = sizeThreshold; this.sizeThreshold = sizeThreshold;
} }
// @fold:on // getters...
public DataSize getBufferSize() { public DataSize getBufferSize() {
return this.bufferSize; return this.bufferSize;
} }
...@@ -45,6 +47,6 @@ public class AppIoProperties { ...@@ -45,6 +47,6 @@ public class AppIoProperties {
public DataSize getSizeThreshold() { public DataSize getSizeThreshold() {
return this.sizeThreshold; return this.sizeThreshold;
} }
// @fold:off
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.datasize.javabeanbinding; package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.datasize.javabeanbinding;
// tag::code[]
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.convert.DataSizeUnit; import org.springframework.boot.convert.DataSizeUnit;
import org.springframework.util.unit.DataSize; import org.springframework.util.unit.DataSize;
...@@ -30,6 +29,7 @@ public class AppIoProperties { ...@@ -30,6 +29,7 @@ public class AppIoProperties {
private DataSize sizeThreshold = DataSize.ofBytes(512); private DataSize sizeThreshold = DataSize.ofBytes(512);
// @fold:on // getters/setters...
public DataSize getBufferSize() { public DataSize getBufferSize() {
return this.bufferSize; return this.bufferSize;
} }
...@@ -45,6 +45,6 @@ public class AppIoProperties { ...@@ -45,6 +45,6 @@ public class AppIoProperties {
public void setSizeThreshold(DataSize sizeThreshold) { public void setSizeThreshold(DataSize sizeThreshold) {
this.sizeThreshold = sizeThreshold; this.sizeThreshold = sizeThreshold;
} }
// @fold:off
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.duration.constructorbinding; package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.duration.constructorbinding;
// tag::code[]
import java.time.Duration; import java.time.Duration;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
...@@ -29,16 +28,19 @@ import org.springframework.boot.convert.DurationUnit; ...@@ -29,16 +28,19 @@ import org.springframework.boot.convert.DurationUnit;
@ConstructorBinding @ConstructorBinding
public class AppSystemProperties { public class AppSystemProperties {
// @fold:on // fields...
private final Duration sessionTimeout; private final Duration sessionTimeout;
private final Duration readTimeout; private final Duration readTimeout;
// @fold:off
public AppSystemProperties(@DurationUnit(ChronoUnit.SECONDS) @DefaultValue("30s") Duration sessionTimeout, public AppSystemProperties(@DurationUnit(ChronoUnit.SECONDS) @DefaultValue("30s") Duration sessionTimeout,
@DefaultValue("1000ms") Duration readTimeout) { @DefaultValue("1000ms") Duration readTimeout) {
this.sessionTimeout = sessionTimeout; this.sessionTimeout = sessionTimeout;
this.readTimeout = readTimeout; this.readTimeout = readTimeout;
} }
// @fold:on // getters...
public Duration getSessionTimeout() { public Duration getSessionTimeout() {
return this.sessionTimeout; return this.sessionTimeout;
} }
...@@ -46,6 +48,6 @@ public class AppSystemProperties { ...@@ -46,6 +48,6 @@ public class AppSystemProperties {
public Duration getReadTimeout() { public Duration getReadTimeout() {
return this.readTimeout; return this.readTimeout;
} }
// @fold:off
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.duration.javabeanbinding; package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.duration.javabeanbinding;
// tag::code[]
import java.time.Duration; import java.time.Duration;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
...@@ -31,6 +30,7 @@ public class AppSystemProperties { ...@@ -31,6 +30,7 @@ public class AppSystemProperties {
private Duration readTimeout = Duration.ofMillis(1000); private Duration readTimeout = Duration.ofMillis(1000);
// @fold:on // getters / setters...
public Duration getSessionTimeout() { public Duration getSessionTimeout() {
return this.sessionTimeout; return this.sessionTimeout;
} }
...@@ -46,6 +46,6 @@ public class AppSystemProperties { ...@@ -46,6 +46,6 @@ public class AppSystemProperties {
public void setReadTimeout(Duration readTimeout) { public void setReadTimeout(Duration readTimeout) {
this.readTimeout = readTimeout; this.readTimeout = readTimeout;
} }
// @fold:off
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.enable; package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.enable;
//tag::code[]
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationPropertiesScan; import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
...@@ -25,4 +24,3 @@ import org.springframework.boot.context.properties.ConfigurationPropertiesScan; ...@@ -25,4 +24,3 @@ import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
public class MyApplication { public class MyApplication {
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.enable; package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.enable;
//tag::code[]
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
...@@ -25,7 +24,7 @@ import org.springframework.context.annotation.Configuration; ...@@ -25,7 +24,7 @@ import org.springframework.context.annotation.Configuration;
public class MyConfiguration { public class MyConfiguration {
} }
// end::code[] // @chomp:file
class AcmeProperties { class AcmeProperties {
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.javabeanbinding; package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.javabeanbinding;
//tag::code[]
import java.net.InetAddress; import java.net.InetAddress;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
...@@ -33,6 +32,7 @@ public class AcmeProperties { ...@@ -33,6 +32,7 @@ public class AcmeProperties {
private final Security security = new Security(); private final Security security = new Security();
// @fold:on // getters / setters...
public boolean isEnabled() { public boolean isEnabled() {
return this.enabled; return this.enabled;
} }
...@@ -52,6 +52,7 @@ public class AcmeProperties { ...@@ -52,6 +52,7 @@ public class AcmeProperties {
public Security getSecurity() { public Security getSecurity() {
return this.security; return this.security;
} }
// @fold:off
public static class Security { public static class Security {
...@@ -61,6 +62,7 @@ public class AcmeProperties { ...@@ -61,6 +62,7 @@ public class AcmeProperties {
private List<String> roles = new ArrayList<>(Collections.singleton("USER")); private List<String> roles = new ArrayList<>(Collections.singleton("USER"));
// @fold:on // getters / setters...
public String getUsername() { public String getUsername() {
return this.username; return this.username;
} }
...@@ -84,8 +86,8 @@ public class AcmeProperties { ...@@ -84,8 +86,8 @@ public class AcmeProperties {
public void setRoles(List<String> roles) { public void setRoles(List<String> roles) {
this.roles = roles; this.roles = roles;
} }
// @fold:off
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.merge.list; package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.merge.list;
//tag::code[]
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -32,7 +31,7 @@ public class AcmeProperties { ...@@ -32,7 +31,7 @@ public class AcmeProperties {
} }
} }
// end::code[] // @chomp: file
class MyPojo { class MyPojo {
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.merge.map; package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.merge.map;
//tag::code[]
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
...@@ -32,7 +31,7 @@ public class AcmeProperties { ...@@ -32,7 +31,7 @@ public class AcmeProperties {
} }
} }
// end::code[] // @chomp:file
class MyPojo { class MyPojo {
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.relaxed; package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.relaxed;
//tag::code[]
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties(prefix = "acme.my-project.person") @ConfigurationProperties(prefix = "acme.my-project.person")
...@@ -33,4 +32,3 @@ public class OwnerProperties { ...@@ -33,4 +32,3 @@ public class OwnerProperties {
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.use; package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.use;
//tag::code[]
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
...@@ -37,7 +36,7 @@ public class MyService { ...@@ -37,7 +36,7 @@ public class MyService {
// ... // ...
} }
// end::code[] // @chomp:file
class AcmeProperties { class AcmeProperties {
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.validate; package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.validate;
//tag::code[]
import java.net.InetAddress; import java.net.InetAddress;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
...@@ -31,6 +30,7 @@ public class AcmeProperties { ...@@ -31,6 +30,7 @@ public class AcmeProperties {
@NotNull @NotNull
private InetAddress remoteAddress; private InetAddress remoteAddress;
// @fold:on // getters/setters...
public InetAddress getRemoteAddress() { public InetAddress getRemoteAddress() {
return this.remoteAddress; return this.remoteAddress;
} }
...@@ -38,6 +38,6 @@ public class AcmeProperties { ...@@ -38,6 +38,6 @@ public class AcmeProperties {
public void setRemoteAddress(InetAddress remoteAddress) { public void setRemoteAddress(InetAddress remoteAddress) {
this.remoteAddress = remoteAddress; this.remoteAddress = remoteAddress;
} }
// @fold:off
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.validate.nested; package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.validate.nested;
//tag::code[]
import java.net.InetAddress; import java.net.InetAddress;
import javax.validation.Valid; import javax.validation.Valid;
...@@ -36,6 +35,7 @@ public class AcmeProperties { ...@@ -36,6 +35,7 @@ public class AcmeProperties {
@Valid @Valid
private final Security security = new Security(); private final Security security = new Security();
// @fold:on // getters/setters...
public InetAddress getRemoteAddress() { public InetAddress getRemoteAddress() {
return this.remoteAddress; return this.remoteAddress;
} }
...@@ -47,12 +47,14 @@ public class AcmeProperties { ...@@ -47,12 +47,14 @@ public class AcmeProperties {
public Security getSecurity() { public Security getSecurity() {
return this.security; return this.security;
} }
// @fold:off
public static class Security { public static class Security {
@NotEmpty @NotEmpty
private String username; private String username;
// @fold:on // getters/setters...
public String getUsername() { public String getUsername() {
return this.username; return this.username;
} }
...@@ -60,8 +62,8 @@ public class AcmeProperties { ...@@ -60,8 +62,8 @@ public class AcmeProperties {
public void setUsername(String username) { public void setUsername(String username) {
this.username = username; this.username = username;
} }
// @fold:off
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.valueinjection; package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.valueinjection;
// tag::code[]
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -29,4 +28,3 @@ public class MyBean { ...@@ -29,4 +28,3 @@ public class MyBean {
// ... // ...
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.messaging; package org.springframework.boot.docs.springbootfeatures.messaging;
// tag::code[]
import org.apache.kafka.common.serialization.Serdes; import org.apache.kafka.common.serialization.Serdes;
import org.apache.kafka.streams.KeyValue; import org.apache.kafka.streams.KeyValue;
import org.apache.kafka.streams.StreamsBuilder; import org.apache.kafka.streams.StreamsBuilder;
...@@ -41,4 +40,3 @@ public class KafkaStreamsConfiguration { ...@@ -41,4 +40,3 @@ public class KafkaStreamsConfiguration {
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.nosql; package org.springframework.boot.docs.springbootfeatures.nosql;
// tag::code[]
import java.time.Duration; import java.time.Duration;
import org.springframework.boot.autoconfigure.cache.CouchbaseCacheManagerBuilderCustomizer; import org.springframework.boot.autoconfigure.cache.CouchbaseCacheManagerBuilderCustomizer;
...@@ -38,4 +37,3 @@ public class CouchbaseCacheManagerConfiguration { ...@@ -38,4 +37,3 @@ public class CouchbaseCacheManagerConfiguration {
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.nosql; package org.springframework.boot.docs.springbootfeatures.nosql;
// tag::code[]
import org.neo4j.driver.Driver; import org.neo4j.driver.Driver;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
...@@ -34,4 +33,3 @@ public class Neo4jReactiveTransactionManagerConfiguration { ...@@ -34,4 +33,3 @@ public class Neo4jReactiveTransactionManagerConfiguration {
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.nosql; package org.springframework.boot.docs.springbootfeatures.nosql;
// tag::code[]
import java.time.Duration; import java.time.Duration;
import org.springframework.boot.autoconfigure.cache.RedisCacheManagerBuilderCustomizer; import org.springframework.boot.autoconfigure.cache.RedisCacheManagerBuilderCustomizer;
...@@ -38,4 +37,3 @@ public class RedisCacheManagerConfiguration { ...@@ -38,4 +37,3 @@ public class RedisCacheManagerConfiguration {
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.profiles; package org.springframework.boot.docs.springbootfeatures.profiles;
//tag::code[]
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile; import org.springframework.context.annotation.Profile;
...@@ -27,4 +26,3 @@ public class ProductionConfiguration { ...@@ -27,4 +26,3 @@ public class ProductionConfiguration {
// ... // ...
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.resttemplate; package org.springframework.boot.docs.springbootfeatures.resttemplate;
// tag::code[]
import java.time.Duration; import java.time.Duration;
import org.springframework.boot.autoconfigure.web.client.RestTemplateBuilderConfigurer; import org.springframework.boot.autoconfigure.web.client.RestTemplateBuilderConfigurer;
...@@ -34,4 +33,3 @@ public class RestTemplateBuilderConfiguration { ...@@ -34,4 +33,3 @@ public class RestTemplateBuilderConfiguration {
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.resttemplate; package org.springframework.boot.docs.springbootfeatures.resttemplate;
// tag::code[]
import org.apache.http.HttpException; import org.apache.http.HttpException;
import org.apache.http.HttpHost; import org.apache.http.HttpHost;
import org.apache.http.HttpRequest; import org.apache.http.HttpRequest;
...@@ -56,4 +55,3 @@ public class RestTemplateProxyCustomizer implements RestTemplateCustomizer { ...@@ -56,4 +55,3 @@ public class RestTemplateProxyCustomizer implements RestTemplateCustomizer {
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.security; package org.springframework.boot.docs.springbootfeatures.security;
// tag::code[]
import org.springframework.boot.autoconfigure.security.reactive.PathRequest; import org.springframework.boot.autoconfigure.security.reactive.PathRequest;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
...@@ -37,4 +36,3 @@ public class CustomWebFluxSecurityConfiguration { ...@@ -37,4 +36,3 @@ public class CustomWebFluxSecurityConfiguration {
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.springapplication; package org.springframework.boot.docs.springbootfeatures.springapplication;
//tag::code[]
import java.util.List; import java.util.List;
import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationArguments;
...@@ -35,4 +34,3 @@ public class ApplicationArgumentsExample { ...@@ -35,4 +34,3 @@ public class ApplicationArgumentsExample {
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.springapplication; package org.springframework.boot.docs.springbootfeatures.springapplication;
//tag::code[]
import org.springframework.boot.CommandLineRunner; import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -29,4 +28,3 @@ public class CommandLineRunnerExample implements CommandLineRunner { ...@@ -29,4 +28,3 @@ public class CommandLineRunnerExample implements CommandLineRunner {
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.springapplication.availability; package org.springframework.boot.docs.springbootfeatures.springapplication.availability;
//tag::code[]
import org.springframework.boot.availability.AvailabilityChangeEvent; import org.springframework.boot.availability.AvailabilityChangeEvent;
import org.springframework.boot.availability.LivenessState; import org.springframework.boot.availability.LivenessState;
import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.ApplicationEventPublisher;
...@@ -41,7 +40,7 @@ public class LocalCacheVerifier { ...@@ -41,7 +40,7 @@ public class LocalCacheVerifier {
} }
} }
// end::code[] // @chomp:file
class CacheCompletelyBrokenException extends RuntimeException { class CacheCompletelyBrokenException extends RuntimeException {
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.springapplication.availability; package org.springframework.boot.docs.springbootfeatures.springapplication.availability;
// tag::code[]
import org.springframework.boot.availability.AvailabilityChangeEvent; import org.springframework.boot.availability.AvailabilityChangeEvent;
import org.springframework.boot.availability.ReadinessState; import org.springframework.boot.availability.ReadinessState;
import org.springframework.context.event.EventListener; import org.springframework.context.event.EventListener;
...@@ -38,4 +37,3 @@ public class ReadinessStateExporter { ...@@ -38,4 +37,3 @@ public class ReadinessStateExporter {
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.springapplication.exitcode; package org.springframework.boot.docs.springbootfeatures.springapplication.exitcode;
// tag::code[]
import org.springframework.boot.ExitCodeGenerator; import org.springframework.boot.ExitCodeGenerator;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
...@@ -35,4 +34,3 @@ public class MyApplication { ...@@ -35,4 +34,3 @@ public class MyApplication {
} }
} }
// end::code[]
...@@ -23,12 +23,10 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; ...@@ -23,12 +23,10 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication @SpringBootApplication
public class MyApplication { public class MyApplication {
// tag::code[]
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication application = new SpringApplication(MyApplication.class); SpringApplication application = new SpringApplication(MyApplication.class);
application.setBannerMode(Banner.Mode.OFF); application.setBannerMode(Banner.Mode.OFF);
application.run(args); application.run(args);
} }
// end::code[]
} }
...@@ -22,10 +22,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; ...@@ -22,10 +22,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication @SpringBootApplication
public class MyApplication { public class MyApplication {
// tag::code[]
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(MyApplication.class, args); SpringApplication.run(MyApplication.class, args);
} }
// end::code[]
} }
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.testing; package org.springframework.boot.docs.springbootfeatures.testing;
// tag::code[]
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -35,4 +34,3 @@ class ApplicationArgumentTests { ...@@ -35,4 +34,3 @@ class ApplicationArgumentTests {
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.testing; package org.springframework.boot.docs.springbootfeatures.testing;
// tag::code[]
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -38,4 +37,3 @@ class MockMvcTests { ...@@ -38,4 +37,3 @@ class MockMvcTests {
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.testing; package org.springframework.boot.docs.springbootfeatures.testing;
// tag::code[]
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -34,4 +33,3 @@ class MockWebTestClientTests { ...@@ -34,4 +33,3 @@ class MockWebTestClientTests {
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.testing; package org.springframework.boot.docs.springbootfeatures.testing;
// tag::code[]
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
...@@ -35,4 +34,3 @@ class OutputCaptureTests { ...@@ -35,4 +34,3 @@ class OutputCaptureTests {
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.testing; package org.springframework.boot.docs.springbootfeatures.testing;
// tag::code[]
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -36,4 +35,3 @@ class RandomPortTestRestTemplateTests { ...@@ -36,4 +35,3 @@ class RandomPortTestRestTemplateTests {
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.testing; package org.springframework.boot.docs.springbootfeatures.testing;
// tag::code[]
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -33,4 +32,3 @@ class RandomPortWebTestClientTests { ...@@ -33,4 +32,3 @@ class RandomPortWebTestClientTests {
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.testing.jmx; package org.springframework.boot.docs.springbootfeatures.testing.jmx;
// tag::code[]
import javax.management.MBeanServer; import javax.management.MBeanServer;
import javax.management.MalformedObjectNameException; import javax.management.MalformedObjectNameException;
...@@ -45,4 +44,3 @@ class SampleJmxTests { ...@@ -45,4 +44,3 @@ class SampleJmxTests {
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.testing.restdocs.restassured; package org.springframework.boot.docs.springbootfeatures.testing.restdocs.restassured;
// tag::code[]
import org.springframework.boot.test.autoconfigure.restdocs.RestDocsRestAssuredConfigurationCustomizer; import org.springframework.boot.test.autoconfigure.restdocs.RestDocsRestAssuredConfigurationCustomizer;
import org.springframework.boot.test.context.TestConfiguration; import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.restdocs.restassured3.RestAssuredRestDocumentationConfigurer; import org.springframework.restdocs.restassured3.RestAssuredRestDocumentationConfigurer;
...@@ -31,4 +30,3 @@ public class AdvancedRestDocsConfiguration implements RestDocsRestAssuredConfigu ...@@ -31,4 +30,3 @@ public class AdvancedRestDocsConfiguration implements RestDocsRestAssuredConfigu
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.testing.restdocs.restassured; package org.springframework.boot.docs.springbootfeatures.testing.restdocs.restassured;
// tag::code[]
import io.restassured.specification.RequestSpecification; import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
...@@ -36,9 +35,15 @@ class UserDocumentationTests { ...@@ -36,9 +35,15 @@ class UserDocumentationTests {
@Test @Test
void listUsers(@Autowired RequestSpecification documentationSpec, @LocalServerPort int port) { void listUsers(@Autowired RequestSpecification documentationSpec, @LocalServerPort int port) {
given(documentationSpec).filter(document("list-users")).when().port(port).get("/").then().assertThat() // @formatter:off
given(documentationSpec)
.filter(document("list-users"))
.when()
.port(port)
.get("/")
.then().assertThat()
.statusCode(is(200)); .statusCode(is(200));
// @formatter:on
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.testing.restdocs.webclient; package org.springframework.boot.docs.springbootfeatures.testing.restdocs.webclient;
// tag::code[]
import org.springframework.boot.test.autoconfigure.restdocs.RestDocsWebTestClientConfigurationCustomizer; import org.springframework.boot.test.autoconfigure.restdocs.RestDocsWebTestClientConfigurationCustomizer;
import org.springframework.boot.test.context.TestConfiguration; import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.restdocs.webtestclient.WebTestClientRestDocumentationConfigurer; import org.springframework.restdocs.webtestclient.WebTestClientRestDocumentationConfigurer;
...@@ -30,4 +29,3 @@ public class AdvancedRestDocsConfiguration implements RestDocsWebTestClientConfi ...@@ -30,4 +29,3 @@ public class AdvancedRestDocsConfiguration implements RestDocsWebTestClientConfi
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.testing.restdocs.webclient; package org.springframework.boot.docs.springbootfeatures.testing.restdocs.webclient;
// tag::code[]
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -35,9 +34,15 @@ class UsersDocumentationTests { ...@@ -35,9 +34,15 @@ class UsersDocumentationTests {
@Test @Test
void listUsers() { void listUsers() {
this.webTestClient.get().uri("/").exchange().expectStatus().isOk().expectBody() // @formatter:off
this.webTestClient
.get().uri("/")
.exchange()
.expectStatus()
.isOk()
.expectBody()
.consumeWith(document("list-users")); .consumeWith(document("list-users"));
// @formatter:on
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.testing.webclient; package org.springframework.boot.docs.springbootfeatures.testing.webclient;
// tag::code[]
import java.time.Duration; import java.time.Duration;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
...@@ -56,4 +55,3 @@ class SampleWebClientTests { ...@@ -56,4 +55,3 @@ class SampleWebClientTests {
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.webapplications; package org.springframework.boot.docs.springbootfeatures.webapplications;
//tag::code[]
import java.io.IOException; import java.io.IOException;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters; import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
...@@ -40,7 +39,7 @@ public class HttpMessageConvertersConfiguration { ...@@ -40,7 +39,7 @@ public class HttpMessageConvertersConfiguration {
} }
} }
// end::code[] // @chomp:file
class AdditionalHttpMessageConverter extends AbstractHttpMessageConverter<Object> { class AdditionalHttpMessageConverter extends AbstractHttpMessageConverter<Object> {
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.webapplications; package org.springframework.boot.docs.springbootfeatures.webapplications;
// tag::code[]
import java.time.Duration; import java.time.Duration;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
...@@ -32,4 +31,3 @@ public class TomcatServerCustomizer implements WebServerFactoryCustomizer<Tomcat ...@@ -32,4 +31,3 @@ public class TomcatServerCustomizer implements WebServerFactoryCustomizer<Tomcat
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.webapplications.json; package org.springframework.boot.docs.springbootfeatures.webapplications.json;
//tag::code[]
import java.io.IOException; import java.io.IOException;
import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonGenerator;
...@@ -59,7 +58,7 @@ public class MyJsonComponent { ...@@ -59,7 +58,7 @@ public class MyJsonComponent {
} }
} }
// end::code[] // @chomp:file
class MyObject { class MyObject {
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.webapplications.json.object; package org.springframework.boot.docs.springbootfeatures.webapplications.json.object;
//tag::code[]
import java.io.IOException; import java.io.IOException;
import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonGenerator;
...@@ -57,7 +56,7 @@ public class MyJsonComponent { ...@@ -57,7 +56,7 @@ public class MyJsonComponent {
} }
} }
// end::code[] // @chomp:file
class MyObject { class MyObject {
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.webapplications.servlet; package org.springframework.boot.docs.springbootfeatures.webapplications.servlet;
//tag::code[]
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.CorsRegistry;
...@@ -38,4 +37,3 @@ public class CorsConfiguration { ...@@ -38,4 +37,3 @@ public class CorsConfiguration {
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.webapplications.servlet; package org.springframework.boot.docs.springbootfeatures.webapplications.servlet;
//tag::code[]
import org.springframework.boot.web.server.ErrorPage; import org.springframework.boot.web.server.ErrorPage;
import org.springframework.boot.web.server.ErrorPageRegistrar; import org.springframework.boot.web.server.ErrorPageRegistrar;
import org.springframework.boot.web.server.ErrorPageRegistry; import org.springframework.boot.web.server.ErrorPageRegistry;
...@@ -37,4 +36,3 @@ public class ErrorPageConfiguration { ...@@ -37,4 +36,3 @@ public class ErrorPageConfiguration {
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.webapplications.servlet; package org.springframework.boot.docs.springbootfeatures.webapplications.servlet;
//tag::code[]
import javax.servlet.RequestDispatcher; import javax.servlet.RequestDispatcher;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -44,7 +43,7 @@ public class MyControllerAdvice extends ResponseEntityExceptionHandler { ...@@ -44,7 +43,7 @@ public class MyControllerAdvice extends ResponseEntityExceptionHandler {
} }
} }
// end::code[] // @chomp:file
class AcmeController { class AcmeController {
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.webapplications.servlet; package org.springframework.boot.docs.springbootfeatures.webapplications.servlet;
//tag::code[]
import java.util.Map; import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -38,4 +37,3 @@ public class MyErrorViewResolver implements ErrorViewResolver { ...@@ -38,4 +37,3 @@ public class MyErrorViewResolver implements ErrorViewResolver {
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.webapplications.servlet; package org.springframework.boot.docs.springbootfeatures.webapplications.servlet;
//tag::code[]
import java.util.List; import java.util.List;
import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.CrudRepository;
...@@ -55,7 +54,7 @@ public class MyRestController { ...@@ -55,7 +54,7 @@ public class MyRestController {
} }
} }
// end::code[] // @chomp:file
interface UserRepository extends CrudRepository<User, Long> { interface UserRepository extends CrudRepository<User, Long> {
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.webapplications.servlet; package org.springframework.boot.docs.springbootfeatures.webapplications.servlet;
//tag::code[]
import java.io.IOException; import java.io.IOException;
import java.util.EnumSet; import java.util.EnumSet;
...@@ -43,7 +42,7 @@ public class ServletFilterConfiguration { ...@@ -43,7 +42,7 @@ public class ServletFilterConfiguration {
} }
} }
// end::code[] // @chomp:file
class MyFilter extends GenericFilterBean { class MyFilter extends GenericFilterBean {
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.webapplications.webflux; package org.springframework.boot.docs.springbootfeatures.webapplications.webflux;
//tag::code[]
import org.springframework.boot.web.codec.CodecCustomizer; import org.springframework.boot.web.codec.CodecCustomizer;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
...@@ -35,4 +34,3 @@ public class CodecConfiguration { ...@@ -35,4 +34,3 @@ public class CodecConfiguration {
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.webapplications.webflux; package org.springframework.boot.docs.springbootfeatures.webapplications.webflux;
//tag::code[]
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
import org.springframework.boot.autoconfigure.web.WebProperties.Resources; import org.springframework.boot.autoconfigure.web.WebProperties.Resources;
...@@ -56,4 +55,3 @@ public class CustomErrorWebExceptionHandler extends AbstractErrorWebExceptionHan ...@@ -56,4 +55,3 @@ public class CustomErrorWebExceptionHandler extends AbstractErrorWebExceptionHan
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.webapplications.webflux; package org.springframework.boot.docs.springbootfeatures.webapplications.webflux;
//tag::code[]
import java.util.List; import java.util.List;
import reactor.core.publisher.Flux; import reactor.core.publisher.Flux;
...@@ -58,7 +57,7 @@ public class MyRestController { ...@@ -58,7 +57,7 @@ public class MyRestController {
} }
} }
// end::code[] // @chomp:file
interface UserRepository extends ReactiveCrudRepository<User, Long> { interface UserRepository extends ReactiveCrudRepository<User, Long> {
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.webapplications.webflux.fn; package org.springframework.boot.docs.springbootfeatures.webapplications.webflux.fn;
//tag::code[]
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
...@@ -45,4 +44,3 @@ public class RoutingConfiguration { ...@@ -45,4 +44,3 @@ public class RoutingConfiguration {
} }
} }
// end::code[]
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.docs.springbootfeatures.webapplications.webflux.fn; package org.springframework.boot.docs.springbootfeatures.webapplications.webflux.fn;
//tag::code[]
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -27,19 +26,15 @@ import org.springframework.web.reactive.function.server.ServerResponse; ...@@ -27,19 +26,15 @@ import org.springframework.web.reactive.function.server.ServerResponse;
public class UserHandler { public class UserHandler {
public Mono<ServerResponse> getUser(ServerRequest request) { public Mono<ServerResponse> getUser(ServerRequest request) {
// ... /**/ return ServerResponse.ok().build();
return ServerResponse.ok().build();
} }
public Mono<ServerResponse> getUserCustomers(ServerRequest request) { public Mono<ServerResponse> getUserCustomers(ServerRequest request) {
// ... /**/ return ServerResponse.ok().build();
return ServerResponse.ok().build();
} }
public Mono<ServerResponse> deleteUser(ServerRequest request) { public Mono<ServerResponse> deleteUser(ServerRequest request) {
// ... /**/ return ServerResponse.ok().build();
return ServerResponse.ok().build();
} }
} }
// end::code[]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment