@ -2893,16 +2893,9 @@ Jersey has some native Spring support, so we also provide auto-configuration sup
@@ -2893,16 +2893,9 @@ Jersey has some native Spring support, so we also provide auto-configuration sup
To get started with Jersey, include the `spring-boot-starter-jersey` as a dependency and then you need one `@Bean` of type `ResourceConfig` in which you register all the endpoints, as shown in the following example:
WARNING: Jersey's support for scanning executable archives is rather limited.
@ -2913,18 +2906,9 @@ For more advanced customizations, you can also register an arbitrary number of b
@@ -2913,18 +2906,9 @@ For more advanced customizations, you can also register an arbitrary number of b
All the registered endpoints should be `@Components` with HTTP resource annotations (`@GET` and others), as shown in the following example:
Since the `Endpoint` is a Spring `@Component`, its lifecycle is managed by Spring and you can use the `@Autowired` annotation to inject dependencies and use the `@Value` annotation to inject external configuration.
@ -3036,21 +3020,9 @@ If you need to programmatically configure your embedded servlet container, you c
@@ -3036,21 +3020,9 @@ If you need to programmatically configure your embedded servlet container, you c
`WebServerFactoryCustomizer` provides access to the `ConfigurableServletWebServerFactory`, which includes numerous customization setter methods.
The following example shows programmatically setting the port:
`TomcatServletWebServerFactory`, `JettyServletWebServerFactory` and `UndertowServletWebServerFactory` are dedicated variants of `ConfigurableServletWebServerFactory` that have additional customization setter methods for Tomcat, Jetty and Undertow respectively.
@ -3058,7 +3030,7 @@ The following example shows how to customize `TomcatServletWebServerFactory` tha
@@ -3058,7 +3030,7 @@ The following example shows how to customize `TomcatServletWebServerFactory` tha
@ -3226,24 +3198,9 @@ This is done on purpose since this builder is stateful and you shouldn't create
@@ -3226,24 +3198,9 @@ This is done on purpose since this builder is stateful and you shouldn't create
The following code shows a typical example:
[source,java,pending-extract=true,indent=0]
[source,java,indent=0]
----
@Service
public class MyService {
private final Mono<RSocketRequester> rsocketRequester;
public MyService(RSocketRequester.Builder rsocketRequesterBuilder) {
@ -3310,7 +3267,7 @@ Spring Boot provides convenience methods that can be used to override access rul
@@ -3310,7 +3267,7 @@ Spring Boot provides convenience methods that can be used to override access rul
For example, you can customize your security configuration by adding something like:
@ -3389,19 +3346,9 @@ By default, Spring Security's `OAuth2LoginAuthenticationFilter` only processes U
@@ -3389,19 +3346,9 @@ By default, Spring Security's `OAuth2LoginAuthenticationFilter` only processes U
If you want to customize the `redirect-uri` to use a different pattern, you need to provide configuration to process that custom pattern.
For example, for servlet applications, you can add your own `SecurityFilterChain` that resembles the following:
[source,java,pending-extract=true,indent=0]
[source,java,indent=0]
----
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
TIP: Spring Boot auto-configures an `InMemoryOAuth2AuthorizedClientService` which is used by Spring Security for the management of client registrations.
@ -3713,25 +3660,9 @@ For example, the following section in `application.properties` shows how you can
@@ -3713,25 +3660,9 @@ For example, the following section in `application.properties` shows how you can
=== Using JdbcTemplate
Spring's `JdbcTemplate` and `NamedParameterJdbcTemplate` classes are auto-configured, and you can `@Autowire` them directly into your own beans, as shown in the following example:
You can customize some properties of the template by using the `spring.jdbc.template.*` properties, as shown in the following example:
@ -3773,49 +3704,9 @@ By default, all packages below your main configuration class (the one annotated
@@ -3773,49 +3704,9 @@ By default, all packages below your main configuration class (the one annotated
Any classes annotated with `@Entity`, `@Embeddable`, or `@MappedSuperclass` are considered.
A typical entity class resembles the following example:
[source,java,pending-extract=true,indent=0]
[source,java,indent=0]
----
package com.example.myapp.domain;
import java.io.Serializable;
import javax.persistence.*;
@Entity
public class City implements Serializable {
@Id
@GeneratedValue
private Long id;
@Column(nullable = false)
private String name;
@Column(nullable = false)
private String state;
// ... additional members, often include @OneToMany mappings
protected City() {
// no-args constructor required by JPA spec
// this one is protected since it shouldn't be used directly
TIP: You can customize entity scanning locations by using the `@EntityScan` annotation.
@ -3836,20 +3727,9 @@ If you use auto-configuration, repositories are searched from the package contai
@@ -3836,20 +3727,9 @@ If you use auto-configuration, repositories are searched from the package contai
The following example shows a typical Spring Data repository interface definition:
[source,java,pending-extract=true,indent=0]
[source,java,indent=0]
----
package com.example.myapp.domain;
import org.springframework.data.domain.*;
import org.springframework.data.repository.*;
public interface CityRepository extends Repository<City, Long> {
Page<City> findAll(Pageable pageable);
City findByNameAndStateAllIgnoringCase(String name, String state);