Skip to content

Commit

Permalink
Use fully-qualified names for ambiguous type references
Browse files Browse the repository at this point in the history
Update type references to use a fully qualified name when we have
more than one candidate available to us.

See gh-43239
  • Loading branch information
philwebb committed Nov 21, 2024
1 parent e8e9592 commit 0e62778
Show file tree
Hide file tree
Showing 49 changed files with 256 additions and 255 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ For more detail, see the javadoc:org.springframework.boot.actuate.autoconfigure.
== Customizing Sanitization

To take control over the sanitization, define a `SanitizingFunction` bean.
The `SanitizableData` with which the function is called provides access to the key and value as well as the `PropertySource` from which they came.
The `SanitizableData` with which the function is called provides access to the key and value as well as the `org.springframework.core.env.PropertySource` from which they came.
This allows you to, for example, sanitize every value that comes from a particular property source.
Each `SanitizingFunction` is called in order until a function changes the value of the sanitizable data.

Expand All @@ -30,7 +30,7 @@ Each `SanitizingFunction` is called in order until a function changes the value
[[howto.actuator.map-health-indicators-to-metrics]]
== Map Health Indicators to Micrometer Metrics

Spring Boot health indicators return a `Status` type to indicate the overall system health.
Spring Boot health indicators return a `org.springframework.boot.actuate.health.Status` type to indicate the overall system health.
If you want to monitor or alert on levels of health for a particular application, you can export these statuses as metrics with Micrometer.
By default, the status codes "`UP`", "`DOWN`", "`OUT_OF_SERVICE`" and "`UNKNOWN`" are used by Spring Boot.
To export these, you will need to convert these states to some set of numbers so that they can be used with a Micrometer `Gauge`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ If you do so and want two task executors (for example by retaining the auto-conf

Spring Batch auto-configuration is enabled by adding `spring-boot-starter-batch` to your application's classpath.

If a single `Job` bean is found in the application context, it is executed on startup (see javadoc:org.springframework.boot.autoconfigure.batch.JobLauncherApplicationRunner[] for details).
If multiple `Job` beans are found, the job that should be executed must be specified using configprop:spring.batch.job.name[].
If a single `org.springframework.batch.core.Job` bean is found in the application context, it is executed on startup (see javadoc:org.springframework.boot.autoconfigure.batch.JobLauncherApplicationRunner[] for details).
If multiple `org.springframework.batch.core.Job` beans are found, the job that should be executed must be specified using configprop:spring.batch.job.name[].

To disable running a `Job` found in the application context, set the configprop:spring.batch.job.enabled[] to `false`.
To disable running a `org.springframework.batch.core.Job` found in the application context, set the configprop:spring.batch.job.enabled[] to `false`.

See {code-spring-boot-autoconfigure-src}/batch/BatchAutoConfiguration.java[`BatchAutoConfiguration`] for more details.

Expand Down Expand Up @@ -78,7 +78,7 @@ This provides only one argument to the batch job: `someParameter=someValue`.
[[howto.batch.restarting-a-failed-job]]
== Restarting a Stopped or Failed Job

To restart a failed `Job`, all parameters (identifying and non-identifying) must be re-specified on the command line.
To restart a failed `org.springframework.batch.core.Job`, all parameters (identifying and non-identifying) must be re-specified on the command line.
Non-identifying parameters are *not* copied from the previous execution.
This allows them to be modified or removed.

Expand All @@ -89,6 +89,6 @@ NOTE: When you're using a custom `JobParametersIncrementer`, you have to gather
[[howto.batch.storing-job-repository]]
== Storing the Job Repository

Spring Batch requires a data store for the `Job` repository.
Spring Batch requires a data store for the `org.springframework.batch.core.Job` repository.
If you use Spring Boot, you must use an actual database.
Note that it can be an in-memory database, see {url-spring-batch-docs}/job.html#configuringJobRepository[Configuring a Job Repository].
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Both the Maven and Gradle plugins allow the properties that are included in `git

TIP: The commit time in `git.properties` is expected to match the following format: `yyyy-MM-dd'T'HH:mm:ssZ`.
This is the default format for both plugins listed above.
Using this format lets the time be parsed into a `Date` and its format, when serialized to JSON, to be controlled by Jackson's date serialization configuration settings.
Using this format lets the time be parsed into a `java.util.Date` and its format, when serialized to JSON, to be controlled by Jackson's date serialization configuration settings.



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,14 @@ See xref:reference:data/sql.adoc#data.sql.datasource.connection-pool[] for detai
[[howto.data-access.spring-data-repositories]]
== Use Spring Data Repositories

Spring Data can create implementations of `Repository` interfaces of various flavors.
Spring Boot handles all of that for you, as long as those `Repository` implementations are included in one of the xref:reference:using/auto-configuration.adoc#using.auto-configuration.packages[auto-configuration packages], typically the package (or a sub-package) of your main application class that is annotated with `@SpringBootApplication` or `@EnableAutoConfiguration`.
Spring Data can create implementations of `org.springframework.data.repository.Repository` interfaces of various flavors.
Spring Boot handles all of that for you, as long as those `org.springframework.data.repository.Repository` implementations are included in one of the xref:reference:using/auto-configuration.adoc#using.auto-configuration.packages[auto-configuration packages], typically the package (or a sub-package) of your main application class that is annotated with `@SpringBootApplication` or `@EnableAutoConfiguration`.

For many applications, all you need is to put the right Spring Data dependencies on your classpath.
There is a `spring-boot-starter-data-jpa` for JPA, `spring-boot-starter-data-mongodb` for Mongodb, and various other starters for supported technologies.
To get started, create some repository interfaces to handle your `@Entity` objects.

Spring Boot determines the location of your `Repository` implementations by scanning the xref:reference:using/auto-configuration.adoc#using.auto-configuration.packages[auto-configuration packages].
Spring Boot determines the location of your `org.springframework.data.repository.Repository` implementations by scanning the xref:reference:using/auto-configuration.adoc#using.auto-configuration.packages[auto-configuration packages].
For more control, use the `@Enable…Repositories` annotations from Spring Data.

For more about Spring Data, see the {url-spring-data-site}[Spring Data project page].
Expand Down Expand Up @@ -279,8 +279,8 @@ Then, add a `HibernatePropertiesCustomizer` bean as shown in the following examp

include-code::MyHibernateSecondLevelCacheConfiguration[]

This customizer will configure Hibernate to use the same `CacheManager` as the one that the application uses.
It is also possible to use separate `CacheManager` instances.
This customizer will configure Hibernate to use the same `org.springframework.cache.CacheManager` as the one that the application uses.
It is also possible to use separate `org.springframework.cache.CacheManager` instances.
For details, see {url-hibernate-userguide}#caching-provider-jcache[the Hibernate user guide].


Expand All @@ -301,7 +301,7 @@ To take full control of the configuration of the `EntityManagerFactory`, you nee
Spring Boot auto-configuration switches off its entity manager in the presence of a bean of that type.

NOTE: When you create a bean for `LocalContainerEntityManagerFactoryBean` yourself, any customization that was applied during the creation of the auto-configured `LocalContainerEntityManagerFactoryBean` is lost.
Make sure to use the auto-configured `EntityManagerFactoryBuilder` to retain JPA and vendor properties.
Make sure to use the auto-configured `org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder` to retain JPA and vendor properties.
This is particularly important if you were relying on `spring.jpa.*` properties for configuring things like the naming strategy or the DDL mode.


Expand Down Expand Up @@ -348,9 +348,9 @@ See {code-spring-boot-autoconfigure-src}/orm/jpa/JpaBaseConfiguration.java[`JpaB
[[howto.data-access.use-spring-data-jpa-and-mongo-repositories]]
== Use Spring Data JPA and Mongo Repositories

Spring Data JPA and Spring Data Mongo can both automatically create `Repository` implementations for you.
Spring Data JPA and Spring Data Mongo can both automatically create `org.springframework.data.repository.Repository` implementations for you.
If they are both present on the classpath, you might have to do some extra configuration to tell Spring Boot which repositories to create.
The most explicit way to do that is to use the standard Spring Data `@EnableJpaRepositories` and `@EnableMongoRepositories` annotations and provide the location of your `Repository` interfaces.
The most explicit way to do that is to use the standard Spring Data `@EnableJpaRepositories` and `@EnableMongoRepositories` annotations and provide the location of your `org.springframework.data.repository.Repository` interfaces.

There are also flags (`+spring.data.*.repositories.enabled+` and `+spring.data.*.repositories.type+`) that you can use to switch the auto-configured repositories on and off in external configuration.
Doing so is useful, for instance, in case you want to switch off the Mongo repositories and still use the auto-configured `MongoTemplate`.
Expand All @@ -372,7 +372,7 @@ Note that if you are using Spring Data REST, you must use the properties in the
[[howto.data-access.exposing-spring-data-repositories-as-rest]]
== Expose Spring Data Repositories as REST Endpoint

Spring Data REST can expose the `Repository` implementations as REST endpoints for you,
Spring Data REST can expose the `org.springframework.data.repository.Repository` implementations as REST endpoints for you,
provided Spring MVC has been enabled for the application.

Spring Boot exposes a set of useful properties (from the `spring.data.rest` namespace) that customize the javadoc:{url-spring-data-rest-javadoc}/org.springframework.data.rest.core.config.RepositoryRestConfiguration[].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ It is recommended to use a single mechanism for schema generation.
You can set configprop:spring.jpa.hibernate.ddl-auto[] to control Hibernate's database initialization.
Supported values are `none`, `validate`, `update`, `create`, and `create-drop`.
Spring Boot chooses a default value for you based on whether you are using an embedded database.
An embedded database is identified by looking at the `Connection` type and JDBC url.
An embedded database is identified by looking at the `java.sql.Connection` type and JDBC url.
`hsqldb`, `h2`, or `derby` are embedded databases and others are not.
If an embedded database is identified and no schema manager (Flyway or Liquibase) has been detected, `ddl-auto` defaults to `create-drop`.
In all other cases, it defaults to `none`.
Expand All @@ -33,7 +33,7 @@ It is a Hibernate feature (and has nothing to do with Spring).
[[howto.data-initialization.using-basic-sql-scripts]]
== Initialize a Database Using Basic SQL Scripts

Spring Boot can automatically create the schema (DDL scripts) of your JDBC `DataSource` or R2DBC `ConnectionFactory` and initialize its data (DML scripts).
Spring Boot can automatically create the schema (DDL scripts) of your JDBC `DataSource` or R2DBC `io.r2dbc.spi.ConnectionFactory` and initialize its data (DML scripts).

By default, it loads schema scripts from `optional:classpath*:schema.sql` and data scripts from `optional:classpath*:data.sql`.
The locations of these schema and data scripts can be customized using configprop:spring.sql.init.schema-locations[] and configprop:spring.sql.init.data-locations[] respectively.
Expand Down Expand Up @@ -139,9 +139,9 @@ If you would like more control, provide a `@Bean` that implements javadoc:org.sp

Flyway supports SQL and Java https://documentation.red-gate.com/fd/callback-concept-184127466.html[callbacks].
To use SQL-based callbacks, place the callback scripts in the `classpath:db/migration` directory.
To use Java-based callbacks, create one or more beans that implement `Callback`.
To use Java-based callbacks, create one or more beans that implement `org.flywaydb.core.api.callback.Callback`.
Any such beans are automatically registered with `Flyway`.
They can be ordered by using `@Order` or by implementing `Ordered`.
They can be ordered by using `@org.springframework.core.annotation.Order` or by implementing `org.springframework.core.Ordered`.

By default, Flyway autowires the (`@Primary`) `DataSource` in your context and uses that for migrations.
If you like to use a different `DataSource`, you can create one and mark its `@Bean` as `@FlywayDataSource`.
Expand Down Expand Up @@ -190,7 +190,7 @@ If any of the three properties has not been set, the value of its equivalent `sp

See javadoc:org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties[] for details about available settings such as contexts, the default schema, and others.

You can also use a `Customizer<Liquibase>` bean if you want to customize the `Liquibase` instance before it is being used.
You can also use a `Customizer<Liquibase>` bean if you want to customize the `liquibase.Liquibase` instance before it is being used.



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ If you have other features in your application (for instance, using other servle

* A `@Bean` of type `Servlet` or `ServletRegistrationBean` installs that bean in the container as if it were a `<servlet/>` and `<servlet-mapping/>` in `web.xml`.
* A `@Bean` of type `Filter` or `FilterRegistrationBean` behaves similarly (as a `<filter/>` and `<filter-mapping/>`).
* An `ApplicationContext` in an XML file can be added through an `@ImportResource` in your `Application`.
* An `ApplicationContext` in an XML file can be added through an `@ImportResource` in your `+Application+`.
Alternatively, cases where annotation configuration is heavily used already can be recreated in a few lines as `@Bean` definitions.

Once the war file is working, you can make it executable by adding a `main` method to your `+Application+`, as shown in the following example:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The exact details of the proxy configuration depend on the underlying client req

When Reactor Netty is on the classpath a Reactor Netty-based `WebClient` is auto-configured.
To customize the client's handling of network connections, provide a `ClientHttpConnector` bean.
The following example configures a 60 second connect timeout and adds a `ReadTimeoutHandler`:
The following example configures a 60 second connect timeout and adds a `io.netty.handler.timeout.ReadTimeoutHandler`:

include-code::MyReactorNettyClientConfiguration[]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Spring Security can be used to secure a Jersey-based web application in much the
However, if you want to use Spring Security's method-level security with Jersey, you must configure Jersey to use `setStatus(int)` rather `sendError(int)`.
This prevents Jersey from committing the response before Spring Security has had an opportunity to report an authentication or authorization failure to the client.

The `jersey.config.server.response.setStatusOverSendError` property must be set to `true` on the application's `ResourceConfig` bean, as shown in the following example:
The `jersey.config.server.response.setStatusOverSendError` property must be set to `true` on the application's `org.glassfish.jersey.server.ResourceConfig` bean, as shown in the following example:

include-code::JerseySetStatusOverSendErrorConfig[]

Expand All @@ -21,6 +21,6 @@ include-code::JerseySetStatusOverSendErrorConfig[]

To use Jersey alongside another web framework, such as Spring MVC, it should be configured so that it will allow the other framework to handle requests that it cannot handle.
First, configure Jersey to use a filter rather than a servlet by configuring the configprop:spring.jersey.type[] application property with a value of `filter`.
Second, configure your `ResourceConfig` to forward requests that would have resulted in a 404, as shown in the following example.
Second, configure your `org.glassfish.jersey.server.ResourceConfig` to forward requests that would have resulted in a 404, as shown in the following example.

include-code::JerseyConfig[]
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ These includes are designed to allow certain common Spring Boot conventions to b
The following files are provided under `org/springframework/boot/logging/logback/`:

* `defaults.xml` - Provides conversion rules, pattern properties and common logger configurations.
* `console-appender.xml` - Adds a `ConsoleAppender` using the `CONSOLE_LOG_PATTERN`.
* `structured-console-appender.xml` - Adds a `ConsoleAppender` using structured logging in the `CONSOLE_LOG_STRUCTURED_FORMAT`.
* `file-appender.xml` - Adds a `RollingFileAppender` using the `FILE_LOG_PATTERN` and `ROLLING_FILE_NAME_PATTERN` with appropriate settings.
* `structured-file-appender.xml` - Adds a `RollingFileAppender` using the `ROLLING_FILE_NAME_PATTERN` with structured logging in the `FILE_LOG_STRUCTURED_FORMAT`.
* `console-appender.xml` - Adds a `ch.qos.logback.core.ConsoleAppender` using the `CONSOLE_LOG_PATTERN`.
* `structured-console-appender.xml` - Adds a `ch.qos.logback.core.ConsoleAppender` using structured logging in the `CONSOLE_LOG_STRUCTURED_FORMAT`.
* `file-appender.xml` - Adds a `ch.qos.logback.core.rolling.RollingFileAppender` using the `FILE_LOG_PATTERN` and `ROLLING_FILE_NAME_PATTERN` with appropriate settings.
* `structured-file-appender.xml` - Adds a `ch.qos.logback.core.rolling.RollingFileAppender` using the `ROLLING_FILE_NAME_PATTERN` with structured logging in the `FILE_LOG_STRUCTURED_FORMAT`.

In addition, a legacy `base.xml` file is provided for compatibility with earlier versions of Spring Boot.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ If you define a `@Configuration` with a `SecurityFilterChain` bean in your appli
[[howto.security.change-user-details-service-and-add-user-accounts]]
== Change the UserDetailsService and Add User Accounts

If you provide a `@Bean` of type `AuthenticationManager`, `AuthenticationProvider`, or `UserDetailsService`, the default `@Bean` for `InMemoryUserDetailsManager` is not created.
If you provide a `@Bean` of type `AuthenticationManager`, `org.springframework.security.authentication.AuthenticationProvider`, or `UserDetailsService`, the default `@Bean` for `InMemoryUserDetailsManager` is not created.
This means you have the full feature set of Spring Security available (such as {url-spring-security-docs}/servlet/authentication/index.html[various authentication options]).

The easiest way to add user accounts is by providing your own `UserDetailsService` bean.
Expand Down
Loading

0 comments on commit 0e62778

Please sign in to comment.