Injection support for Collection/Map beans and self references

Issue: SPR-13585
Issue: SPR-12180
Issue: SPR-7915
Issue: SPR-8450
This commit is contained in:
Juergen Hoeller
2016-01-25 21:25:48 +01:00
parent 64e77de23b
commit 4a0fa69ce4
3 changed files with 217 additions and 62 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
package org.springframework.aop.framework;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
@@ -28,6 +29,8 @@ public class ClassWithComplexConstructor {
private final Dependency dependency;
@Autowired ClassWithComplexConstructor selfReference;
@Autowired
public ClassWithComplexConstructor(Dependency dependency) {
Assert.notNull(dependency);
@@ -39,6 +42,7 @@ public class ClassWithComplexConstructor {
}
public void method() {
Assert.isTrue(this.selfReference != this && AopUtils.isCglibProxy(this.selfReference));
this.dependency.method();
}