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
fdccd8aa
Commit
fdccd8aa
authored
Dec 01, 2016
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove use of field injection from ErrorMvcAutoConfiguration
parent
5560af73
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
19 deletions
+28
-19
ErrorMvcAutoConfiguration.java
...ork/boot/autoconfigure/web/ErrorMvcAutoConfiguration.java
+28
-19
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration.java
View file @
fdccd8aa
...
...
@@ -27,7 +27,7 @@ import javax.servlet.http.HttpServletResponse;
import
org.springframework.aop.framework.autoproxy.AutoProxyUtils
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.
annotation.Autowired
;
import
org.springframework.beans.factory.
ObjectProvider
;
import
org.springframework.beans.factory.config.BeanFactoryPostProcessor
;
import
org.springframework.beans.factory.config.ConfigurableListableBeanFactory
;
import
org.springframework.boot.autoconfigure.AutoConfigureBefore
;
...
...
@@ -82,20 +82,14 @@ import org.springframework.web.util.HtmlUtils;
@EnableConfigurationProperties
(
ResourceProperties
.
class
)
public
class
ErrorMvcAutoConfiguration
{
private
final
ApplicationContext
applicationContext
;
private
final
ServerProperties
serverProperties
;
private
final
ResourceProperties
resourceProperties
;
@Autowired
(
required
=
false
)
private
List
<
ErrorViewResolver
>
errorViewResolvers
;
private
final
List
<
ErrorViewResolver
>
errorViewResolvers
;
public
ErrorMvcAutoConfiguration
(
ApplicationContext
applicationContext
,
ServerProperties
serverProperties
,
ResourceProperties
resourceProperties
)
{
this
.
applicationContext
=
applicationContext
;
public
ErrorMvcAutoConfiguration
(
ServerProperties
serverProperties
,
ObjectProvider
<
List
<
ErrorViewResolver
>>
errorViewResolversProvider
)
{
this
.
serverProperties
=
serverProperties
;
this
.
resourceProperties
=
resourceProperties
;
this
.
errorViewResolvers
=
errorViewResolversProvider
.
getIfAvailable
()
;
}
@Bean
...
...
@@ -116,19 +110,34 @@ public class ErrorMvcAutoConfiguration {
return
new
ErrorPageCustomizer
(
this
.
serverProperties
);
}
@Bean
@ConditionalOnBean
(
DispatcherServlet
.
class
)
@ConditionalOnMissingBean
public
DefaultErrorViewResolver
conventionErrorViewResolver
()
{
return
new
DefaultErrorViewResolver
(
this
.
applicationContext
,
this
.
resourceProperties
);
}
@Bean
public
static
PreserveErrorControllerTargetClassPostProcessor
preserveErrorControllerTargetClassPostProcessor
()
{
return
new
PreserveErrorControllerTargetClassPostProcessor
();
}
@Configuration
static
class
DefaultErrorViewResolverConfiguration
{
private
final
ApplicationContext
applicationContext
;
private
final
ResourceProperties
resourceProperties
;
DefaultErrorViewResolverConfiguration
(
ApplicationContext
applicationContext
,
ResourceProperties
resourceProperties
)
{
this
.
applicationContext
=
applicationContext
;
this
.
resourceProperties
=
resourceProperties
;
}
@Bean
@ConditionalOnBean
(
DispatcherServlet
.
class
)
@ConditionalOnMissingBean
public
DefaultErrorViewResolver
conventionErrorViewResolver
()
{
return
new
DefaultErrorViewResolver
(
this
.
applicationContext
,
this
.
resourceProperties
);
}
}
@Configuration
@ConditionalOnProperty
(
prefix
=
"server.error.whitelabel"
,
name
=
"enabled"
,
matchIfMissing
=
true
)
@Conditional
(
ErrorTemplateMissingCondition
.
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