I'd like to enable Spring's component scanner (<context:component-scan .../>) to look for all Interfaces annotated with the @Service annotation.
Then for remoting scenarios, the client tier Scanner could find all interfaces annotated with @Service and then auto-generate remoting proxy stubs. The server tier Scanner can find the same annotated interfaces and auto-generate the remoting exporters. All of this would be really slick and work based on just the @Service annotation on one or more interfaces.
The problem currently is that the @Service annotation is really expected to be used within Class definitions - not Interfaces (indeed the ClassPathScanningCandidateComponentProvider#isCandidateComponent(AnnotatedBeanDefinition beanDefinition) method explicitly discards Interfaces by default).
This is an important distinction because in most remoting environments, the actual business implementations of an Interface will not be shipped to the client VM, so annotating the implementation class won't work.
For example, in a business-tier environment using JMS remoting, 2 BeanDefinitions could be registered based on a single discovered @Service annotated Interface: an InvocationListener and a ServiceExporter. In the client-tier environment, a BeanDefinition that specifies some service ProxyFactoryBean would be registered.
Where 'myBeanDefinitionFactory' would implement an interface that has a method that, given a MetadataReader returns a Collection<BeanDefinition>, i.e.
BeanDefinitionFactory#createBeanDefinitions(MetadataReader metadataReader) : Collection<BeanDefinition>
Then in ClassPathScanningCandidateComponentProvider (somewhere between lines 190 and 201):
Collection<BeanDefinition> created= registeredBeanDefinitionFactory.createBeanDefinitions(locatedMetadataReader);