Fix broken and redirected links in the reference documentation
Fixes gh-18332
This commit is contained in:
parent
b483e78f55
commit
4ab53dc8ce
|
|
@ -16,7 +16,7 @@
|
|||
:spring-boot-version: current
|
||||
|
||||
:github-repo: spring-projects/spring-boot
|
||||
:github-raw: https://raw.github.com/{github-repo}/{github-tag}
|
||||
:github-raw: https://raw.githubusercontent.com/{github-repo}/{github-tag}
|
||||
:github-issues: https://github.com/{github-repo}/issues/
|
||||
:github-wiki: https://github.com/{github-repo}/wiki
|
||||
|
||||
|
|
@ -24,15 +24,15 @@
|
|||
:test-examples: {sources-root}/test/java/org/springframework/boot/docs
|
||||
|
||||
: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
|
||||
:spring-boot-api: https://docs.spring.io/spring-boot/docs/{spring-boot-version}/api/
|
||||
:spring-boot-docs: https://docs.spring.io/spring-boot/docs/{spring-boot-version}/reference
|
||||
:spring-boot-master-code: https://github.com/{github-repo}/tree/master
|
||||
:spring-boot-current-docs: https://docs.spring.io/spring-boot/docs/current/reference
|
||||
:spring-boot-actuator-restapi: https://docs.spring.io/spring-boot/docs/{spring-boot-version}/actuator-api/
|
||||
:spring-boot-maven-plugin-docs: https://docs.spring.io/spring-boot/docs/{spring-boot-version}/maven-plugin
|
||||
:spring-boot-gradle-plugin-docs: https://docs.spring.io/spring-boot/docs/{spring-boot-version}/gradle-plugin/reference/html
|
||||
:spring-boot-maven-plugin-docs: https://docs.spring.io/spring-boot/docs/{spring-boot-version}/maven-plugin/
|
||||
:spring-boot-gradle-plugin-docs: https://docs.spring.io/spring-boot/docs/{spring-boot-version}/gradle-plugin/reference/html/
|
||||
:spring-boot-gradle-plugin-pdfdocs: https://docs.spring.io/spring-boot/docs/{spring-boot-version}/gradle-plugin/reference/pdf/spring-boot-gradle-plugin-reference.pdf
|
||||
:spring-boot-gradle-plugin-api: https://docs.spring.io/spring-boot/docs/{spring-boot-version}/gradle-plugin/reference/html
|
||||
:spring-boot-gradle-plugin-api: https://docs.spring.io/spring-boot/docs/{spring-boot-version}/gradle-plugin/reference/api/
|
||||
|
||||
:spring-boot-module-code: {spring-boot-code}/spring-boot-project/spring-boot/src/main/java/org/springframework/boot
|
||||
:spring-boot-module-api: {spring-boot-api}/org/springframework/boot
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ To build a war file that is both executable and deployable into an external cont
|
|||
</project>
|
||||
----
|
||||
|
||||
TIP: See the "`<<howto-create-a-deployable-war-file>>`" section for more details on how to create a deployable war file.
|
||||
TIP: See the "`<<howto.adoc#howto-create-a-deployable-war-file>>`" section for more details on how to create a deployable war file.
|
||||
|
||||
Advanced configuration options and examples are available in the {spring-boot-maven-plugin-docs}[plugin info page].
|
||||
|
||||
|
|
@ -350,7 +350,7 @@ If your archive already includes libraries, you can use `Libraries.NONE`.
|
|||
|
||||
[[build-tool-plugins-find-a-main-class]]
|
||||
=== Finding a Main Class
|
||||
If you do not use `Repackager.setMainClass()` to specify a main class, the repackager uses https://asm.ow2.org/[ASM] to read class files and tries to find a suitable class with a `public static void main(String[] args)` method.
|
||||
If you do not use `Repackager.setMainClass()` to specify a main class, the repackager uses https://asm.ow2.io/[ASM] to read class files and tries to find a suitable class with a `public static void main(String[] args)` method.
|
||||
An exception is thrown if more than one candidate is found.
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -342,7 +342,7 @@ Google Cloud has several options that can be used to launch Spring Boot applicat
|
|||
The easiest to get started with is probably App Engine, but you could also find ways to run Spring Boot in a container with Container Engine or on a virtual machine with Compute Engine.
|
||||
|
||||
To run in App Engine, you can create a project in the UI first, which sets up a unique identifier for you and also sets up HTTP routes.
|
||||
Add a Java app to the project and leave it empty and then use the https://cloud.google.com/sdk/downloads[Google Cloud SDK] to push your Spring Boot app into that slot from the command line or CI build.
|
||||
Add a Java app to the project and leave it empty and then use the https://cloud.google.com/sdk/install[Google Cloud SDK] to push your Spring Boot app into that slot from the command line or CI build.
|
||||
|
||||
App Engine Standard requires you to use WAR packaging.
|
||||
Follow https://github.com/GoogleCloudPlatform/getting-started-java/blob/master/appengine-standard-java8/springboot-appengine-standard/README.md[these steps] to deploy App Engine Standard application to Google Cloud.
|
||||
|
|
|
|||
|
|
@ -77,9 +77,9 @@ Need more details about Spring Boot's core features?
|
|||
== Moving to Production
|
||||
When you are ready to push your Spring Boot application to production, we have <<production-ready-features.adoc#production-ready, some tricks>> that you might like:
|
||||
|
||||
* *Management endpoints:* <<production-ready-features.adoc#production-ready-endpoints, Overview>> | <<production-ready-features.adoc#production-ready-customizing-endpoints, Customization>>
|
||||
* *Management endpoints:* <<production-ready-features.adoc#production-ready-endpoints, Overview>>
|
||||
* *Connection options:* <<production-ready-features.adoc#production-ready-monitoring, HTTP>> | <<production-ready-features.adoc#production-ready-jmx, JMX>>
|
||||
* *Monitoring:* <<production-ready-features.adoc#production-ready-metrics, Metrics>> | <<production-ready-features.adoc#production-ready-auditing, Auditing>> | <<production-ready-features.adoc#production-ready-tracing, Tracing>> | <<production-ready-features.adoc#production-ready-process-monitoring, Process>>
|
||||
* *Monitoring:* <<production-ready-features.adoc#production-ready-metrics, Metrics>> | <<production-ready-features.adoc#production-ready-auditing, Auditing>> | <<production-ready-features.adoc#production-ready-http-tracing, HTTP Tracing>> | <<production-ready-features.adoc#production-ready-process-monitoring, Process>>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ The Spring Boot auto-configuration tries its best to "`do the right thing`", but
|
|||
|
||||
There is a really useful `ConditionEvaluationReport` available in any Spring Boot `ApplicationContext`.
|
||||
You can see it if you enable `DEBUG` logging output.
|
||||
If you use the `spring-boot-actuator` (see <<production-ready-features.adoc,the Actuator chapter>>), there is also a `conditions` endpoint that renders the report in JSON.
|
||||
If you use the `spring-boot-actuator` (see <<production-ready-features.adoc#production-ready,the Actuator chapter>>), there is also a `conditions` endpoint that renders the report in JSON.
|
||||
Use that endpoint to debug the application and see what features have been added (and which have not been added) by Spring Boot at runtime.
|
||||
|
||||
Many more questions can be answered by looking at the source code and the Javadoc.
|
||||
|
|
@ -80,7 +80,7 @@ There is more than one way to register additional customizations:
|
|||
* Declaratively, for all applications, by adding a `META-INF/spring.factories` and packaging a jar file that the applications all use as a library.
|
||||
|
||||
The `SpringApplication` sends some special `ApplicationEvents` to the listeners (some even before the context is created) and then registers the listeners for events published by the `ApplicationContext` as well.
|
||||
See "`<<spring-boot-features.adoc#boot-features-application-events-and-listeners>>`" in the '`Spring Boot features`' section for a complete list.
|
||||
See "`<<spring-boot-features.adoc#boot-features-application-events-and-listeners,Application Events and Listeners>>`" in the '`Spring Boot features`' section for a complete list.
|
||||
|
||||
It is also possible to customize the `Environment` before the application context is refreshed by using `EnvironmentPostProcessor`.
|
||||
Each implementation should be registered in `META-INF/spring.factories`, as shown in the following example:
|
||||
|
|
@ -397,7 +397,7 @@ There is not (and technically cannot be) an exhaustive list of all supported pro
|
|||
|
||||
A running application with the Actuator features has a `configprops` endpoint that shows all the bound and bindable properties available through `@ConfigurationProperties`.
|
||||
|
||||
The appendix includes an <<application-properties.adoc#common-application-properties, `application.properties`>> example with a list of the most common properties supported by Spring Boot.
|
||||
The appendix includes an <<appendix-application-properties.adoc#common-application-properties, `application.properties`>> example with a list of the most common properties supported by Spring Boot.
|
||||
The definitive list comes from searching the source code for `@ConfigurationProperties` and `@Value` annotations as well as the occasional use of `Binder`.
|
||||
For more about the exact ordering of loading properties, see "<<spring-boot-features#boot-features-external-config>>".
|
||||
|
||||
|
|
@ -643,7 +643,7 @@ Developers can choose to import only the required dependencies using a classifie
|
|||
=== Configure the Web Server
|
||||
Generally, you should first consider using one of the many available configuration keys and customize your web server by adding new entries in your `application.properties` (or `application.yml`, or environment, etc. see "`<<howto-discover-build-in-options-for-external-properties>>`").
|
||||
The `server.{asterisk}` namespace is quite useful here, and it includes namespaces like `server.tomcat.{asterisk}`, `server.jetty.{asterisk}` and others, for server-specific features.
|
||||
See the list of <<common-application-properties>>.
|
||||
See the list of <<appendix-application-properties.adoc#common-application-properties>>.
|
||||
|
||||
The previous sections covered already many common use cases, such as compression, SSL or HTTP/2.
|
||||
However, if a configuration key doesn't exist for your use case, you should then look at {spring-boot-module-api}/web/server/WebServerFactoryCustomizer.html[`WebServerFactoryCustomizer`].
|
||||
|
|
@ -1059,7 +1059,7 @@ These features are described in six enums (in Jackson) that map onto properties
|
|||
|===
|
||||
|
||||
For example, to enable pretty print, set `spring.jackson.serialization.indent_output=true`.
|
||||
Note that, thanks to the use of <<boot-features-external-config-relaxed-binding, relaxed binding>>, the case of `indent_output` does not have to match the case of the corresponding enum constant, which is `INDENT_OUTPUT`.
|
||||
Note that, thanks to the use of <<spring-boot-features.adoc#boot-features-external-config-relaxed-binding, relaxed binding>>, the case of `indent_output` does not have to match the case of the corresponding enum constant, which is `INDENT_OUTPUT`.
|
||||
|
||||
This environment-based configuration is applied to the auto-configured `Jackson2ObjectMapperBuilder` bean and applies to any mappers created by using the builder, including the auto-configured `ObjectMapper` bean.
|
||||
|
||||
|
|
@ -1373,7 +1373,7 @@ You also need to add `logging.file.name` to your `application.properties`, as sh
|
|||
|
||||
[[howto-configure-log4j-for-logging]]
|
||||
=== Configure Log4j for Logging
|
||||
Spring Boot supports https://logging.apache.org/log4j/2.x[Log4j 2] for logging configuration if it is on the classpath.
|
||||
Spring Boot supports https://logging.apache.org/log4j/2.x/[Log4j 2] for logging configuration if it is on the classpath.
|
||||
If you use the starters for assembling dependencies, you have to exclude Logback and then include log4j 2 instead.
|
||||
If you do not use the starters, you need to provide (at least) `spring-jcl` in addition to Log4j 2.
|
||||
|
||||
|
|
@ -1898,7 +1898,7 @@ Be careful when switching from in-memory to a '`real`' database that you do not
|
|||
You either have to set `ddl-auto` explicitly or use one of the other mechanisms to initialize the database.
|
||||
|
||||
NOTE: You can output the schema creation by enabling the `org.hibernate.SQL` logger.
|
||||
This is done for you automatically if you enable the <<boot-features-logging-console-output,debug mode>>.
|
||||
This is done for you automatically if you enable the <<spring-boot-features.adoc#boot-features-logging-console-output,debug mode>>.
|
||||
|
||||
In addition, a file named `import.sql` in the root of the classpath is executed on startup if Hibernate creates the schema from scratch (that is, if the `ddl-auto` property is set to `create` or `create-drop`).
|
||||
This can be useful for demos and for testing if you are careful but is probably not something you want to be on the classpath in production.
|
||||
|
|
@ -2136,7 +2136,7 @@ In general, you need a `View` that resolves with a name of `error` or a `@Contro
|
|||
Unless you replaced some of the default configuration, you should find a `BeanNameViewResolver` in your `ApplicationContext`, so a `@Bean` named `error` would be a simple way of doing that.
|
||||
See {spring-boot-autoconfigure-module-code}/web/servlet/error/ErrorMvcAutoConfiguration.java[`ErrorMvcAutoConfiguration`] for more options.
|
||||
|
||||
See also the section on "`<<boot-features-error-handling, Error Handling>>`" for details of how to register handlers in the servlet container.
|
||||
See also the section on "`<<spring-boot-features.adoc#boot-features-error-handling, Error Handling>>`" for details of how to register handlers in the servlet container.
|
||||
|
||||
|
||||
|
||||
|
|
@ -2263,7 +2263,7 @@ See {spring-boot-autoconfigure-module-code}/groovy/template/GroovyTemplateAutoCo
|
|||
[[howto-reload-fast-restart]]
|
||||
=== Fast Application Restarts
|
||||
The `spring-boot-devtools` module includes support for automatic application restarts.
|
||||
While not as fast as technologies such as https://zeroturnaround.com/software/jrebel/[JRebel] it is usually significantly faster than a "`cold start`".
|
||||
While not as fast as technologies such as https://jrebel.com/software/jrebel/[JRebel] it is usually significantly faster than a "`cold start`".
|
||||
You should probably give it a try before investigating some of the more complex reload options discussed later in this document.
|
||||
|
||||
For more details, see the <<using-spring-boot.adoc#using-boot-devtools>> section.
|
||||
|
|
|
|||
|
|
@ -25,4 +25,4 @@ The reference documentation has the following appendices:
|
|||
<<appendix-auto-configuration-classes.adoc#auto-configuration-classes,Auto-configuration Classes>> :: Auto-configuration classes provided by Spring Boot.
|
||||
<<appendix-test-auto-configuration.adoc#test-auto-configuration,Test Auto-configuration Annotations>> :: Test-autoconfiguration annotations used to test slices of your application.
|
||||
<<appendix-executable-jar-format.adoc#executable-jar,Executable Jars>> :: Spring Boot's executable jars, their launchers, and their format.
|
||||
<<appendix-dependency-versions.adoc#appendex-dependency-versions,Dependency Versions>> :: Details of the dependencies that are managed by Spring Boot.
|
||||
<<appendix-dependency-versions.adoc#appendix-dependency-versions,Dependency Versions>> :: Details of the dependencies that are managed by Spring Boot.
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ If your application is a web application (Spring MVC, Spring WebFlux, or Jersey)
|
|||
| Yes
|
||||
|===
|
||||
|
||||
To learn more about the Actuator's endpoints and their request and response formats, please refer to the separate API documentation ({spring-boot-actuator-restapi}/html[HTML] or {spring-boot-actuator-restapi}/pdf/spring-boot-actuator-web-api.pdf[PDF]).
|
||||
To learn more about the Actuator's endpoints and their request and response formats, please refer to the separate API documentation ({spring-boot-actuator-restapi}/html/[HTML] or {spring-boot-actuator-restapi}/pdf/spring-boot-actuator-web-api.pdf[PDF]).
|
||||
|
||||
|
||||
|
||||
|
|
@ -1562,7 +1562,7 @@ For advanced configuration, you can also provide your own `PrometheusPushGateway
|
|||
[[production-ready-metrics-export-signalfx]]
|
||||
==== SignalFx
|
||||
SignalFx registry pushes metrics to {micrometer-registry-docs}/signalfx[SignalFx] periodically.
|
||||
To export metrics to https://signalfx.com[SignalFx], your access token must be provided:
|
||||
To export metrics to https://www.signalfx.com[SignalFx], your access token must be provided:
|
||||
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
|
|
@ -1658,7 +1658,7 @@ Spring Boot registers the following core metrics when applicable:
|
|||
* Logback metrics: record the number of events logged to Logback at each level
|
||||
* Uptime metrics: report a gauge for uptime and a fixed gauge representing the application's absolute start time
|
||||
* Tomcat metrics (`server.tomcat.mbeanregistry.enabled` must be set to `true` for all Tomcat metrics to be registered)
|
||||
* {spring-integration-docs}#micrometer-integration[Spring Integration] metrics
|
||||
* {spring-integration-docs}system-management.html#micrometer-integration[Spring Integration] metrics
|
||||
|
||||
|
||||
|
||||
|
|
@ -2138,6 +2138,6 @@ include::{code-examples}/cloudfoundry/CloudFoundryCustomContextPathExample.java[
|
|||
[[production-ready-whats-next]]
|
||||
== What to Read Next
|
||||
If you want to explore some of the concepts discussed in this chapter, you can take a look at the actuator {spring-boot-code}/spring-boot-samples[sample applications].
|
||||
You also might want to read about graphing tools such as https://graphite.wikidot.com/[Graphite].
|
||||
You also might want to read about graphing tools such as https://graphiteapp.org[Graphite].
|
||||
|
||||
Otherwise, you can continue on, to read about <<deployment.adoc#deployment, '`deployment options`'>> or jump ahead for some in-depth information about Spring Boot's _<<build-tool-plugins.adoc#build-tool-plugins, build tool plugins>>_.
|
||||
|
|
|
|||
|
|
@ -349,7 +349,7 @@ Property values can be injected directly into your beans by using the `@Value` a
|
|||
Spring Boot uses a very particular `PropertySource` order that is designed to allow sensible overriding of values.
|
||||
Properties are considered in the following order:
|
||||
|
||||
. <<using-boot-devtools-globalsettings,Devtools global settings properties>> in the `$HOME/.config/spring-boot` folder when devtools is active.
|
||||
. <<using-spring-boot.adoc#using-boot-devtools-globalsettings,Devtools global settings properties>> in the `$HOME/.config/spring-boot` folder when devtools is active.
|
||||
. {spring-framework-api}/test/context/TestPropertySource.html[`@TestPropertySource`] annotations on your tests.
|
||||
. `properties` attribute on your tests.
|
||||
Available on {spring-boot-test-module-api}/context/SpringBootTest.html[`@SpringBootTest`] and the <<boot-features-testing-spring-boot-applications-testing-autoconfigured-tests,test annotations for testing a particular slice of your application>>.
|
||||
|
|
@ -556,7 +556,7 @@ See the _<<howto.adoc#howto-use-short-command-line-arguments>>_ how-to for detai
|
|||
=== Encrypting Properties
|
||||
Spring Boot does not provide any built in support for encrypting property values, however, it does provide the hook points necessary to modify values contained in the Spring `Environment`.
|
||||
The `EnvironmentPostProcessor` interface allows you to manipulate the `Environment` before the application starts.
|
||||
See <<howto-customize-the-environment-or-application-context>> for details.
|
||||
See <<howto.adoc#howto-customize-the-environment-or-application-context>> for details.
|
||||
|
||||
If you're looking for a secure way to store credentials and passwords, the https://cloud.spring.io/spring-cloud-vault/[Spring Cloud Vault] project provides support for storing externalized configuration in https://www.vaultproject.io/[HashiCorp Vault].
|
||||
|
||||
|
|
@ -1444,7 +1444,7 @@ For example, when an application with the following properties is run by using t
|
|||
----
|
||||
|
||||
NOTE: Remember that the `spring.profiles` property can be defined in a YAML document to determine when this particular document is included in the configuration.
|
||||
See <<howto-change-configuration-depending-on-the-environment>> for more details.
|
||||
See <<howto.adoc#howto-change-configuration-depending-on-the-environment>> for more details.
|
||||
|
||||
|
||||
|
||||
|
|
@ -2408,9 +2408,9 @@ Note that doing so disables the `ObjectMapper` customization described earlier.
|
|||
==== CORS Support
|
||||
https://en.wikipedia.org/wiki/Cross-origin_resource_sharing[Cross-origin resource sharing] (CORS) is a https://www.w3.org/TR/cors/[W3C specification] implemented by https://caniuse.com/#feat=cors[most browsers] that lets you specify in a flexible way what kind of cross-domain requests are authorized., instead of using some less secure and less powerful approaches such as IFRAME or JSONP.
|
||||
|
||||
As of version 4.2, Spring MVC {spring-framework-docs}web.html#cors[supports CORS].
|
||||
Using {spring-framework-docs}web.html#controller-method-cors-configuration[controller method CORS configuration] with {spring-framework-api}/web/bind/annotation/CrossOrigin.html[`@CrossOrigin`] annotations in your Spring Boot application does not require any specific configuration.
|
||||
{spring-framework-docs}web.html#global-cors-configuration[Global CORS configuration] can be defined by registering a `WebMvcConfigurer` bean with a customized `addCorsMappings(CorsRegistry)` method, as shown in the following example:
|
||||
As of version 4.2, Spring MVC {spring-framework-docs}web.html#mvc-cors[supports CORS].
|
||||
Using {spring-framework-docs}web.html#mvc-cors-controller[controller method CORS configuration] with {spring-framework-api}/web/bind/annotation/CrossOrigin.html[`@CrossOrigin`] annotations in your Spring Boot application does not require any specific configuration.
|
||||
{spring-framework-docs}web.html#mvc-cors-global[Global CORS configuration] can be defined by registering a `WebMvcConfigurer` bean with a customized `addCorsMappings(CorsRegistry)` method, as shown in the following example:
|
||||
|
||||
[source,java,indent=0]
|
||||
----
|
||||
|
|
@ -2518,7 +2518,7 @@ The auto-configuration adds the following features on top of Spring's defaults:
|
|||
* Configuring codecs for `HttpMessageReader` and `HttpMessageWriter` instances (described <<boot-features-webflux-httpcodecs,later in this document>>).
|
||||
* Support for serving static resources, including support for WebJars (described <<boot-features-spring-mvc-static-content,later in this document>>).
|
||||
|
||||
If you want to keep Spring Boot WebFlux features and you want to add additional {spring-framework-docs}web.html#web-reactive[WebFlux configuration], you can add your own `@Configuration` class of type `WebFluxConfigurer` but *without* `@EnableWebFlux`.
|
||||
If you want to keep Spring Boot WebFlux features and you want to add additional {spring-framework-docs}web-reactive.html#webflux-config[WebFlux configuration], you can add your own `@Configuration` class of type `WebFluxConfigurer` but *without* `@EnableWebFlux`.
|
||||
|
||||
If you want to take complete control of Spring WebFlux, you can add your own `@Configuration` annotated with `@EnableWebFlux`.
|
||||
|
||||
|
|
@ -5253,7 +5253,7 @@ You can customize this behaviour using the `spring.kafka.streams.auto-startup` p
|
|||
|
||||
[[boot-features-kafka-extra-props]]
|
||||
==== Additional Kafka Properties
|
||||
The properties supported by auto configuration are shown in <<common-application-properties>>.
|
||||
The properties supported by auto configuration are shown in <<appendix-application-properties.adoc#common-application-properties>>.
|
||||
Note that, for the most part, these properties (hyphenated or camelCase) map directly to the Apache Kafka dotted properties.
|
||||
Refer to the Apache Kafka documentation for details.
|
||||
|
||||
|
|
@ -5931,7 +5931,7 @@ When testing Spring Boot applications, this is often not required.
|
|||
Spring Boot's `@*Test` annotations search for your primary configuration automatically whenever you do not explicitly define one.
|
||||
|
||||
The search algorithm works up from the package that contains the test until it finds a class annotated with `@SpringBootApplication` or `@SpringBootConfiguration`.
|
||||
As long as you <<using-boot-structuring-your-code, structured your code>> in a sensible way, your main configuration is usually found.
|
||||
As long as you <<using-spring-boot.adoc#using-boot-structuring-your-code, structured your code>> in a sensible way, your main configuration is usually found.
|
||||
|
||||
[NOTE]
|
||||
====
|
||||
|
|
@ -6026,7 +6026,7 @@ If you need to test these lower-level concerns, you can start a fully running se
|
|||
If you need to start a full running server, we recommend that you use random ports.
|
||||
If you use `@SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT)`, an available port is picked at random each time your test runs.
|
||||
|
||||
The `@LocalServerPort` annotation can be used to <<howto-discover-the-http-port-at-runtime,inject the actual port used>> into your test.
|
||||
The `@LocalServerPort` annotation can be used to <<howto.adoc#howto-discover-the-http-port-at-runtime,inject the actual port used>> into your test.
|
||||
For convenience, tests that need to make REST calls to the started server can additionally `@Autowire` a {spring-framework-docs}testing.html#webtestclient-tests[`WebTestClient`], which resolves relative links to the running server and comes with a dedicated API for verifying responses, as shown in the following example:
|
||||
|
||||
[source,java,indent=0]
|
||||
|
|
@ -7604,7 +7604,6 @@ This makes it possible to use `@BeforeClass` and `@AfterClass` annotations on no
|
|||
|
||||
JUnit 5 is the default and the vintage engine is provided for backward compatibility with JUnit 4.
|
||||
If you don't use it, exclude `org.junit.vintange:junit-vintage-engine`.
|
||||
See the {junit5-docs}/#dependency-metadata-junit-jupiter-samples[JUnit 5 documentation] for more details.
|
||||
You also need to {junit5-docs}/#writing-tests-test-instance-lifecycle-changing-default[switch test instance lifecycle to "per-class"].
|
||||
|
||||
To mock Kotlin classes, https://mockk.io/[MockK] is recommended.
|
||||
|
|
|
|||
Loading…
Reference in New Issue