<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=sgarlatm" rel="nofollow">Matthew Sgarlata</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-889?redirect=false" rel="nofollow">SPR-889</a></strong> and commented</p>
<p dir="auto">I just tested with Spring 1.2 RC2 and this continues to be an issue as described on the Spring user's list.  Here is the relevant discussion thread:</p>
<p dir="auto">Here is my bean definition:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;bean
    name=&quot;calendarIndependentDataModelUpgradeTask&quot;
 class=&quot;com.spider.scoreboard.framework.upgrade.upgrades.CalendarIndependentDataModelUpgradeTask&quot;&gt;
    &lt;lookup-method
        name=&quot;createMetricsToSeriesTransformer&quot;
        bean=&quot;metricsToSeriesConverter&quot;/&gt;
&lt;/bean&gt;"><pre class="notranslate"><code class="notranslate">&lt;bean
    name="calendarIndependentDataModelUpgradeTask"
 class="com.spider.scoreboard.framework.upgrade.upgrades.CalendarIndependentDataModelUpgradeTask"&gt;
    &lt;lookup-method
        name="createMetricsToSeriesTransformer"
        bean="metricsToSeriesConverter"/&gt;
&lt;/bean&gt;
</code></pre></div>
<p dir="auto">This uses method injection, so the callsbacks property is coming from the CGLIB proxy that is generated for the bean.  By AbstractAutowireCapableBeanFactory.createBean:320, the instanceWrapper has been set to a BeanWrapper that wraps the CGLIB proxy.  Then the bean is populated and its dependencies are checked <strong>using the BeanWrapper</strong>. The BeanWrapper wraps the CGLIB proxy, so the missing callbacks property is detected and an error message is thrown.</p>
<p dir="auto">Matt</p>
<p dir="auto">PS, here is the stack trace right before the exception gets thrown</p>
<p dir="auto">Thread [main] (Suspended)<br>
DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).dependencyCheck(String, RootBeanDefinition, BeanWrapper, PropertyValues) line: 855<br>
DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).populateBean(String, RootBeanDefinition, BeanWrapper) line: 713<br>
DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).createBean(String, RootBeanDefinition, Object[], boolean) line: 331<br>
DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).createBean(String, RootBeanDefinition, Object[]) line: 257<br>
DefaultListableBeanFactory(AbstractBeanFactory).getBean(String, Class, Object[]) line: 223<br>
DefaultListableBeanFactory(AbstractBeanFactory).getBean(String) line: 147<br>
ScoreboardApplicationContext(AbstractApplicationContext).getBean(String) line: 531<br>
Launcher.launch(Launchable) line: 56<br>
CalendarIndependentDataModelUpgradeTask.main(String[]) line: 85</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 1.2 RC2</p>
<p dir="auto"><strong>Attachments:</strong></p>
<ul dir="auto">
<li><a href="https://jira.spring.io/secure/attachment/10667/stack.txt" rel="nofollow">stack.txt</a> (<em>5.33 kB</em>)</li>
</ul>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398056464" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/5611" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/5611/hovercard" href="https://github.com/spring-projects/spring-framework/issues/5611">#5611</a> Unsatisfied dependency error in property 'callbacks' error when using lookup-method injection with dependency check with cglib 2.1 (<em><strong>"duplicates"</strong></em>)</li>
</ul>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=jglynn" rel="nofollow">John Glynn</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-6299?redirect=false" rel="nofollow">SPR-6299</a></strong> and commented</p>
<p dir="auto">A common requirement is that a <code class="notranslate">@ModelAttribute</code> annotated method be dependent upon another.</p>
<p dir="auto">ie.</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@ModelAttribute(&quot;foo&quot;)
public Object getFoo() {
    ...
}

@ModelAttribute(&quot;bar&quot;)
public Object getBar(@ModelAttribute(&quot;foo&quot;) Object foo) {
  if( some condition of foo ){
    do stuff
  }
}"><pre class="notranslate"><span class="pl-c1">@</span><span class="pl-c1">ModelAttribute</span>(<span class="pl-s">"foo"</span>)
<span class="pl-k">public</span> <span class="pl-smi">Object</span> <span class="pl-s1">getFoo</span>() {
    ...
}

<span class="pl-c1">@</span><span class="pl-c1">ModelAttribute</span>(<span class="pl-s">"bar"</span>)
<span class="pl-k">public</span> <span class="pl-smi">Object</span> <span class="pl-s1">getBar</span>(<span class="pl-c1">@</span><span class="pl-c1">ModelAttribute</span>(<span class="pl-s">"foo"</span>) <span class="pl-smi">Object</span> <span class="pl-s1">foo</span>) {
  <span class="pl-k">if</span>( <span class="pl-smi">some</span> <span class="pl-s1">condition</span> <span class="pl-s1">of</span> <span class="pl-s1">foo</span> ){
    <span class="pl-k">do</span> <span class="pl-s1">stuff</span>
  }
}</pre></div>
<hr>
<p dir="auto"><strong>Affects:</strong> 2.5.6</p>
<p dir="auto"><strong>Reference URL:</strong> <a href="http://forum.springsource.org/showthread.php?p=263603#post263603" rel="nofollow">http://forum.springsource.org/showthread.php?p=263603#post263603</a></p>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398154322" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/14555" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/14555/hovercard" href="https://github.com/spring-projects/spring-framework/issues/14555">#14555</a> <code class="notranslate">@ModelAttribute</code> usage, can prevent <code class="notranslate">@ModelAttribute</code> initialization of dependent. (<em><strong>"is duplicated by"</strong></em>)</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398164586" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/15939" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/15939/hovercard" href="https://github.com/spring-projects/spring-framework/issues/15939">#15939</a> <code class="notranslate">@ModelAttribute</code> parameter dependency issue. (<em><strong>"is duplicated by"</strong></em>)</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398161495" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/15541" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/15541/hovercard" href="https://github.com/spring-projects/spring-framework/issues/15541">#15541</a> <code class="notranslate">@ModelAttribute</code> allowed on attribute in <code class="notranslate">@ModelAttribute</code> annoted method (<em><strong>"is duplicated by"</strong></em>)</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398094604" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/10365" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/10365/hovercard" href="https://github.com/spring-projects/spring-framework/issues/10365">#10365</a> Allow an <code class="notranslate">@ModelAttribute</code> method to be invoked after the <code class="notranslate">@RequestMapping</code> method</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398186797" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/18269" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/18269/hovercard" href="https://github.com/spring-projects/spring-framework/issues/18269">#18269</a> Portlet MVC <code class="notranslate">@ModelAttribute</code> interdependency is still not supported</li>
</ul>
<p dir="auto"><strong>Referenced from:</strong> commits <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/spring-projects/spring-framework/commit/56a82c1cbe8276408f9fff06cfb1ac9da7961a80/hovercard" href="https://github.com/spring-projects/spring-framework/commit/56a82c1cbe8276408f9fff06cfb1ac9da7961a80"><tt>56a82c1</tt></a></p>
<p dir="auto">27 votes, 32 watchers</p>