<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=olivergierke" rel="nofollow">Oliver Drotbohm</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-8336?redirect=false" rel="nofollow">SPR-8336</a></strong> and commented</p>
<p dir="auto">Currently <code class="notranslate">AnnotationTypeFilter</code> invokes the constructor of <code class="notranslate">AbstractTypeHierarchyTraversingFilter</code> setting <code class="notranslate">considerInterfaces</code> to <code class="notranslate">false</code>. This probably makes sense in most cases. However there might be <code class="notranslate">BeanDefinitionParser</code> implementations that declare a <code class="notranslate">FactoryBean</code> creating a proxy for discovered interfaces. So it would be cool if we could add a constructor to pass in a <code class="notranslate">boolean</code> to enable interface discovery as well.</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 3.0.5, 3.1 M1</p>
<p dir="auto"><strong>Attachments:</strong></p>
<ul dir="auto">
<li><a href="https://jira.spring.io/secure/attachment/18225/filter.patch" rel="nofollow">filter.patch</a> (<em>3.38 kB</em>)</li>
<li><a href="https://jira.spring.io/secure/attachment/18226/mylyn-context.zip" rel="nofollow">mylyn-context.zip</a> (<em>1.26 kB</em>)</li>
</ul>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a href="https://jira.spring.io/browse/DATACMNS-37" rel="nofollow">DATACMNS-37</a> Support annotation based declaration of repository interfaces (<em><strong>"depends on"</strong></em>)</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398167783" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/16341" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/16341/hovercard" href="https://github.com/spring-projects/spring-framework/issues/16341">#16341</a> Metadata reading should never use ASM for java.* and javax.* types (in particular on JDK 8)</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-data-commons/commit/4a705067e5737d00c27bc43f33d41ce3babc9b63/hovercard" href="https://github.com/spring-projects/spring-data-commons/commit/4a705067e5737d00c27bc43f33d41ce3babc9b63">spring-projects/spring-data-commons@<tt>4a70506</tt></a></p>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=urubatan" rel="nofollow">Rodrigo Urubatan Ferreira Jardim</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-3486?redirect=false" rel="nofollow">SPR-3486</a></strong> and commented</p>
<p dir="auto">I think some bean definitions are just configuration, as the Data Source, Transaction Manager, Mail Server, ...<br>
but most of then are the application code, and not configuration.<br>
for the seccond case, I think it would be very easy and clean, to register it on the application with annotations, because it would use a lot less code than the XML approach, and this beans registrations (like my application DAOs, or my Spring MVC controllers), does not change during the life time of any application.<br>
for this to be reached it would be necessary to scan the classpath for the annotated classes.</p>
<p dir="auto">I have wrote a litle bouch of classes that make the application context behave exaclty this way, enabling it to use bean registration by annotations.<br>
please consider including it in spring framework as an optional extension.</p>
<p dir="auto">I`m not sure the application way I did it (creating another application context class) is the best one, but it is an idea of implementation for it :D</p>
<p dir="auto">the code I have wrote is atacched.<br>
what it does right now is:</p>
<ol dir="auto">
<li><code class="notranslate">@Bean</code> - equals to &lt;bean&gt;
<ul dir="auto">
<li>autoWire (NO, BY_NAME, BY_TYPE, INHERITED)</li>
<li>dependencyCheck</li>
<li>destroyMethod</li>
<li>factoryMethod</li>
<li>initMethod</li>
<li>lazy</li>
<li>name</li>
<li>scope (APPLICATION, REQUEST, SESSION) - short cut to aop:scope</li>
<li>singleton</li>
</ul>
</li>
<li><code class="notranslate">@UrlMapping</code> - attaches the bean to a URL using an bean factor post processor (AnnotationHandlerMaping)</li>
<li><code class="notranslate">@UrlMappings</code> - enables multiple UrlMappings per bean</li>
<li><code class="notranslate">@Property</code></li>
<li><code class="notranslate">@ConstructorArgs</code></li>
</ol>
<p dir="auto">in the code, there is an example applicationContext.xml that enables WebServices using JSR 181 webservices through xfire/spring integration, and has already a propertyPlaceholderConfigurer.</p>
<p dir="auto">the annotation scan, for now scans every directory/jar in the classpath, that contains a file names to.properties in the root, and the propertyPlaceholderConfigurer uses this files too.</p>
<p dir="auto">with this jar, I was able to define only a datasource, transaction manager,sessionFactory,tx:annotation-driven,and a defaultViewResolver<br>
and write all the rest of my application without touching in a XML file.<br>
this way, all I need to know about my beans was in the bean code.</p>
<p dir="auto">the installation of it is preaty clean too:</p>
<p dir="auto">&lt;?xml version="1.0" encoding="UTF-8"?&gt;</p>
<p dir="auto">&lt;web-app id="WebApp_ID" version="2.4"<br>
xmlns="<a href="http://java.sun.com/xml/ns/j2ee" rel="nofollow">http://java.sun.com/xml/ns/j2ee</a>"<br>
xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance" rel="nofollow">http://www.w3.org/2001/XMLSchema-instance</a>"<br>
xsi:schemaLocation="<a href="http://java.sun.com/xml/ns/j2ee" rel="nofollow">http://java.sun.com/xml/ns/j2ee</a> <a href="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd%22%3E" rel="nofollow">http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"&gt;</a><br>
&lt;display-name&gt;TO - Novo Site&lt;/display-name&gt;<br>
&lt;context-param&gt;<br>
&lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;<br>
&lt;param-value&gt;classpath*:applicationContext.xml&lt;/param-value&gt;<br>
&lt;/context-param&gt;<br>
&lt;context-param&gt;<br>
&lt;param-name&gt;contextClass&lt;/param-name&gt;<br>
&lt;param-value&gt;<br>
br.com.techoffice.spring.web.TOAnnotationXmlWebApplicationContext<br>
&lt;/param-value&gt;<br>
&lt;/context-param&gt;<br>
&lt;listener&gt;<br>
&lt;listener-class&gt;<br>
org.springframework.web.context.ContextLoaderListener<br>
&lt;/listener-class&gt;<br>
&lt;/listener&gt;<br>
&lt;filter&gt;<br>
&lt;filter-name&gt;requestContext&lt;/filter-name&gt;<br>
&lt;filter-class&gt;<br>
org.springframework.web.filter.RequestContextFilter<br>
&lt;/filter-class&gt;<br>
&lt;/filter&gt;<br>
&lt;filter-mapping&gt;<br>
&lt;filter-name&gt;requestContext&lt;/filter-name&gt;<br>
&lt;url-pattern&gt;/*&lt;/url-pattern&gt;<br>
&lt;/filter-mapping&gt;<br>
&lt;servlet&gt;<br>
&lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;<br>
&lt;servlet-class&gt;<br>
org.springframework.web.servlet.DispatcherServlet<br>
&lt;/servlet-class&gt;<br>
&lt;load-on-startup&gt;1&lt;/load-on-startup&gt;<br>
&lt;/servlet&gt;<br>
&lt;servlet-mapping&gt;<br>
&lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;<br>
&lt;url-pattern&gt;*.to&lt;/url-pattern&gt;<br>
&lt;/servlet-mapping&gt;<br>
&lt;servlet-mapping&gt;<br>
&lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;<br>
&lt;url-pattern&gt;/web/*&lt;/url-pattern&gt;<br>
&lt;/servlet-mapping&gt;<br>
&lt;/web-app&gt;</p>
<p dir="auto">a blank dispatcher-servlet.xml (does this is really needed? what if I want all my configuration to be application-wide, I really need to create a xml file to each servlet, or in this case to the only servlet I have?)</p>
<p dir="auto">again, please consider it as an optional module for spring framework.<br>
and thanks for the great framework, it has saved a few of my projects in clients in the last 2 years.</p>
<hr>
<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="398065841" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/6680" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/6680/hovercard" href="https://github.com/spring-projects/spring-framework/issues/6680">#6680</a> Enable the definition of beans in the application context using annotations instead of XML (<em><strong>"duplicates"</strong></em>)</li>
</ul>