DATAREST-246 - ValidatingRepositoryEntityListener now uses ObjectFactory<Repository>.

ValidatingRepositoryEntityListener previous referred to a Repositories instance which causes a circular reference on initialization after some changes in Spring Data Commons Repositories.

Major cleanups in the ValidatingRepositoryEntityListener implementation.
This commit is contained in:
Oliver Gierke
2014-02-12 16:03:59 +01:00
parent 6e817c440b
commit 13d90efbca
4 changed files with 137 additions and 94 deletions

View File

@@ -21,6 +21,7 @@ import java.util.Collections;
import java.util.List;
import org.springframework.beans.factory.ListableBeanFactory;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.ApplicationContext;
@@ -154,8 +155,8 @@ public class RepositoryRestMvcConfiguration extends HateoasAwareSpringDataWebCon
* {@link org.springframework.validation.Validator} instances assigned to specific domain types.
*/
@Bean
public ValidatingRepositoryEventListener validatingRepositoryEventListener() {
ValidatingRepositoryEventListener listener = new ValidatingRepositoryEventListener();
public ValidatingRepositoryEventListener validatingRepositoryEventListener(ObjectFactory<Repositories> repositories) {
ValidatingRepositoryEventListener listener = new ValidatingRepositoryEventListener(repositories);
configureValidatingRepositoryEventListener(listener);
return listener;
}