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
0881b7c3
Commit
0881b7c3
authored
Aug 23, 2018
by
Brian Clozel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Consider only current context in WebFlux setup"
This reverts commit
da4624a8
.
parent
03d6cd9f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
95 deletions
+0
-95
SingleContextDispatcherHandler.java
...onfigure/web/reactive/SingleContextDispatcherHandler.java
+0
-56
WebFluxAutoConfiguration.java
.../autoconfigure/web/reactive/WebFluxAutoConfiguration.java
+0
-6
WebFluxAutoConfigurationTests.java
...configure/web/reactive/WebFluxAutoConfigurationTests.java
+0
-33
No files found.
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/SingleContextDispatcherHandler.java
deleted
100644 → 0
View file @
03d6cd9f
/*
* Copyright 2012-2018 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
*
* http://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.
*/
package
org
.
springframework
.
boot
.
autoconfigure
.
web
.
reactive
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Map
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.core.annotation.AnnotationAwareOrderComparator
;
import
org.springframework.web.reactive.DispatcherHandler
;
import
org.springframework.web.reactive.HandlerAdapter
;
import
org.springframework.web.reactive.HandlerMapping
;
import
org.springframework.web.reactive.HandlerResultHandler
;
/**
* {@link DispatcherHandler} implementation that only checks for infrastructure beans in
* the current application context (i.e. does not consider the parent context).
*
* @author Brian Clozel
* @since 2.1.0
*/
public
class
SingleContextDispatcherHandler
extends
DispatcherHandler
{
@Override
protected
void
initStrategies
(
ApplicationContext
context
)
{
Map
<
String
,
HandlerMapping
>
mappingBeans
=
context
.
getBeansOfType
(
HandlerMapping
.
class
,
true
,
false
);
ArrayList
<
HandlerMapping
>
mappings
=
new
ArrayList
<>(
mappingBeans
.
values
());
AnnotationAwareOrderComparator
.
sort
(
mappings
);
this
.
handlerMappings
=
Collections
.
unmodifiableList
(
mappings
);
Map
<
String
,
HandlerAdapter
>
adapterBeans
=
context
.
getBeansOfType
(
HandlerAdapter
.
class
,
true
,
false
);
this
.
handlerAdapters
=
new
ArrayList
(
adapterBeans
.
values
());
AnnotationAwareOrderComparator
.
sort
(
this
.
handlerAdapters
);
Map
<
String
,
HandlerResultHandler
>
beans
=
context
.
getBeansOfType
(
HandlerResultHandler
.
class
,
true
,
false
);
this
.
resultHandlers
=
new
ArrayList
<>(
beans
.
values
());
AnnotationAwareOrderComparator
.
sort
(
this
.
resultHandlers
);
}
}
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfiguration.java
View file @
0881b7c3
...
...
@@ -57,7 +57,6 @@ import org.springframework.http.codec.ServerCodecConfigurer;
import
org.springframework.util.ClassUtils
;
import
org.springframework.validation.Validator
;
import
org.springframework.web.filter.reactive.HiddenHttpMethodFilter
;
import
org.springframework.web.reactive.DispatcherHandler
;
import
org.springframework.web.reactive.config.DelegatingWebFluxConfiguration
;
import
org.springframework.web.reactive.config.EnableWebFlux
;
import
org.springframework.web.reactive.config.ResourceChainRegistration
;
...
...
@@ -246,11 +245,6 @@ public class WebFluxAutoConfiguration {
return
conversionService
;
}
@Override
public
DispatcherHandler
webHandler
()
{
return
new
SingleContextDispatcherHandler
();
}
@Bean
@Override
public
Validator
webFluxValidator
()
{
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfigurationTests.java
View file @
0881b7c3
...
...
@@ -28,8 +28,6 @@ import org.springframework.beans.DirectFieldAccessor;
import
org.springframework.boot.autoconfigure.AutoConfigurations
;
import
org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration
;
import
org.springframework.boot.autoconfigure.validation.ValidatorAdapter
;
import
org.springframework.boot.test.context.assertj.ApplicationContextAssert
;
import
org.springframework.boot.test.context.runner.ApplicationContextRunner
;
import
org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner
;
import
org.springframework.boot.web.codec.CodecCustomizer
;
import
org.springframework.boot.web.reactive.filter.OrderedHiddenHttpMethodFilter
;
...
...
@@ -46,7 +44,6 @@ import org.springframework.test.util.ReflectionTestUtils;
import
org.springframework.validation.Validator
;
import
org.springframework.validation.beanvalidation.LocalValidatorFactoryBean
;
import
org.springframework.web.filter.reactive.HiddenHttpMethodFilter
;
import
org.springframework.web.reactive.DispatcherHandler
;
import
org.springframework.web.reactive.HandlerMapping
;
import
org.springframework.web.reactive.accept.RequestedContentTypeResolver
;
import
org.springframework.web.reactive.config.WebFluxConfigurationSupport
;
...
...
@@ -401,26 +398,6 @@ public class WebFluxAutoConfigurationTests {
});
}
@Test
public
void
shouldNotGetHandlerMappingsFromParentContext
()
{
ApplicationContextRunner
parentRunner
=
new
ApplicationContextRunner
()
.
withUserConfiguration
(
CustomHandlerMapping
.
class
);
parentRunner
.
run
((
parent
)
->
{
this
.
contextRunner
.
withParent
(
parent
).
run
((
context
)
->
{
assertThat
(
parent
).
hasSingleBean
(
HandlerMapping
.
class
);
assertThat
(
context
).
getBeans
(
HandlerMapping
.
class
).
hasSize
(
4
);
assertThat
(
context
)
.
getBeans
(
HandlerMapping
.
class
,
ApplicationContextAssert
.
Scope
.
NO_ANCESTORS
)
.
doesNotContainKey
(
"customHandlerMapping"
);
assertThat
(
context
).
hasSingleBean
(
DispatcherHandler
.
class
);
DispatcherHandler
dispatcherHandler
=
context
.
getBean
(
DispatcherHandler
.
class
);
assertThat
(
dispatcherHandler
.
getHandlerMappings
()).
hasSize
(
3
);
});
});
}
@Configuration
protected
static
class
CustomArgumentResolvers
{
...
...
@@ -587,14 +564,4 @@ public class WebFluxAutoConfigurationTests {
}
@Configuration
static
class
CustomHandlerMapping
{
@Bean
public
HandlerMapping
customHandlerMapping
()
{
return
mock
(
HandlerMapping
.
class
);
}
}
}
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