<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=mdeinum" rel="nofollow">Marten Deinum</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-3417?redirect=false" rel="nofollow">SPR-3417</a></strong> and commented</p>
<p dir="auto">In our current project I wanted to use Introductions. We already use the aop:config block(s) quite extensivly. We decided to use this block also for the &lt;aop:declare-parents /&gt;.</p>
<p dir="auto">However this alows only for 3 parameters to be specified<br>
types-matching="[aspectj expression]"<br>
implement-interface="[interface to introduce]"<br>
default-impl="[Class of the default implementation]"</p>
<p dir="auto">However in our default implementation (default-impl) we need to have some beans injected. For now we created a patchy solution with a singleton which holds a reference to the applicationContext. At construction time/initializing time we use this to retrieve the desired beans.</p>
<p dir="auto">However what I would like to do is to wire up this delegate from my spring configuration and use that in our aop:declare-parents/ tag.</p>
<p dir="auto">Something like this.</p>
<p dir="auto">&lt;bean id="someDelegate" class="com.mybiz.myapp.common.SomeDelegate"&gt;<br>
&lt;property name="hibernateTemplate" ref="hibernateTemplate"/&gt;<br>
&lt;/bean&gt;<br>
&lt;aop:declare-parents types-matching="[aspectj expression]" implement-interface="[interface to introduce]" delegate-ref="someDelegate"/&gt;</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 2.0.4</p>
<p dir="auto">1 votes, 2 watchers</p>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=david_syer" rel="nofollow">Dave Syer</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-2872?redirect=false" rel="nofollow">SPR-2872</a></strong> and commented</p>
<p dir="auto">I seems limiting (maybe there's a reason and I haven't figured it out) that I can only declare an introduction implementation as a class to be instantiated, not an actual bean instance.  E.g. instead of:</p>
<p dir="auto">&lt;aop:declare-parents types-matching="test.aop.TestBean"<br>
implement-interface="test.aop.Counter"<br>
default-impl="test.aop.NullCounter"/&gt;</p>
<p dir="auto">we might see</p>
<p dir="auto">&lt;aop:declare-parents types-matching="test.aop.TestBean"<br>
implement-interface="test.aop.Counter"<br>
default-ref="nullCounter"/&gt;</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 2.0.1</p>
<p dir="auto">1 votes, 1 watchers</p>