Issue 1:
Oliver Drotbohm opened SPR-8336 and commented

Currently AnnotationTypeFilter invokes the constructor of AbstractTypeHierarchyTraversingFilter setting considerInterfaces to false. This probably makes sense in most cases. However there might be BeanDefinitionParser implementations that declare a FactoryBean creating a proxy for discovered interfaces. So it would be cool if we could add a constructor to pass in a boolean to enable interface discovery as well.

Affects: 3.0.5, 3.1 M1

Attachments:

filter.patch (3.38 kB)

mylyn-context.zip (1.26 kB)

Issue Links:

DATACMNS-37 Support annotation based declaration of repository interfaces ("depends on")

#16341 Metadata reading should never use ASM for java.* and javax.* types (in particular on JDK 8)

Referenced from: commits spring-projects/spring-data-commons@4a70506

Issue 2:
Rodrigo Urubatan Ferreira Jardim opened SPR-3486 and commented

I think some bean definitions are just configuration, as the Data Source, Transaction Manager, Mail Server, ...

but most of then are the application code, and not configuration.

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.

for this to be reached it would be necessary to scan the classpath for the annotated classes.

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.

please consider including it in spring framework as an optional extension.

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

the code I have wrote is atacched.

what it does right now is:

@Bean - equals to <bean>

autoWire (NO, BY_NAME, BY_TYPE, INHERITED)

dependencyCheck

destroyMethod

factoryMethod

initMethod

lazy

name

scope (APPLICATION, REQUEST, SESSION) - short cut to aop:scope

singleton

@UrlMapping - attaches the bean to a URL using an bean factor post processor (AnnotationHandlerMaping)

@UrlMappings - enables multiple UrlMappings per bean

@Property

@ConstructorArgs

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.

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.

with this jar, I was able to define only a datasource, transaction manager,sessionFactory,tx:annotation-driven,and a defaultViewResolver

and write all the rest of my application without touching in a XML file.

this way, all I need to know about my beans was in the bean code.

the installation of it is preaty clean too:

<?xml version="1.0" encoding="UTF-8"?>

<web-app id="WebApp_ID" version="2.4"

xmlns="http://java.sun.com/xml/ns/j2ee"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<display-name>TO - Novo Site</display-name>

<context-param>

<param-name>contextConfigLocation</param-name>

<param-value>classpath*:applicationContext.xml</param-value>

</context-param>

<context-param>

<param-name>contextClass</param-name>

<param-value>

br.com.techoffice.spring.web.TOAnnotationXmlWebApplicationContext

</param-value>

</context-param>

<listener>

<listener-class>

org.springframework.web.context.ContextLoaderListener

</listener-class>

</listener>

<filter>

<filter-name>requestContext</filter-name>

<filter-class>

org.springframework.web.filter.RequestContextFilter

</filter-class>

</filter>

<filter-mapping>

<filter-name>requestContext</filter-name>

<url-pattern>/*</url-pattern>

</filter-mapping>

<servlet>

<servlet-name>dispatcher</servlet-name>

<servlet-class>

org.springframework.web.servlet.DispatcherServlet

</servlet-class>

<load-on-startup>1</load-on-startup>

</servlet>

<servlet-mapping>

<servlet-name>dispatcher</servlet-name>

<url-pattern>*.to</url-pattern>

</servlet-mapping>

<servlet-mapping>

<servlet-name>dispatcher</servlet-name>

<url-pattern>/web/*</url-pattern>

</servlet-mapping>

</web-app>

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?)

again, please consider it as an optional module for spring framework.

and thanks for the great framework, it has saved a few of my projects in clients in the last 2 years.

Issue Links:

#6680 Enable the definition of beans in the application context using annotations instead of XML ("duplicates")