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
403e747c
Commit
403e747c
authored
Mar 29, 2021
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use constructor injection in SpringBootRepositoryRestConfigurer
Closes gh-25819
parent
d1aaee46
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
6 deletions
+15
-6
RepositoryRestMvcAutoConfiguration.java
...nfigure/data/rest/RepositoryRestMvcAutoConfiguration.java
+6
-3
SpringBootRepositoryRestConfigurer.java
...nfigure/data/rest/SpringBootRepositoryRestConfigurer.java
+9
-3
No files found.
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/rest/RepositoryRestMvcAutoConfiguration.java
View file @
403e747c
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
21
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
package
org
.
springframework
.
boot
.
autoconfigure
.
data
.
rest
;
package
org
.
springframework
.
boot
.
autoconfigure
.
data
.
rest
;
import
org.springframework.beans.factory.ObjectProvider
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
...
@@ -30,6 +31,7 @@ import org.springframework.context.annotation.Configuration;
...
@@ -30,6 +31,7 @@ import org.springframework.context.annotation.Configuration;
import
org.springframework.context.annotation.Import
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.data.rest.core.config.RepositoryRestConfiguration
;
import
org.springframework.data.rest.core.config.RepositoryRestConfiguration
;
import
org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration
;
import
org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration
;
import
org.springframework.http.converter.json.Jackson2ObjectMapperBuilder
;
/**
/**
* {@link EnableAutoConfiguration Auto-configuration} for Spring Data Rest's MVC
* {@link EnableAutoConfiguration Auto-configuration} for Spring Data Rest's MVC
...
@@ -56,8 +58,9 @@ import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguratio
...
@@ -56,8 +58,9 @@ import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguratio
public
class
RepositoryRestMvcAutoConfiguration
{
public
class
RepositoryRestMvcAutoConfiguration
{
@Bean
@Bean
public
SpringBootRepositoryRestConfigurer
springBootRepositoryRestConfigurer
()
{
public
SpringBootRepositoryRestConfigurer
springBootRepositoryRestConfigurer
(
return
new
SpringBootRepositoryRestConfigurer
();
ObjectProvider
<
Jackson2ObjectMapperBuilder
>
objectMapperBuilder
,
RepositoryRestProperties
properties
)
{
return
new
SpringBootRepositoryRestConfigurer
(
objectMapperBuilder
.
getIfAvailable
(),
properties
);
}
}
}
}
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/rest/SpringBootRepositoryRestConfigurer.java
View file @
403e747c
/*
/*
* Copyright 2012-202
0
the original author or authors.
* Copyright 2012-202
1
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -38,10 +38,16 @@ import org.springframework.web.servlet.config.annotation.CorsRegistry;
...
@@ -38,10 +38,16 @@ import org.springframework.web.servlet.config.annotation.CorsRegistry;
class
SpringBootRepositoryRestConfigurer
implements
RepositoryRestConfigurer
{
class
SpringBootRepositoryRestConfigurer
implements
RepositoryRestConfigurer
{
@Autowired
(
required
=
false
)
@Autowired
(
required
=
false
)
private
Jackson2ObjectMapperBuilder
objectMapperBuilder
;
private
final
Jackson2ObjectMapperBuilder
objectMapperBuilder
;
@Autowired
@Autowired
private
RepositoryRestProperties
properties
;
private
final
RepositoryRestProperties
properties
;
SpringBootRepositoryRestConfigurer
(
Jackson2ObjectMapperBuilder
objectMapperBuilder
,
RepositoryRestProperties
properties
)
{
this
.
objectMapperBuilder
=
objectMapperBuilder
;
this
.
properties
=
properties
;
}
@Override
@Override
@SuppressWarnings
(
"deprecation"
)
@SuppressWarnings
(
"deprecation"
)
...
...
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