Skip to content

Commit fe21ccf

Browse files
committed
Merge pull request #102 from ArloL/fix-memory-leaks
Remove memory leaks of RepositoryRestMvcConfig
2 parents 636c3cc + 6981fa1 commit fe21ccf

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.java

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import org.springframework.context.annotation.Lazy;
1414
import org.springframework.core.convert.support.ConfigurableConversionService;
1515
import org.springframework.data.repository.support.DomainClassConverter;
16+
import org.springframework.data.repository.support.Repositories;
1617
import org.springframework.data.rest.config.RepositoryRestConfiguration;
1718
import org.springframework.data.rest.convert.ISO8601DateConverter;
1819
import org.springframework.data.rest.convert.UUIDConverter;
@@ -145,9 +146,9 @@ public class RepositoryRestMvcConfiguration {
145146
*
146147
* @throws Exception
147148
*/
148-
@Bean public DomainObjectMerger domainObjectMerger() throws Exception {
149+
@Bean public DomainObjectMerger domainObjectMerger(Repositories repositories) throws Exception {
149150
return new DomainObjectMerger(
150-
repositories().getObject(),
151+
repositories,
151152
defaultConversionService()
152153
);
153154
}
@@ -159,13 +160,13 @@ public class RepositoryRestMvcConfiguration {
159160
*
160161
* @throws Exception
161162
*/
162-
@Bean public RepositoryController repositoryController() throws Exception {
163+
@Bean public RepositoryController repositoryController(Repositories repositories, EntityLinks entityLinks) throws Exception {
163164
return new RepositoryController(
164-
repositories().getObject(),
165+
repositories,
165166
config(),
166167
domainClassConverter(),
167168
defaultConversionService(),
168-
entityLinks()
169+
entityLinks
169170
);
170171
}
171172

@@ -176,13 +177,13 @@ public class RepositoryRestMvcConfiguration {
176177
*
177178
* @throws Exception
178179
*/
179-
@Bean public RepositoryEntityController repositoryEntityController() throws Exception {
180+
@Bean public RepositoryEntityController repositoryEntityController(Repositories repositories, EntityLinks entityLinks) throws Exception {
180181
return new RepositoryEntityController(
181-
repositories().getObject(),
182+
repositories,
182183
config(),
183184
domainClassConverter(),
184185
defaultConversionService(),
185-
entityLinks()
186+
entityLinks
186187
);
187188
}
188189

@@ -193,13 +194,13 @@ public class RepositoryRestMvcConfiguration {
193194
*
194195
* @throws Exception
195196
*/
196-
@Bean public RepositoryPropertyReferenceController propertyReferenceController() throws Exception {
197+
@Bean public RepositoryPropertyReferenceController propertyReferenceController(Repositories repositories, EntityLinks entityLinks) throws Exception {
197198
return new RepositoryPropertyReferenceController(
198-
repositories().getObject(),
199+
repositories,
199200
config(),
200201
domainClassConverter(),
201202
defaultConversionService(),
202-
entityLinks()
203+
entityLinks
203204
);
204205
}
205206

@@ -210,13 +211,13 @@ public class RepositoryRestMvcConfiguration {
210211
*
211212
* @throws Exception
212213
*/
213-
@Bean public RepositorySearchController repositorySearchController() throws Exception {
214+
@Bean public RepositorySearchController repositorySearchController(Repositories repositories, EntityLinks entityLinks) throws Exception {
214215
return new RepositorySearchController(
215-
repositories().getObject(),
216+
repositories,
216217
config(),
217218
domainClassConverter(),
218219
defaultConversionService(),
219-
entityLinks()
220+
entityLinks
220221
);
221222
}
222223

@@ -273,8 +274,8 @@ public class RepositoryRestMvcConfiguration {
273274
*
274275
* @throws Exception
275276
*/
276-
@Bean public EntityLinks entityLinks() throws Exception {
277-
return new RepositoryEntityLinks(repositories().getObject(), config());
277+
@Bean public EntityLinks entityLinks(Repositories repositories) throws Exception {
278+
return new RepositoryEntityLinks(repositories, config());
278279
}
279280

280281
/**

0 commit comments

Comments
 (0)