Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
0d6ea790
Commit
0d6ea790
authored
Jun 22, 2020
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Start building against Spring Framework 5.3.0 snapshots
See gh-21929
parent
a0946c89
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
59 additions
and
61 deletions
+59
-61
AbstractWebMvcEndpointHandlerMapping.java
...int/web/servlet/AbstractWebMvcEndpointHandlerMapping.java
+9
-26
SkipPathExtensionContentNegotiation.java
...oint/web/servlet/SkipPathExtensionContentNegotiation.java
+3
-3
MvcWebEndpointIntegrationTests.java
.../endpoint/web/servlet/MvcWebEndpointIntegrationTests.java
+8
-1
StaticResourceRequest.java
...utoconfigure/security/reactive/StaticResourceRequest.java
+3
-2
WebMvcAutoConfiguration.java
...ot/autoconfigure/web/servlet/WebMvcAutoConfiguration.java
+13
-12
WebClientAutoConfigurationTests.java
...tive/function/client/WebClientAutoConfigurationTests.java
+2
-0
WebMvcAutoConfigurationTests.java
...toconfigure/web/servlet/WebMvcAutoConfigurationTests.java
+6
-2
build.gradle
spring-boot-project/spring-boot-dependencies/build.gradle
+1
-1
JsonTestersAutoConfiguration.java
...test/autoconfigure/json/JsonTestersAutoConfiguration.java
+3
-3
ExampleRepository.java
...ework/boot/test/autoconfigure/jdbc/ExampleRepository.java
+2
-3
DataJpaTestIntegrationTests.java
...st/autoconfigure/orm/jpa/DataJpaTestIntegrationTests.java
+1
-1
MockitoPostProcessor.java
...ramework/boot/test/mock/mockito/MockitoPostProcessor.java
+5
-4
ErrorPageFilterIntegrationTests.java
.../web/servlet/support/ErrorPageFilterIntegrationTests.java
+3
-3
No files found.
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/AbstractWebMvcEndpointHandlerMapping.java
View file @
0d6ea790
...
...
@@ -59,12 +59,9 @@ import org.springframework.web.method.HandlerMethod;
import
org.springframework.web.servlet.HandlerMapping
;
import
org.springframework.web.servlet.handler.MatchableHandlerMapping
;
import
org.springframework.web.servlet.handler.RequestMatchResult
;
import
org.springframework.web.servlet.mvc.condition.ConsumesRequestCondition
;
import
org.springframework.web.servlet.mvc.condition.PatternsRequestCondition
;
import
org.springframework.web.servlet.mvc.condition.ProducesRequestCondition
;
import
org.springframework.web.servlet.mvc.condition.RequestMethodsRequestCondition
;
import
org.springframework.web.servlet.mvc.method.RequestMappingInfo
;
import
org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping
;
import
org.springframework.web.util.UrlPathHelper
;
/**
* A custom {@link HandlerMapping} that makes {@link ExposableWebEndpoint web endpoints}
...
...
@@ -161,7 +158,6 @@ public abstract class AbstractWebMvcEndpointHandlerMapping extends RequestMappin
@SuppressWarnings
(
"deprecation"
)
private
static
RequestMappingInfo
.
BuilderConfiguration
getBuilderConfig
()
{
RequestMappingInfo
.
BuilderConfiguration
config
=
new
RequestMappingInfo
.
BuilderConfiguration
();
config
.
setUrlPathHelper
(
null
);
config
.
setPathMatcher
(
null
);
config
.
setSuffixPatternMatch
(
false
);
config
.
setTrailingSlashMatch
(
true
);
...
...
@@ -195,34 +191,21 @@ public abstract class AbstractWebMvcEndpointHandlerMapping extends RequestMappin
}
private
RequestMappingInfo
createRequestMappingInfo
(
WebOperationRequestPredicate
predicate
,
String
path
)
{
PatternsRequestCondition
patterns
=
patternsRequestConditionForPattern
(
path
);
RequestMethodsRequestCondition
methods
=
new
RequestMethodsRequestCondition
(
RequestMethod
.
valueOf
(
predicate
.
getHttpMethod
().
name
()));
ConsumesRequestCondition
consumes
=
new
ConsumesRequestCondition
(
StringUtils
.
toStringArray
(
predicate
.
getConsumes
()));
ProducesRequestCondition
produces
=
new
ProducesRequestCondition
(
StringUtils
.
toStringArray
(
predicate
.
getProduces
()));
return
new
RequestMappingInfo
(
null
,
patterns
,
methods
,
null
,
null
,
consumes
,
produces
,
null
);
return
RequestMappingInfo
.
paths
(
this
.
endpointMapping
.
createSubPath
(
path
))
.
methods
(
RequestMethod
.
valueOf
(
predicate
.
getHttpMethod
().
name
()))
.
consumes
(
predicate
.
getConsumes
().
toArray
(
new
String
[
0
]))
.
produces
(
predicate
.
getProduces
().
toArray
(
new
String
[
0
])).
build
();
}
private
void
registerLinksMapping
()
{
PatternsRequestCondition
patterns
=
patternsRequestConditionForPattern
(
""
);
RequestMethodsRequestCondition
methods
=
new
RequestMethodsRequestCondition
(
RequestMethod
.
GET
);
ProducesRequestCondition
produces
=
new
ProducesRequestCondition
(
this
.
endpointMediaTypes
.
getProduced
()
.
toArray
(
StringUtils
.
toStringArray
(
this
.
endpointMediaTypes
.
getProduced
())));
RequestMappingInfo
mapping
=
new
RequestMappingInfo
(
patterns
,
methods
,
null
,
null
,
null
,
produces
,
null
);
RequestMappingInfo
mapping
=
RequestMappingInfo
.
paths
(
this
.
endpointMapping
.
createSubPath
(
""
))
.
methods
(
RequestMethod
.
GET
).
produces
(
this
.
endpointMediaTypes
.
getProduced
().
toArray
(
new
String
[
0
]))
.
options
(
builderConfig
).
build
();
LinksHandler
linksHandler
=
getLinksHandler
();
registerMapping
(
mapping
,
linksHandler
,
ReflectionUtils
.
findMethod
(
linksHandler
.
getClass
(),
"links"
,
HttpServletRequest
.
class
,
HttpServletResponse
.
class
));
}
@SuppressWarnings
(
"deprecation"
)
private
PatternsRequestCondition
patternsRequestConditionForPattern
(
String
path
)
{
String
[]
patterns
=
new
String
[]
{
this
.
endpointMapping
.
createSubPath
(
path
)
};
return
new
PatternsRequestCondition
(
patterns
,
builderConfig
.
getUrlPathHelper
(),
builderConfig
.
getPathMatcher
(),
builderConfig
.
useSuffixPatternMatch
(),
builderConfig
.
useTrailingSlashMatch
());
}
@Override
protected
boolean
hasCorsConfigurationSource
(
Object
handler
)
{
return
this
.
corsConfiguration
!=
null
;
...
...
@@ -332,7 +315,7 @@ public abstract class AbstractWebMvcEndpointHandlerMapping extends RequestMappin
}
private
Object
getRemainingPathSegments
(
HttpServletRequest
request
)
{
String
[]
pathTokens
=
tokenize
(
request
,
HandlerMapping
.
LOOKUP_PATH
,
true
);
String
[]
pathTokens
=
tokenize
(
request
,
UrlPathHelper
.
PATH_ATTRIBUTE
,
true
);
String
[]
patternTokens
=
tokenize
(
request
,
HandlerMapping
.
BEST_MATCHING_PATTERN_ATTRIBUTE
,
false
);
int
numberOfRemainingPathSegments
=
pathTokens
.
length
-
patternTokens
.
length
+
1
;
Assert
.
state
(
numberOfRemainingPathSegments
>=
0
,
"Unable to extract remaining path segments"
);
...
...
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/SkipPathExtensionContentNegotiation.java
View file @
0d6ea790
...
...
@@ -19,16 +19,16 @@ package org.springframework.boot.actuate.endpoint.web.servlet;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.web.servlet.
handler.HandlerInterceptorAdapte
r
;
import
org.springframework.web.servlet.
HandlerIntercepto
r
;
/**
* {@link HandlerInterceptor
Adapter
} to ensure that
* {@link HandlerInterceptor} to ensure that
* {@link org.springframework.web.accept.PathExtensionContentNegotiationStrategy} is
* skipped for web endpoints.
*
* @author Phillip Webb
*/
final
class
SkipPathExtensionContentNegotiation
extends
HandlerInterceptorAdapte
r
{
final
class
SkipPathExtensionContentNegotiation
implements
HandlerIntercepto
r
{
@SuppressWarnings
(
"deprecation"
)
private
static
final
String
SKIP_ATTRIBUTE
=
org
.
springframework
.
web
.
accept
.
PathExtensionContentNegotiationStrategy
.
class
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/MvcWebEndpointIntegrationTests.java
View file @
0d6ea790
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
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.
...
...
@@ -121,6 +121,13 @@ class MvcWebEndpointIntegrationTests
context
.
register
(
TestEndpointConfiguration
.
class
);
context
.
refresh
();
WebMvcEndpointHandlerMapping
bean
=
context
.
getBean
(
WebMvcEndpointHandlerMapping
.
class
);
try
{
// Trigger initLookupPath
bean
.
getHandler
(
request
);
}
catch
(
Exception
ex
)
{
throw
new
RuntimeException
(
ex
);
}
return
bean
.
match
(
request
,
"/spring"
);
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/reactive/StaticResourceRequest.java
View file @
0d6ea790
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
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.
...
...
@@ -128,7 +128,8 @@ public final class StaticResourceRequest {
}
private
Stream
<
String
>
getPatterns
()
{
return
this
.
locations
.
stream
().
flatMap
(
StaticResourceLocation:
:
getPatterns
);
return
this
.
locations
.
stream
().
flatMap
(
StaticResourceLocation:
:
getPatterns
)
.
map
((
pattern
)
->
pattern
.
replace
(
"/**/"
,
"/*/"
));
}
@Override
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.java
View file @
0d6ea790
...
...
@@ -284,18 +284,6 @@ public class WebMvcAutoConfiguration {
return
resolver
;
}
@Bean
@ConditionalOnMissingBean
@ConditionalOnProperty
(
prefix
=
"spring.mvc"
,
name
=
"locale"
)
public
LocaleResolver
localeResolver
()
{
if
(
this
.
mvcProperties
.
getLocaleResolver
()
==
WebMvcProperties
.
LocaleResolver
.
FIXED
)
{
return
new
FixedLocaleResolver
(
this
.
mvcProperties
.
getLocale
());
}
AcceptHeaderLocaleResolver
localeResolver
=
new
AcceptHeaderLocaleResolver
();
localeResolver
.
setDefaultLocale
(
this
.
mvcProperties
.
getLocale
());
return
localeResolver
;
}
@Override
public
MessageCodesResolver
getMessageCodesResolver
()
{
if
(
this
.
mvcProperties
.
getMessageCodesResolverFormat
()
!=
null
)
{
...
...
@@ -420,6 +408,19 @@ public class WebMvcAutoConfiguration {
return
welcomePageHandlerMapping
;
}
@Override
@Bean
@ConditionalOnMissingBean
@ConditionalOnProperty
(
prefix
=
"spring.mvc"
,
name
=
"locale"
,
matchIfMissing
=
true
)
public
LocaleResolver
localeResolver
()
{
if
(
this
.
mvcProperties
.
getLocaleResolver
()
==
WebMvcProperties
.
LocaleResolver
.
FIXED
)
{
return
new
FixedLocaleResolver
(
this
.
mvcProperties
.
getLocale
());
}
AcceptHeaderLocaleResolver
localeResolver
=
new
AcceptHeaderLocaleResolver
();
localeResolver
.
setDefaultLocale
(
this
.
mvcProperties
.
getLocale
());
return
localeResolver
;
}
private
Optional
<
Resource
>
getWelcomePage
()
{
String
[]
locations
=
getResourceLocations
(
this
.
resourceProperties
.
getStaticLocations
());
return
Arrays
.
stream
(
locations
).
map
(
this
::
getIndexHtml
).
filter
(
this
::
isReadable
).
findFirst
();
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/function/client/WebClientAutoConfigurationTests.java
View file @
0d6ea790
...
...
@@ -28,6 +28,7 @@ import org.springframework.boot.web.codec.CodecCustomizer;
import
org.springframework.boot.web.reactive.function.client.WebClientCustomizer
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.client.reactive.ClientHttpConnector
;
import
org.springframework.http.client.reactive.ClientHttpResponse
;
...
...
@@ -87,6 +88,7 @@ class WebClientAutoConfigurationTests {
void
shouldGetPrototypeScopedBean
()
{
this
.
contextRunner
.
withUserConfiguration
(
WebClientCustomizerConfig
.
class
).
run
((
context
)
->
{
ClientHttpResponse
response
=
mock
(
ClientHttpResponse
.
class
);
given
(
response
.
getHeaders
()).
willReturn
(
new
HttpHeaders
());
ClientHttpConnector
firstConnector
=
mock
(
ClientHttpConnector
.
class
);
given
(
firstConnector
.
connect
(
any
(),
any
(),
any
())).
willReturn
(
Mono
.
just
(
response
));
WebClient
.
Builder
firstBuilder
=
context
.
getBean
(
WebClient
.
Builder
.
class
);
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfigurationTests.java
View file @
0d6ea790
...
...
@@ -277,8 +277,12 @@ class WebMvcAutoConfigurationTests {
}
@Test
void
noLocaleResolver
()
{
this
.
contextRunner
.
run
((
context
)
->
assertThat
(
context
).
doesNotHaveBean
(
LocaleResolver
.
class
));
void
defaultLocaleResolver
()
{
this
.
contextRunner
.
run
((
context
)
->
{
assertThat
(
context
).
hasSingleBean
(
LocaleResolver
.
class
);
LocaleResolver
localeResolver
=
context
.
getBean
(
LocaleResolver
.
class
);
assertThat
(((
AcceptHeaderLocaleResolver
)
localeResolver
).
getDefaultLocale
()).
isNull
();
});
}
@Test
...
...
spring-boot-project/spring-boot-dependencies/build.gradle
View file @
0d6ea790
...
...
@@ -1679,7 +1679,7 @@ bom {
]
}
}
library
(
"Spring Framework"
,
"5.
2.6.RELEASE
"
)
{
library
(
"Spring Framework"
,
"5.
3.0-SNAPSHOT
"
)
{
group
(
"org.springframework"
)
{
imports
=
[
"spring-framework-bom"
...
...
spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/json/JsonTestersAutoConfiguration.java
View file @
0d6ea790
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
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.
...
...
@@ -28,7 +28,7 @@ import org.springframework.beans.BeanUtils;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.FactoryBean
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
import
org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor
Adapter
;
import
org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
...
...
@@ -163,7 +163,7 @@ public class JsonTestersAutoConfiguration {
/**
* {@link BeanPostProcessor} used to initialize JSON testers.
*/
static
class
JsonMarshalTestersBeanPostProcessor
extends
InstantiationAwareBeanPostProcessorAdapte
r
{
static
class
JsonMarshalTestersBeanPostProcessor
implements
InstantiationAwareBeanPostProcesso
r
{
@Override
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
...
...
spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/jdbc/ExampleRepository.java
View file @
0d6ea790
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
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.
...
...
@@ -48,8 +48,7 @@ public class ExampleRepository {
}
public
ExampleEntity
findById
(
int
id
)
{
return
this
.
jdbcTemplate
.
queryForObject
(
"select id, name from example where id =?"
,
new
Object
[]
{
id
},
ROW_MAPPER
);
return
this
.
jdbcTemplate
.
queryForObject
(
"select id, name from example where id =?"
,
ROW_MAPPER
,
id
);
}
public
Collection
<
ExampleEntity
>
findAll
()
{
...
...
spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/orm/jpa/DataJpaTestIntegrationTests.java
View file @
0d6ea790
...
...
@@ -73,7 +73,7 @@ class DataJpaTestIntegrationTests {
Long
id
=
this
.
entities
.
persistAndGetId
(
new
ExampleEntity
(
"spring"
,
"123"
),
Long
.
class
);
assertThat
(
id
).
isNotNull
();
String
reference
=
this
.
jdbcTemplate
.
queryForObject
(
"SELECT REFERENCE FROM EXAMPLE_ENTITY WHERE ID = ?"
,
new
Object
[]
{
id
},
String
.
class
);
String
.
class
,
id
);
assertThat
(
reference
).
isEqualTo
(
"123"
);
}
...
...
spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoPostProcessor.java
View file @
0d6ea790
...
...
@@ -43,8 +43,9 @@ import org.springframework.beans.factory.config.BeanPostProcessor;
import
org.springframework.beans.factory.config.ConfigurableListableBeanFactory
;
import
org.springframework.beans.factory.config.ConstructorArgumentValues
;
import
org.springframework.beans.factory.config.ConstructorArgumentValues.ValueHolder
;
import
org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor
Adapter
;
import
org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor
;
import
org.springframework.beans.factory.config.RuntimeBeanReference
;
import
org.springframework.beans.factory.config.SmartInstantiationAwareBeanPostProcessor
;
import
org.springframework.beans.factory.support.BeanDefinitionRegistry
;
import
org.springframework.beans.factory.support.BeanNameGenerator
;
import
org.springframework.beans.factory.support.DefaultBeanNameGenerator
;
...
...
@@ -75,8 +76,8 @@ import org.springframework.util.StringUtils;
* @author Andreas Neiser
* @since 1.4.0
*/
public
class
MockitoPostProcessor
extends
InstantiationAwareBeanPostProcessorAdapter
implements
BeanClassLoaderAware
,
BeanFactoryAware
,
BeanFactoryPostProcessor
,
Ordered
{
public
class
MockitoPostProcessor
implements
InstantiationAwareBeanPostProcessor
,
BeanClassLoaderAware
,
BeanFactoryAware
,
BeanFactoryPostProcessor
,
Ordered
{
private
static
final
String
BEAN_NAME
=
MockitoPostProcessor
.
class
.
getName
();
...
...
@@ -424,7 +425,7 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda
* {@link BeanPostProcessor} to handle {@link SpyBean} definitions. Registered as a
* separate processor so that it can be ordered above AOP post processors.
*/
static
class
SpyPostProcessor
extends
InstantiationAwareBeanPostProcessorAdapter
implements
PriorityOrdered
{
static
class
SpyPostProcessor
implements
SmartInstantiationAwareBeanPostProcessor
,
PriorityOrdered
{
private
static
final
String
BEAN_NAME
=
SpyPostProcessor
.
class
.
getName
();
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/support/ErrorPageFilterIntegrationTests.java
View file @
0d6ea790
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
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.
...
...
@@ -48,11 +48,11 @@ import org.springframework.web.bind.annotation.ResponseBody;
import
org.springframework.web.bind.annotation.ResponseStatus
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.servlet.DispatcherServlet
;
import
org.springframework.web.servlet.HandlerInterceptor
;
import
org.springframework.web.servlet.ModelAndView
;
import
org.springframework.web.servlet.config.annotation.EnableWebMvc
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
import
org.springframework.web.servlet.handler.HandlerInterceptorAdapter
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
...
...
@@ -150,7 +150,7 @@ class ErrorPageFilterIntegrationTests {
@Override
public
void
addInterceptors
(
InterceptorRegistry
registry
)
{
registry
.
addInterceptor
(
new
HandlerInterceptor
Adapter
()
{
registry
.
addInterceptor
(
new
HandlerInterceptor
()
{
@Override
public
void
postHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
,
ModelAndView
modelAndView
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment