Restructure spring-boot-docs packages

Restructure the packages in `spring-boot-docs` so that they mirror
the documentation sections. There are now three main packages:
`springbootfeatures`, `productionreadyfeatures` and `howto`. Each
of the main packages has a subpackage named after the section headings.

Example code now uses consistent `// tag::` names and imports are
applied using `[tag=*]` whenever possible.

Test snippets have been moved to `src/main/java` so that only a single
import attribute needs to be defined.

Closes gh-25089
This commit is contained in:
Phillip Webb 2021-02-02 11:20:32 -08:00
parent db781a0d84
commit 91ccc23462
129 changed files with 1540 additions and 283 deletions

View File

@ -20,8 +20,10 @@
:github-issues: https://github.com/{github-repo}/issues/
:github-wiki: https://github.com/{github-repo}/wiki
:code-examples: ../main/java/org/springframework/boot/docs
:test-examples: ../test/java/org/springframework/boot/docs
:include: ../main/java/org/springframework/boot/docs
:include-springbootfeatures: {include}/springbootfeatures
:include-productionreadyfeatures: {include}/productionreadyfeatures
:include-howto: {include}/howto
:spring-boot-code: https://github.com/{github-repo}/tree/{github-tag}
:spring-boot-api: https://docs.spring.io/spring-boot/docs/{spring-boot-version}/api
@ -94,9 +96,6 @@
:spring-session: https://spring.io/projects/spring-session
:spring-webservices-docs: https://docs.spring.io/spring-ws/docs/{spring-webservices-version}/reference/
:ant-docs: https://ant.apache.org/manual
:dependency-management-plugin-code: https://github.com/spring-gradle-plugins/dependency-management-plugin
:gradle-docs: https://docs.gradle.org/current/userguide

View File

@ -95,7 +95,7 @@ For instance, the following example loads a YAML configuration file from the cla
[source,java,indent=0]
----
include::{code-examples}/context/EnvironmentPostProcessorExample.java[tag=example]
include::{include-howto}/springbootapplication/EnvironmentPostProcessorExample.java[tag=*]
----
TIP: The `Environment` has already been prepared with all the usual property sources that Spring Boot loads by default.
@ -931,7 +931,7 @@ You can add an `org.apache.catalina.connector.Connector` to the `TomcatServletWe
[source,java,indent=0,subs="verbatim,quotes,attributes"]
----
include::{code-examples}/context/embedded/TomcatMultipleConnectorsExample.java[tag=configuration]
include::{include-howto}/embeddedwebservers/TomcatMultipleConnectorsExample.java[tag=*]
----
@ -951,7 +951,7 @@ To switch to the `LegacyCookieProcessor`, use an `WebServerFactoryCustomizer` be
[source,java,indent=0]
----
include::{code-examples}/context/embedded/TomcatLegacyCookieProcessorExample.java[tag=customizer]
include::{include-howto}/embeddedwebservers/TomcatLegacyCookieProcessorExample.java[tag=*]
----
@ -978,7 +978,7 @@ Add an `UndertowBuilderCustomizer` to the `UndertowServletWebServerFactory` and
[source,java,indent=0,subs="verbatim,quotes,attributes"]
----
include::{code-examples}/context/embedded/UndertowMultipleListenersExample.java[tag=configuration]
include::{include-howto}/embeddedwebservers/UndertowMultipleListenersExample.java[tag=*]
----
@ -1283,7 +1283,7 @@ The `jersey.config.server.response.setStatusOverSendError` property must be set
[source,java,indent=0]
----
include::{code-examples}/jersey/JerseySetStatusOverSendErrorExample.java[tag=resource-config]
include::{include-howto}/jersey/JerseySetStatusOverSendErrorExample.java[tag=*]
----
@ -1326,7 +1326,7 @@ The following example configures `HttpComponentsClientRequestFactory` with an `H
[source,java,indent=0]
----
include::{code-examples}/web/client/RestTemplateProxyCustomizationExample.java[tag=customizer]
include::{include-springbootfeatures}/resttemplate/RestTemplateProxyCustomizationExample.java[tag=*]
----
[[howto-webclient-reactor-netty-customization]]
@ -1337,7 +1337,7 @@ The following example configures a 60 second connect timeout and adds a `ReadTim
[source,java,indent=0]
----
include::{code-examples}/web/reactive/function/client/ReactorNettyClientCustomizationExample.java[tag=custom-http-connector]
include::{include-howto}/httpclients/ReactorNettyClientCustomizationExample.java[tag=*]
----
TIP: Note the use of `ReactorResourceFactory` for the connection provider and event loop resources.
@ -1582,7 +1582,7 @@ The following example shows how to create a data source by using a `DataSourceBu
[source,java,indent=0,subs="verbatim,quotes,attributes"]
----
include::{code-examples}/jdbc/BasicDataSourceExample.java[tag=configuration]
include::{include-howto}/dataaccess/BasicDataSourceExample.java[tag=*]
----
To run an app with that `DataSource`, all you need is the connection information.
@ -1623,7 +1623,7 @@ The following example shows how create a `HikariDataSource` with `DataSourceBuil
[source,java,indent=0,subs="verbatim,quotes,attributes"]
----
include::{code-examples}/jdbc/SimpleDataSourceExample.java[tag=configuration]
include::{include-howto}/dataaccess/SimpleDataSourceExample.java[tag=*]
----
You can even go further by leveraging what `DataSourceProperties` does for you -- that is, by providing a default embedded database with a sensible username and password if no URL is provided.
@ -1633,7 +1633,7 @@ To avoid that, you can redefine a custom `DataSourceProperties` on your custom n
[source,java,indent=0,subs="verbatim,quotes,attributes"]
----
include::{code-examples}/jdbc/ConfigurableDataSourceExample.java[tag=configuration]
include::{include-howto}/dataaccess/ConfigurableDataSourceExample.java[tag=*]
----
This setup puts you _in sync_ with what Spring Boot does for you by default, except that a dedicated connection pool is chosen (in code) and its settings are exposed in the `app.datasource.configuration` sub namespace.
@ -1670,7 +1670,7 @@ In the following example, we provide the _exact_ same feature set as the auto-co
[source,java,indent=0,subs="verbatim,quotes,attributes"]
----
include::{code-examples}/jdbc/SimpleTwoDataSourcesExample.java[tag=configuration]
include::{include-howto}/dataaccess/SimpleTwoDataSourcesExample.java[tag=*]
----
TIP: `firstDataSourceProperties` has to be flagged as `@Primary` so that the database initializer feature uses your copy (if you use the initializer).
@ -1700,7 +1700,7 @@ You can apply the same concept to the secondary `DataSource` as well, as shown i
[source,java,indent=0,subs="verbatim,quotes,attributes"]
----
include::{code-examples}/jdbc/CompleteTwoDataSourcesExample.java[tag=configuration]
include::{include-howto}/dataaccess/CompleteTwoDataSourcesExample.java[tag=*]
----
The preceding example configures two data sources on custom namespaces with the same logic as Spring Boot would use in auto-configuration.
@ -1794,7 +1794,7 @@ This implementation provides the same table structure as Hibernate 4: all dots a
[source,java,indent=0]
----
include::{code-examples}/jpa/CaseSensitiveSpringPhysicalNamingStrategyExample.java[tag=naming-strategy]
include::{include-howto}/dataaccess/CaseSensitiveSpringPhysicalNamingStrategyExample.java[tag=*]
----
If you prefer to use Hibernate 5's default instead, set the following property:
@ -1828,7 +1828,7 @@ Then, add a `HibernatePropertiesCustomizer` bean as shown in the following examp
[source,java,indent=0]
----
include::{code-examples}/jpa/HibernateSecondLevelCacheExample.java[tag=configuration]
include::{include-howto}/dataaccess/HibernateSecondLevelCacheExample.java[tag=*]
----
This customizer will configure Hibernate to use the same `CacheManager` as the one that the application uses.
@ -1969,7 +1969,7 @@ For example, if you use Hibernate Search with Elasticsearch as its index manager
[source,java,indent=0]
----
include::{code-examples}/elasticsearch/HibernateSearchElasticsearchExample.java[tag=configuration]
include::{include-howto}/dataaccess/HibernateSearchElasticsearchExample.java[tag=*]
----
@ -2066,7 +2066,7 @@ You can initialize the database on startup using SQL scripts as shown in the fol
[source,java,indent=0]
----
include::{code-examples}/r2dbc/R2dbcDatabaseInitializationExample.java[tag=configuration]
include::{include-howto}/dataaccess/R2dbcDatabaseInitializationExample.java[tag=*]
----
Alternatively, you can configure either <<howto-execute-flyway-database-migrations-on-startup,Flyway>> or <<howto-execute-liquibase-database-migrations-on-startup,Liquibase>> to configure a `DataSource` for you for the duration of the migration.
@ -2351,7 +2351,7 @@ The following example shows one way to write such an exporter:
[source,java,indent=0,subs="verbatim,quotes,attributes"]
----
include::{code-examples}/actuate/metrics/MetricsHealthMicrometerExportExample.java[tag=configuration]
include::{include-howto}/actuator/MetricsHealthMicrometerExportExample.java[tag=*]
----

View File

@ -463,7 +463,7 @@ The following example exposes a read operation that returns a custom object:
[source,java,indent=0]
----
include::{code-examples}/actuate/endpoint/CustomEndpointExample.java[tag=read]
include::{include-productionreadyfeatures}/endpoints/CustomEndpointExample.java[tag=read]
----
You can also write technology-specific endpoints by using `@JmxEndpoint` or `@WebEndpoint`.
@ -500,7 +500,7 @@ This can be used to invoke a write operation that takes `String name` and `int c
[source,java,indent=0]
----
include::{code-examples}/actuate/endpoint/CustomEndpointExample.java[tag=write]
include::{include-productionreadyfeatures}/endpoints/CustomEndpointExample.java[tag=write]
----
TIP: Because endpoints are technology agnostic, only simple types can be specified in the method signature.
@ -2379,14 +2379,14 @@ To register custom metrics, inject `MeterRegistry` into your component, as shown
[source,java,indent=0]
----
include::{code-examples}/actuate/metrics/MetricsMeterRegistryInjectionExample.java[tag=component]
include::{include-productionreadyfeatures}/metrics/MetricsMeterRegistryInjectionExample.java[tag=*]
----
If your metrics depend on other beans, it is recommended that you use a `MeterBinder` to register them, as shown in the following example:
[source,java,indent=0]
----
include::{code-examples}/actuate/metrics/SampleMeterBinderConfiguration.java[tag=example]
include::{include-productionreadyfeatures}/metrics/SampleMeterBinderConfiguration.java[tag=*]
----
Using a `MeterBinder` ensures that the correct dependency relationships are set up and that the bean is available when the metric's value is retrieved.
@ -2404,7 +2404,7 @@ For example, if you want to rename the `mytag.region` tag to `mytag.area` for al
[source,java,indent=0]
----
include::{code-examples}/actuate/metrics/MetricsFilterBeanExample.java[tag=configuration]
include::{include-productionreadyfeatures}/metrics/MetricsFilterBeanExample.java[tag=*]
----
@ -2622,7 +2622,7 @@ For Tomcat, the following configuration can be added:
[source,java,indent=0]
----
include::{code-examples}/cloudfoundry/CloudFoundryCustomContextPathExample.java[tag=configuration]
include::{include-productionreadyfeatures}/cloudfoundry/CloudFoundryCustomContextPathExample.java[tag=*]
----

View File

@ -195,7 +195,7 @@ The `SpringApplicationBuilder` lets you chain together multiple method calls and
[source,java,indent=0]
----
include::{code-examples}/builder/SpringApplicationBuilderExample.java[tag=hierarchy]
include::{include-springbootfeatures}/springapplication/SpringApplicationBuilderExample.java[tag=*]
----
NOTE: There are some restrictions when creating an `ApplicationContext` hierarchy.
@ -436,7 +436,7 @@ This exit code can then be passed to `System.exit()` to return it as a status co
[source,java,indent=0]
----
include::{code-examples}/ExitCodeApplication.java[tag=example]
include::{include-springbootfeatures}/springapplication/ExitCodeExample.java[tag=*]
----
Also, the `ExitCodeGenerator` interface may be implemented by exceptions.
@ -1673,7 +1673,7 @@ You may want to rename your custom `ConversionService` if it is not required for
[[boot-features-external-config-conversion-duration]]
===== Converting durations
===== Converting Durations
Spring Boot has dedicated support for expressing durations.
If you expose a `java.time.Duration` property, the following formats in application properties are available:
@ -1685,7 +1685,7 @@ Consider the following example:
[source,java,indent=0]
----
include::{code-examples}/context/properties/bind/javabean/AppSystemProperties.java[tag=example]
include::{include-springbootfeatures}/externalizedconfiguration/duration/javabeanbinding/AppSystemProperties.java[tag=*]
----
To specify a session timeout of 30 seconds, `30`, `PT30S` and `30s` are all equivalent.
@ -1708,7 +1708,7 @@ If you prefer to use constructor binding, the same properties can be exposed, as
[source,java,indent=0]
----
include::{code-examples}/context/properties/bind/constructor/AppSystemProperties.java[tag=example]
include::{include-springbootfeatures}/externalizedconfiguration/duration/constructorbinding/AppSystemProperties.java[tag=*]
----
@ -1749,7 +1749,7 @@ Consider the following example:
[source,java,indent=0]
----
include::{code-examples}/context/properties/bind/javabean/AppIoProperties.java[tag=example]
include::{include-springbootfeatures}/externalizedconfiguration/datasize/javabeanbinding/AppIoProperties.java[tag=*]
----
To specify a buffer size of 10 megabytes, `10` and `10MB` are equivalent.
@ -1770,7 +1770,7 @@ If you prefer to use constructor binding, the same properties can be exposed, as
[source,java,indent=0]
----
include::{code-examples}/context/properties/bind/constructor/AppIoProperties.java[tag=example]
include::{include-springbootfeatures}/externalizedconfiguration/datasize/constructorbinding/AppIoProperties.java[tag=*]
----
TIP: If you are upgrading a `Long` property, make sure to define the unit (using `@DataSizeUnit`) if it isn't bytes.
@ -3515,7 +3515,7 @@ The following example shows how to customize `TomcatServletWebServerFactory` tha
[source,java,indent=0,subs="verbatim,quotes,attributes"]
----
include::{code-examples}/context/embedded/TomcatServerCustomizerExample.java[tag=configuration]
include::{include-springbootfeatures}/webapplications/TomcatServerCustomizerExample.java[tag=*]
----
@ -3769,7 +3769,7 @@ For example, you can customize your security configuration by adding something l
[source,java,indent=0]
----
include::{code-examples}/web/security/CustomWebFluxSecurityExample.java[tag=configuration]
include::{include-springbootfeatures}/security/CustomWebFluxSecurityExample.java[tag=*]
----
@ -4924,7 +4924,7 @@ To enable transaction management, the following bean must be defined in your con
[source,java,indent=0]
----
include::{code-examples}/neo4j/Neo4jReactiveTransactionManagerExample.java[tag=configuration]
include::{include-springbootfeatures}/nosql/Neo4jReactiveTransactionManagerExample.java[tag=*]
----
====
@ -5609,7 +5609,7 @@ The following example shows a customizer that configures a specific entry expira
[source,java,indent=0]
----
include::{code-examples}/cache/CouchbaseCacheManagerCustomizationExample.java[tag=configuration]
include::{include-springbootfeatures}/nosql/CouchbaseCacheManagerCustomizationExample.java[tag=*]
----
@ -5640,7 +5640,7 @@ The following example shows a customizer that configures a specific time to live
[source,java,indent=0]
----
include::{code-examples}/cache/RedisCacheManagerCustomizationExample.java[tag=configuration]
include::{include-springbootfeatures}/nosql//RedisCacheManagerCustomizationExample.java[tag=*]
----
@ -6208,7 +6208,7 @@ To use the factory bean, wire `StreamsBuilder` into your `@Bean` as shown in the
[source,java,indent=0]
----
include::{code-examples}/kafka/KafkaStreamsBeanExample.java[tag=configuration]
include::{include-springbootfeatures}/messaging/KafkaStreamsBeanExample.java[tag=*]
----
By default, the streams managed by the `StreamBuilder` object it creates are started automatically.
@ -6363,7 +6363,7 @@ The following example shows a customizer that configures the use of a proxy for
[source,java,indent=0]
----
include::{code-examples}/web/client/RestTemplateProxyCustomizationExample.java[tag=customizer]
include::{include-springbootfeatures}/resttemplate/RestTemplateProxyCustomizationExample.java[tag=*]
----
Finally, you can also create your own `RestTemplateBuilder` bean.
@ -6372,7 +6372,7 @@ The following example exposes a `RestTemplateBuilder` with what Spring Boot woul
[source,java,indent=0]
----
include::{code-examples}/web/client/RestTemplateBuilderCustomizationExample.java[tag=customizer]
include::{include-springbootfeatures}/resttemplate/RestTemplateBuilderCustomizationExample.java[tag=*]
----
The most extreme (and rarely used) option is to create your own `RestTemplateBuilder` bean without using a configurer.
@ -7025,7 +7025,7 @@ have `@SpringBootTest` inject them using the `args` attribute.
[source,java,indent=0]
----
include::{code-examples}/test/context/ApplicationArgumentsExampleTests.java[tag=example]
include::{include-springbootfeatures}/testing/ApplicationArgumentsExampleTests.java[tag=*]
----
@ -7037,7 +7037,7 @@ If you have web endpoints that you want to test against this mock environment, y
[source,java,indent=0]
----
include::{code-examples}/test/web/MockMvcExampleTests.java[tag=test-mock-mvc]
include::{include-springbootfeatures}/testing/MockMvcExampleTests.java[tag=*]
----
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>>.
@ -7046,7 +7046,7 @@ Alternatively, you can configure a {spring-framework-docs}/testing.html#webtestc
[source,java,indent=0]
----
include::{code-examples}/test/web/MockWebTestClientExampleTests.java[tag=test-mock-web-test-client]
include::{include-springbootfeatures}/testing/MockWebTestClientExampleTests.java[tag=*]
----
[TIP]
@ -7071,7 +7071,7 @@ For convenience, tests that need to make REST calls to the started server can ad
[source,java,indent=0]
----
include::{code-examples}/test/web/RandomPortWebTestClientExampleTests.java[tag=test-random-port]
include::{include-springbootfeatures}/testing/RandomPortWebTestClientExampleTests.java[tag=*]
----
This setup requires `spring-webflux` on the classpath.
@ -7079,7 +7079,7 @@ If you can't or won't add webflux, Spring Boot also provides a `TestRestTemplate
[source,java,indent=0]
----
include::{code-examples}/test/web/RandomPortTestRestTemplateExampleTests.java[tag=test-random-port]
include::{include-springbootfeatures}/testing/RandomPortTestRestTemplateExampleTests.java[tag=*]
----
@ -7098,7 +7098,7 @@ If such test needs access to an `MBeanServer`, consider marking it dirty as well
[source,java,indent=0]
----
include::{test-examples}/jmx/SampleJmxTests.java[tag=test]
include::{include-springbootfeatures}/testing/jmx/SampleJmxTests.java[tag=*]
----
@ -7921,14 +7921,14 @@ You can inject it by using `@Autowired` and use it in your tests as you normally
[source,java,indent=0]
----
include::{code-examples}/test/autoconfigure/restdocs/webclient/UsersDocumentationTests.java[tag=source]
include::{include-springbootfeatures}/testing/restdocs/webclient/UsersDocumentationTests.java[tag=*]
----
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]
----
include::{code-examples}/test/autoconfigure/restdocs/webclient/AdvancedConfigurationExample.java[tag=configuration]
include::{include-springbootfeatures}/testing/restdocs/webclient/AdvancedConfigurationExample.java[tag=*]
----
@ -7940,14 +7940,14 @@ You can inject it by using `@Autowired` and use it in your tests as you normally
[source,java,indent=0]
----
include::{code-examples}/test/autoconfigure/restdocs/restassured/UserDocumentationTests.java[tag=source]
include::{include-springbootfeatures}/testing/restdocs/restassured/UserDocumentationTests.java[tag=*]
----
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]
----
include::{code-examples}/test/autoconfigure/restdocs/restassured/AdvancedConfigurationExample.java[tag=configuration]
include::{include-springbootfeatures}/testing/restdocs/restassured/AdvancedConfigurationExample.java[tag=*]
----
@ -8141,7 +8141,7 @@ To use add `@ExtendWith(OutputCaptureExtension.class)` and inject `CapturedOutpu
[source,java,indent=0]
----
include::{test-examples}/test/system/OutputCaptureTests.java[tag=test]
include::{include-springbootfeatures}/testing/OutputCaptureTests.java[tag=*]
----
@ -8186,7 +8186,7 @@ Any URLs that do not specify a host and port automatically connect to the embedd
[source,java,indent=0]
----
include::{test-examples}/web/client/SampleWebClientTests.java[tag=test]
include::{include-springbootfeatures}/testing/webclient/SampleWebClientTests.java[tag=*]
----
@ -8450,7 +8450,7 @@ The following example makes sure that `UserServiceAutoConfiguration` is always i
[source,java,indent=0]
----
include::{test-examples}/autoconfigure/UserServiceAutoConfigurationTests.java[tag=runner]
include::{include-springbootfeatures}/testing/UserServiceAutoConfigurationTests.java[tag=runner]
----
TIP: If multiple auto-configurations have to be defined, there is no need to order their declarations as they are invoked in the exact same order as when running the application.
@ -8461,14 +8461,14 @@ Invoking `run` provides a callback context that can be used with `AssertJ`.
[source,java,indent=0]
----
include::{test-examples}/autoconfigure/UserServiceAutoConfigurationTests.java[tag=test-user-config]
include::{include-springbootfeatures}/testing/UserServiceAutoConfigurationTests.java[tag=test-user-config]
----
It is also possible to easily customize the `Environment`, as shown in the following example:
[source,java,indent=0]
----
include::{test-examples}/autoconfigure/UserServiceAutoConfigurationTests.java[tag=test-env]
include::{include-springbootfeatures}/testing/UserServiceAutoConfigurationTests.java[tag=test-env]
----
The runner can also be used to display the `ConditionEvaluationReport`.
@ -8502,7 +8502,7 @@ In the following example, we assert that if `UserService` is not present, the au
[source,java,indent=0]
----
include::{test-examples}/autoconfigure/UserServiceAutoConfigurationTests.java[tag=test-classloader]
include::{include-springbootfeatures}/testing/UserServiceAutoConfigurationTests.java[tag=test-classloader]
----

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.actuate.metrics;
package org.springframework.boot.docs.howto.actuator;
import io.micrometer.core.instrument.Gauge;
import io.micrometer.core.instrument.MeterRegistry;
@ -31,7 +31,7 @@ import org.springframework.context.annotation.Configuration;
*/
public class MetricsHealthMicrometerExportExample {
// tag::configuration[]
// tag::code[]
@Configuration
public class HealthMetricsConfiguration {
@ -55,6 +55,6 @@ public class MetricsHealthMicrometerExportExample {
}
}
// end::configuration[]
// end::code[]
}

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "How-to - Actuator" section.
*/
package org.springframework.boot.docs.howto.actuator;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "How-to - Batch Applications" section.
*/
package org.springframework.boot.docs.howto.batchapplications;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "How-to - Build" section.
*/
package org.springframework.boot.docs.howto.build;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.jdbc;
package org.springframework.boot.docs.howto.dataaccess;
import javax.sql.DataSource;
@ -36,13 +36,13 @@ public class BasicDataSourceExample {
@Configuration(proxyBeanMethods = false)
public static class BasicDataSourceConfiguration {
// tag::configuration[]
// tag::code[]
@Bean
@ConfigurationProperties("app.datasource")
public DataSource dataSource() {
return DataSourceBuilder.create().build();
}
// end::configuration[]
// end::code[]
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.jpa;
package org.springframework.boot.docs.howto.dataaccess;
import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;
@ -29,7 +29,7 @@ import org.springframework.context.annotation.Bean;
*/
class CaseSensitiveSpringPhysicalNamingStrategyExample {
// tag::naming-strategy[]
// tag::code[]
@Bean
SpringPhysicalNamingStrategy caseSensitivePhysicalNamingStrategy() {
return new SpringPhysicalNamingStrategy() {
@ -41,6 +41,6 @@ class CaseSensitiveSpringPhysicalNamingStrategyExample {
};
}
// end::naming-strategy[]
// end::code[]
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.jdbc;
package org.springframework.boot.docs.howto.dataaccess;
import com.zaxxer.hikari.HikariDataSource;
import org.apache.commons.dbcp2.BasicDataSource;
@ -39,7 +39,7 @@ public class CompleteTwoDataSourcesExample {
@Configuration
public static class CompleteDataSourcesConfiguration {
// tag::configuration[]
// tag::code[]
@Bean
@Primary
@ConfigurationProperties("app.datasource.first")
@ -65,7 +65,7 @@ public class CompleteTwoDataSourcesExample {
public BasicDataSource secondDataSource() {
return secondDataSourceProperties().initializeDataSourceBuilder().type(BasicDataSource.class).build();
}
// end::configuration[]
// end::code[]
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.jdbc;
package org.springframework.boot.docs.howto.dataaccess;
import javax.sql.DataSource;
@ -40,7 +40,7 @@ public class ConfigurableDataSourceExample {
@Configuration(proxyBeanMethods = false)
public static class ConfigurableDataSourceConfiguration {
// tag::configuration[]
// tag::code[]
@Bean
@Primary
@ConfigurationProperties("app.datasource")
@ -53,7 +53,7 @@ public class ConfigurableDataSourceExample {
public HikariDataSource dataSource(DataSourceProperties properties) {
return properties.initializeDataSourceBuilder().type(HikariDataSource.class).build();
}
// end::configuration[]
// end::code[]
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.elasticsearch;
package org.springframework.boot.docs.howto.dataaccess;
import javax.persistence.EntityManagerFactory;
@ -29,7 +29,7 @@ import org.springframework.stereotype.Component;
*/
public class HibernateSearchElasticsearchExample {
// tag::configuration[]
// tag::code[]
/**
* {@link EntityManagerFactoryDependsOnPostProcessor} that ensures that
* {@link EntityManagerFactory} beans depend on the {@code elasticsearchClient} bean.
@ -43,6 +43,6 @@ public class HibernateSearchElasticsearchExample {
}
}
// end::configuration[]
// end::code[]
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.jpa;
package org.springframework.boot.docs.howto.dataaccess;
import org.hibernate.cache.jcache.ConfigSettings;
@ -28,7 +28,7 @@ import org.springframework.context.annotation.Configuration;
*
* @author Stephane Nicoll
*/
// tag::configuration[]
// tag::code[]
@Configuration(proxyBeanMethods = false)
public class HibernateSecondLevelCacheExample {
@ -38,4 +38,4 @@ public class HibernateSecondLevelCacheExample {
}
}
// end::configuration[]
// end::code[]

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.r2dbc;
package org.springframework.boot.docs.howto.dataaccess;
import io.r2dbc.spi.ConnectionFactory;
@ -32,7 +32,7 @@ import org.springframework.r2dbc.connection.init.ResourceDatabasePopulator;
*/
public class R2dbcDatabaseInitializationExample {
// tag::configuration[]
// tag::code[]
@Configuration(proxyBeanMethods = false)
static class DatabaseInitializationConfiguration {
@ -45,6 +45,6 @@ public class R2dbcDatabaseInitializationExample {
}
}
// end::configuration[]
// end::code[]
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.jdbc;
package org.springframework.boot.docs.howto.dataaccess;
import javax.sql.DataSource;
@ -38,13 +38,13 @@ public class SimpleDataSourceExample {
@Configuration(proxyBeanMethods = false)
public static class SimpleDataSourceConfiguration {
// tag::configuration[]
// tag::code[]
@Bean
@ConfigurationProperties("app.datasource")
public HikariDataSource dataSource() {
return DataSourceBuilder.create().type(HikariDataSource.class).build();
}
// end::configuration[]
// end::code[]
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.jdbc;
package org.springframework.boot.docs.howto.dataaccess;
import javax.sql.DataSource;
@ -42,7 +42,7 @@ public class SimpleTwoDataSourcesExample {
@Configuration
public static class SimpleDataSourcesConfiguration {
// tag::configuration[]
// tag::code[]
@Bean
@Primary
@ConfigurationProperties("app.datasource.first")
@ -62,7 +62,7 @@ public class SimpleTwoDataSourcesExample {
public BasicDataSource secondDataSource() {
return DataSourceBuilder.create().type(BasicDataSource.class).build();
}
// end::configuration[]
// end::code[]
}

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "How-to - Data Access" section.
*/
package org.springframework.boot.docs.howto.dataaccess;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "How-to - Database Initialization" section.
*/
package org.springframework.boot.docs.howto.databaseinitialization;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.context.embedded;
package org.springframework.boot.docs.howto.embeddedwebservers;
import org.apache.tomcat.util.http.LegacyCookieProcessor;
@ -36,13 +36,13 @@ public class TomcatLegacyCookieProcessorExample {
@Configuration(proxyBeanMethods = false)
public static class LegacyCookieProcessorConfiguration {
// tag::customizer[]
// tag::code[]
@Bean
public WebServerFactoryCustomizer<TomcatServletWebServerFactory> cookieProcessorCustomizer() {
return (factory) -> factory
.addContextCustomizers((context) -> context.setCookieProcessor(new LegacyCookieProcessor()));
}
// end::customizer[]
// end::code[]
}

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.context.embedded;
package org.springframework.boot.docs.howto.embeddedwebservers;
import java.io.IOException;
import java.net.URL;
@ -36,7 +36,7 @@ import org.springframework.util.ResourceUtils;
@Configuration(proxyBeanMethods = false)
public class TomcatMultipleConnectorsExample {
// tag::configuration[]
// tag::code[]
@Bean
public WebServerFactoryCustomizer<TomcatServletWebServerFactory> sslConnectorCustomizer() {
return (tomcat) -> tomcat.addAdditionalTomcatConnectors(createSslConnector());
@ -63,6 +63,6 @@ public class TomcatMultipleConnectorsExample {
throw new IllegalStateException("Fail to create ssl connector", ex);
}
}
// end::configuration[]
// end::code[]
}

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.context.embedded;
package org.springframework.boot.docs.howto.embeddedwebservers;
import io.undertow.Undertow.Builder;
@ -32,7 +32,7 @@ import org.springframework.context.annotation.Configuration;
@Configuration(proxyBeanMethods = false)
public class UndertowMultipleListenersExample {
// tag::configuration[]
// tag::code[]
@Bean
public WebServerFactoryCustomizer<UndertowServletWebServerFactory> undertowListenerCustomizer() {
return (factory) -> {
@ -46,6 +46,6 @@ public class UndertowMultipleListenersExample {
});
};
}
// end::configuration[]
// end::code[]
}

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "How-to - Embedded Web Servers" section.
*/
package org.springframework.boot.docs.howto.embeddedwebservers;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "How-to - Hot Swapping" section.
*/
package org.springframework.boot.docs.howto.hotswapping;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.web.reactive.function.client;
package org.springframework.boot.docs.howto.httpclients;
import io.netty.channel.ChannelOption;
import io.netty.handler.timeout.ReadTimeoutHandler;
@ -35,7 +35,7 @@ import org.springframework.web.reactive.function.client.WebClient;
@Configuration(proxyBeanMethods = false)
public class ReactorNettyClientCustomizationExample {
// tag::custom-http-connector[]
// tag::code[]
@Bean
ClientHttpConnector clientHttpConnector(ReactorResourceFactory resourceFactory) {
HttpClient httpClient = HttpClient.create(resourceFactory.getConnectionProvider())
@ -43,6 +43,6 @@ public class ReactorNettyClientCustomizationExample {
.doOnConnected((connection) -> connection.addHandlerLast(new ReadTimeoutHandler(60)));
return new ReactorClientHttpConnector(httpClient);
}
// end::custom-http-connector[]
// end::code[]
}

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "How-to - HTTP Clients" section.
*/
package org.springframework.boot.docs.howto.httpclients;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.jersey;
package org.springframework.boot.docs.howto.jersey;
import java.util.Collections;
@ -33,7 +33,7 @@ import org.springframework.stereotype.Component;
*/
public class JerseySetStatusOverSendErrorExample {
// tag::resource-config[]
// tag::code[]
@Component
public class JerseyConfig extends ResourceConfig {
@ -43,7 +43,7 @@ public class JerseySetStatusOverSendErrorExample {
}
}
// end::resource-config[]
// end::code[]
static class Endpoint {

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "How-to - Jersey" section.
*/
package org.springframework.boot.docs.howto.jersey;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "How-to - Logging" section.
*/
package org.springframework.boot.docs.howto.logging;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "How-to - Messaging" section.
*/
package org.springframework.boot.docs.howto.messaging;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "How-to - Properties and Configuration" section.
*/
package org.springframework.boot.docs.howto.propertiesandconfiguration;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "How-to - Security" section.
*/
package org.springframework.boot.docs.howto.security;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.context;
package org.springframework.boot.docs.howto.springbootapplication;
import java.io.IOException;
@ -25,13 +25,14 @@ import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.PropertySource;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.util.Assert;
/**
* An {@link EnvironmentPostProcessor} example that loads a YAML file.
*
* @author Stephane Nicoll
*/
// tag::example[]
// tag::code[]
public class EnvironmentPostProcessorExample implements EnvironmentPostProcessor {
private final YamlPropertySourceLoader loader = new YamlPropertySourceLoader();
@ -44,9 +45,7 @@ public class EnvironmentPostProcessorExample implements EnvironmentPostProcessor
}
private PropertySource<?> loadYaml(Resource path) {
if (!path.exists()) {
throw new IllegalArgumentException("Resource " + path + " does not exist");
}
Assert.isTrue(path.exists(), () -> "Resource " + path + " does not exist");
try {
return this.loader.load("custom-resource", path).get(0);
}
@ -56,4 +55,4 @@ public class EnvironmentPostProcessorExample implements EnvironmentPostProcessor
}
}
// end::example[]
// end::code[]

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "How-to - Spring Boot Application" section.
*/
package org.springframework.boot.docs.howto.springbootapplication;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "How-to - Spring MVC" section.
*/
package org.springframework.boot.docs.howto.springmvc;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "How-to - Testing with Spring Security" section.
*/
package org.springframework.boot.docs.howto.testingwithspringsecurity;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "How-to - Traditional Deployment" section.
*/
package org.springframework.boot.docs.howto.traditionaldeployment;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Production Ready Features - Auditing" section.
*/
package org.springframework.boot.docs.productionreadyfeatures.auditing;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.cloudfoundry;
package org.springframework.boot.docs.productionreadyfeatures.cloudfoundry;
import java.io.IOException;
import java.util.Collections;
@ -44,7 +44,7 @@ import org.springframework.context.annotation.Configuration;
@Configuration(proxyBeanMethods = false)
public class CloudFoundryCustomContextPathExample {
// tag::configuration[]
// tag::code[]
@Bean
public TomcatServletWebServerFactory servletWebServerFactory() {
return new TomcatServletWebServerFactory() {
@ -78,6 +78,6 @@ public class CloudFoundryCustomContextPathExample {
context.addServlet("cloudfoundry", servlet).addMapping("/*");
};
}
// end::configuration[]
// end::code[]
}

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Production Ready Features - Cloud Foundry Support" section.
*/
package org.springframework.boot.docs.productionreadyfeatures.cloudfoundry;

View File

@ -0,0 +1,21 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Production Ready Features - Enabling Production Ready Features"
* section.
*/
package org.springframework.boot.docs.productionreadyfeatures.enabling;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.actuate.endpoint;
package org.springframework.boot.docs.productionreadyfeatures.endpoints;
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
@ -53,6 +53,14 @@ public class CustomEndpointExample {
this.counter = counter;
}
public String getName() {
return this.name;
}
public int getCounter() {
return this.counter;
}
}
}

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Production Ready Features - Endpoints" section.
*/
package org.springframework.boot.docs.productionreadyfeatures.endpoints;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Production Ready Features - HTTP Tracing" section.
*/
package org.springframework.boot.docs.productionreadyfeatures.httptracing;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Production Ready Features - Loggers" section.
*/
package org.springframework.boot.docs.productionreadyfeatures.loggers;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.actuate.metrics;
package org.springframework.boot.docs.productionreadyfeatures.metrics;
import io.micrometer.core.instrument.config.MeterFilter;
@ -31,12 +31,12 @@ public class MetricsFilterBeanExample {
@Configuration(proxyBeanMethods = false)
public static class MetricsFilterExampleConfiguration {
// tag::configuration[]
// tag::code[]
@Bean
public MeterFilter renameRegionTagMeterFilter() {
return MeterFilter.renameTag("com.example", "mytag.region", "mytag.area");
}
// end::configuration[]
// end::code[]
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.actuate.metrics;
package org.springframework.boot.docs.productionreadyfeatures.metrics;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
@ -29,7 +29,7 @@ import io.micrometer.core.instrument.Tags;
*/
public class MetricsMeterRegistryInjectionExample {
// tag::component[]
// tag::code[]
class Dictionary {
private final List<String> words = new CopyOnWriteArrayList<>();
@ -38,9 +38,9 @@ public class MetricsMeterRegistryInjectionExample {
registry.gaugeCollectionSize("dictionary.size", Tags.empty(), this.words);
}
//
// ...
}
// end::component[]
// end::code[]
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.actuate.metrics;
package org.springframework.boot.docs.productionreadyfeatures.metrics;
import io.micrometer.core.instrument.Gauge;
import io.micrometer.core.instrument.binder.MeterBinder;
@ -28,12 +28,12 @@ import org.springframework.context.annotation.Bean;
*/
public class SampleMeterBinderConfiguration {
// tag::example[]
// tag::code[]
@Bean
MeterBinder queueSize(Queue queue) {
return (registry) -> Gauge.builder("queueSize", queue::size).register(registry);
}
// end::example[]
// end::code[]
static class Queue {

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Production Ready Features - Metrics" section.
*/
package org.springframework.boot.docs.productionreadyfeatures.metrics;

View File

@ -0,0 +1,21 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Production Ready Features - Monitoring and Management overt HTTP"
* section.
*/
package org.springframework.boot.docs.productionreadyfeatures.monitoring.http;

View File

@ -0,0 +1,21 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Production Ready Features - Monitoring and Management overt JMX"
* section.
*/
package org.springframework.boot.docs.productionreadyfeatures.monitoring.jmx;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Production Ready Features - Process Monitoring" section.
*/
package org.springframework.boot.docs.productionreadyfeatures.processmonitoring;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Spring Boot Features - Caching" section.
*/
package org.springframework.boot.docs.springbootfeatures.caching;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Spring Boot Features - Container Images" section.
*/
package org.springframework.boot.docs.springbootfeatures.containerimages;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.autoconfigure;
package org.springframework.boot.docs.springbootfeatures.creatingautoconfiguration;
/**
* Sample service.

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,13 +14,13 @@
* limitations under the License.
*/
package org.springframework.boot.docs.autoconfigure;
package org.springframework.boot.docs.springbootfeatures.creatingautoconfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.docs.autoconfigure.UserServiceAutoConfiguration.UserProperties;
import org.springframework.boot.docs.springbootfeatures.creatingautoconfiguration.UserServiceAutoConfiguration.UserProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Spring Boot Features - Creating Your Own Auto-Configuration" section.
*/
package org.springframework.boot.docs.springbootfeatures.creatingautoconfiguration;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Spring Boot Features - Sending Email" section.
*/
package org.springframework.boot.docs.springbootfeatures.email;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.context.properties.bind.constructor;
package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.datasize.constructorbinding;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.ConstructorBinding;
@ -29,7 +29,7 @@ import org.springframework.util.unit.DataUnit;
*
* @author Stephane Nicoll
*/
// tag::example[]
// tag::code[]
@ConfigurationProperties("app.io")
@ConstructorBinding
public class AppIoProperties {
@ -53,4 +53,4 @@ public class AppIoProperties {
}
}
// end::example[]
// end::code[]

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.context.properties.bind.javabean;
package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.datasize.javabeanbinding;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.convert.DataSizeUnit;
@ -27,7 +27,7 @@ import org.springframework.util.unit.DataUnit;
*
* @author Stephane Nicoll
*/
// tag::example[]
// tag::code[]
@ConfigurationProperties("app.io")
public class AppIoProperties {
@ -53,4 +53,4 @@ public class AppIoProperties {
}
}
// end::example[]
// end::code[]

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.context.properties.bind.constructor;
package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.duration.constructorbinding;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
@ -30,7 +30,7 @@ import org.springframework.boot.convert.DurationUnit;
*
* @author Stephane Nicoll
*/
// tag::example[]
// tag::code[]
@ConfigurationProperties("app.system")
@ConstructorBinding
public class AppSystemProperties {
@ -54,4 +54,4 @@ public class AppSystemProperties {
}
}
// end::example[]
// end::code[]

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.context.properties.bind.javabean;
package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration.duration.javabeanbinding;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
@ -28,7 +28,7 @@ import org.springframework.boot.convert.DurationUnit;
*
* @author Stephane Nicoll
*/
// tag::example[]
// tag::code[]
@ConfigurationProperties("app.system")
public class AppSystemProperties {
@ -54,4 +54,4 @@ public class AppSystemProperties {
}
}
// end::example[]
// end::code[]

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Spring Boot Features - Externalized Configuration" section.
*/
package org.springframework.boot.docs.springbootfeatures.externalizedconfiguration;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Spring Boot Features - Graceful Shutdown" section.
*/
package org.springframework.boot.docs.springbootfeatures.gracefulshutdown;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Spring Boot Features - Hazelcast" section.
*/
package org.springframework.boot.docs.springbootfeatures.hazelcast;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Spring Boot Features - Spring Integration" section.
*/
package org.springframework.boot.docs.springbootfeatures.integration;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Spring Boot Features - Internationalization" section.
*/
package org.springframework.boot.docs.springbootfeatures.internationalization;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Spring Boot Features - JSON" section.
*/
package org.springframework.boot.docs.springbootfeatures.json;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Spring Boot Features - Distributed Transactions with JTA" section.
*/
package org.springframework.boot.docs.springbootfeatures.jta;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Spring Boot Features - Kotlin" section.
*/
package org.springframework.boot.docs.springbootfeatures.kotlin;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Spring Boot Features - Logging" section.
*/
package org.springframework.boot.docs.springbootfeatures.logging;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.kafka;
package org.springframework.boot.docs.springbootfeatures.messaging;
import org.apache.kafka.common.serialization.Serdes;
import org.apache.kafka.streams.KeyValue;
@ -34,7 +34,7 @@ import org.springframework.kafka.support.serializer.JsonSerde;
*/
public class KafkaStreamsBeanExample {
// tag::configuration[]
// tag::code[]
@Configuration(proxyBeanMethods = false)
@EnableKafkaStreams
public static class KafkaStreamsExampleConfiguration {
@ -48,6 +48,6 @@ public class KafkaStreamsBeanExample {
}
}
// end::configuration[]
// end::code[]
}

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Spring Boot Features - Messaging" section.
*/
package org.springframework.boot.docs.springbootfeatures.messaging;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Spring Boot Features - Monitoring with JMX" section.
*/
package org.springframework.boot.docs.springbootfeatures.monitoring.jmx;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.cache;
package org.springframework.boot.docs.springbootfeatures.nosql;
import java.time.Duration;
@ -32,7 +32,7 @@ import org.springframework.data.couchbase.cache.CouchbaseCacheConfiguration;
@Configuration(proxyBeanMethods = false)
public class CouchbaseCacheManagerCustomizationExample {
// tag::configuration[]
// tag::code[]
@Bean
public CouchbaseCacheManagerBuilderCustomizer myCouchbaseCacheManagerBuilderCustomizer() {
return (builder) -> builder
@ -42,6 +42,6 @@ public class CouchbaseCacheManagerCustomizationExample {
CouchbaseCacheConfiguration.defaultCacheConfig().entryExpiry(Duration.ofMinutes(1)));
}
// end::configuration[]
// end::code[]
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.neo4j;
package org.springframework.boot.docs.springbootfeatures.nosql;
import org.neo4j.driver.Driver;
@ -32,12 +32,12 @@ import org.springframework.transaction.ReactiveTransactionManager;
@Configuration(proxyBeanMethods = false)
public class Neo4jReactiveTransactionManagerExample {
// tag::configuration[]
// tag::code[]
@Bean
public ReactiveNeo4jTransactionManager reactiveTransactionManager(Driver driver,
ReactiveDatabaseSelectionProvider databaseNameProvider) {
return new ReactiveNeo4jTransactionManager(driver, databaseNameProvider);
}
// end::configuration[]
// end::code[]
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.cache;
package org.springframework.boot.docs.springbootfeatures.nosql;
import java.time.Duration;
@ -32,7 +32,7 @@ import org.springframework.data.redis.cache.RedisCacheConfiguration;
@Configuration(proxyBeanMethods = false)
public class RedisCacheManagerCustomizationExample {
// tag::configuration[]
// tag::code[]
@Bean
public RedisCacheManagerBuilderCustomizer myRedisCacheManagerBuilderCustomizer() {
return (builder) -> builder
@ -42,6 +42,6 @@ public class RedisCacheManagerCustomizationExample {
RedisCacheConfiguration.defaultCacheConfig().entryTtl(Duration.ofMinutes(1)));
}
// end::configuration[]
// end::code[]
}

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Spring Boot Features - Working with NoSQL Technologies" section.
*/
package org.springframework.boot.docs.springbootfeatures.nosql;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Spring Boot Features - Profiles" section.
*/
package org.springframework.boot.docs.springbootfeatures.profiles;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Spring Boot Features - Quartz" section.
*/
package org.springframework.boot.docs.springbootfeatures.quartz;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.web.client;
package org.springframework.boot.docs.springbootfeatures.resttemplate;
import java.time.Duration;
@ -32,12 +32,12 @@ import org.springframework.context.annotation.Configuration;
@Configuration(proxyBeanMethods = false)
public class RestTemplateBuilderCustomizationExample {
// tag::customizer[]
// tag::code[]
@Bean
public RestTemplateBuilder restTemplateBuilder(RestTemplateBuilderConfigurer configurer) {
return configurer.configure(new RestTemplateBuilder()).setConnectTimeout(Duration.ofSeconds(5))
.setReadTimeout(Duration.ofSeconds(2));
}
// end::customizer[]
// end::code[]
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.web.client;
package org.springframework.boot.docs.springbootfeatures.resttemplate;
import org.apache.http.HttpException;
import org.apache.http.HttpHost;
@ -39,7 +39,7 @@ public class RestTemplateProxyCustomizationExample {
* A {@link RestTemplateCustomizer} that applies an HttpComponents-based request
* factory that is configured to use a proxy.
*/
// tag::customizer[]
// tag::code[]
static class ProxyCustomizer implements RestTemplateCustomizer {
@Override
@ -61,6 +61,6 @@ public class RestTemplateProxyCustomizationExample {
}
}
// end::customizer[]
// end::code[]
}

View File

@ -0,0 +1,21 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Spring Boot Features - Calling REST Services with RestTemplate"
* section.
*/
package org.springframework.boot.docs.springbootfeatures.resttemplate;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Spring Boot Features - RSocket" section.
*/
package org.springframework.boot.docs.springbootfeatures.rsocket;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.web.security;
package org.springframework.boot.docs.springbootfeatures.security;
import org.springframework.boot.autoconfigure.security.reactive.PathRequest;
import org.springframework.context.annotation.Bean;
@ -31,7 +31,7 @@ import org.springframework.security.web.server.SecurityWebFilterChain;
public class CustomWebFluxSecurityExample {
// @formatter:off
// tag::configuration[]
// tag::code[]
@Bean
public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
return http
@ -42,7 +42,7 @@ public class CustomWebFluxSecurityExample {
.formLogin().and()
.build();
}
// end::configuration[]
// end::code[]
// @formatter:on
}

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Spring Boot Features - Security" section.
*/
package org.springframework.boot.docs.springbootfeatures.security;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Spring Boot Features - Spring Session" section.
*/
package org.springframework.boot.docs.springbootfeatures.session;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs;
package org.springframework.boot.docs.springbootfeatures.springapplication;
import org.springframework.boot.ExitCodeGenerator;
import org.springframework.boot.SpringApplication;
@ -26,9 +26,9 @@ import org.springframework.context.annotation.Bean;
*
* @author Stephane Nicoll
*/
// tag::example[]
// tag::code[]
@SpringBootApplication
public class ExitCodeApplication {
public class ExitCodeExample {
@Bean
public ExitCodeGenerator exitCodeGenerator() {
@ -36,8 +36,8 @@ public class ExitCodeApplication {
}
public static void main(String[] args) {
System.exit(SpringApplication.exit(SpringApplication.run(ExitCodeApplication.class, args)));
System.exit(SpringApplication.exit(SpringApplication.run(ExitCodeExample.class, args)));
}
}
// end::example[]
// end::code[]

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.builder;
package org.springframework.boot.docs.springbootfeatures.springapplication;
import org.springframework.boot.Banner;
import org.springframework.boot.builder.SpringApplicationBuilder;
@ -28,13 +28,13 @@ public class SpringApplicationBuilderExample {
public void hierarchyWithDisabledBanner(String[] args) {
// @formatter:off
// tag::hierarchy[]
// tag::code[]
new SpringApplicationBuilder()
.sources(Parent.class)
.child(Application.class)
.bannerMode(Banner.Mode.OFF)
.run(args);
// end::hierarchy[]
// end::code[]
// @formatter:on
}

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Spring Boot Features - SpringApplication" section.
*/
package org.springframework.boot.docs.springbootfeatures.springapplication;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Spring Boot Features - Working with SQL Databases" section.
*/
package org.springframework.boot.docs.springbootfeatures.sql;

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Examples for the "Spring Boot Features - Task Execution and Scheduling" section.
*/
package org.springframework.boot.docs.springbootfeatures.task;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.test.context;
package org.springframework.boot.docs.springbootfeatures.testing;
import org.junit.jupiter.api.Test;
@ -24,7 +24,7 @@ import org.springframework.boot.test.context.SpringBootTest;
import static org.assertj.core.api.Assertions.assertThat;
// tag::example[]
// tag::code[]
@SpringBootTest(args = "--app.test=one")
class ApplicationArgumentsExampleTests {
@ -35,4 +35,4 @@ class ApplicationArgumentsExampleTests {
}
}
// end::example[]
// end::code[]

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,9 +14,9 @@
* limitations under the License.
*/
package org.springframework.boot.docs.test.web;
package org.springframework.boot.docs.springbootfeatures.testing;
// tag::test-mock-mvc[]
// tag::code[]
import org.junit.jupiter.api.Test;
@ -39,4 +39,4 @@ class MockMvcExampleTests {
}
}
// end::test-mock-mvc[]
// end::code[]

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,9 +14,9 @@
* limitations under the License.
*/
package org.springframework.boot.docs.test.web;
package org.springframework.boot.docs.springbootfeatures.testing;
// tag::test-mock-web-test-client[]
// tag::code[]
import org.junit.jupiter.api.Test;
@ -35,4 +35,4 @@ class MockWebTestClientExampleTests {
}
}
// end::test-mock-web-test-client[]
// end::code[]

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.test.system;
package org.springframework.boot.docs.springbootfeatures.testing;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
@ -29,7 +29,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Stephane Nicoll
*/
// tag::test[]
// tag::code[]
@ExtendWith(OutputCaptureExtension.class)
class OutputCaptureTests {
@ -40,4 +40,4 @@ class OutputCaptureTests {
}
}
// end::test[]
// end::code[]

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,9 +14,9 @@
* limitations under the License.
*/
package org.springframework.boot.docs.test.web;
package org.springframework.boot.docs.springbootfeatures.testing;
// tag::test-random-port[]
// tag::code[]
import org.junit.jupiter.api.Test;
@ -37,4 +37,4 @@ class RandomPortTestRestTemplateExampleTests {
}
}
// end::test-random-port[]
// end::code[]

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,9 +14,9 @@
* limitations under the License.
*/
package org.springframework.boot.docs.test.web;
package org.springframework.boot.docs.springbootfeatures.testing;
// tag::test-random-port[]
// tag::code[]
import org.junit.jupiter.api.Test;
@ -34,4 +34,4 @@ class RandomPortWebTestClientExampleTests {
}
}
// end::test-random-port[]
// end::code[]

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,11 +14,13 @@
* limitations under the License.
*/
package org.springframework.boot.docs.autoconfigure;
package org.springframework.boot.docs.springbootfeatures.testing;
import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.docs.springbootfeatures.creatingautoconfiguration.UserService;
import org.springframework.boot.docs.springbootfeatures.creatingautoconfiguration.UserServiceAutoConfiguration;
import org.springframework.boot.test.context.FilteredClassLoader;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.context.annotation.Bean;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docs.jmx;
package org.springframework.boot.docs.springbootfeatures.testing.jmx;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;

Some files were not shown because too many files have changed in this diff Show More