From f2f8775c031eca6e73ce62a988c562616d535407 Mon Sep 17 00:00:00 2001 From: Oliver Drotbohm Date: Thu, 19 Aug 2021 23:19:08 +0200 Subject: [PATCH] Avoid eager reference to BackendIdConverter beans. Switched to bean method parameter reference to all BackendIdConverter instances. Fixes #2055. --- .../rest/webmvc/config/RepositoryRestMvcConfiguration.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.java b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.java index f0b931184..a56378f30 100644 --- a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.java +++ b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.java @@ -157,7 +157,6 @@ public class RepositoryRestMvcConfiguration extends HateoasAwareSpringDataWebCon @Autowired ApplicationContext applicationContext; - @Autowired(required = false) List idConverters = Collections.emptyList(); @Autowired(required = false) List> lookups = Collections.emptyList(); @Autowired List> defaultMessageConverters; @@ -844,10 +843,10 @@ public class RepositoryRestMvcConfiguration extends HateoasAwareSpringDataWebCon } @Bean - public PluginRegistry> backendIdConverterRegistry() { + public PluginRegistry> backendIdConverterRegistry( + List backendIdConverter) { - List converters = new ArrayList<>(idConverters.size()); - converters.addAll(this.idConverters); + List converters = new ArrayList<>(backendIdConverter); converters.add(DefaultIdConverter.INSTANCE); return PluginRegistry.of(converters);