Annotation for xml-parent - Solution [SPR-6343] #11009
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: declined
A suggestion or change that we don't feel we should currently apply
type: task
A general task
Michael Hauser opened SPR-6343 and commented
I have a solution for this problem, see 3 Code snippets below:
1)--- The annotation
@Interface
CildOf.java
package ??????? ; // fill in whatever suits you
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.stereotype.Component;
/**
@author
HAUSER@since
2009-05-12*/
@Target
(ElementType.TYPE)@Retention
(RetentionPolicy.RUNTIME)@Documented
@Component
public
@interface
ChildOf {}
2)--- The BeanFactoryPostProcessor to digest this
BeanFactoryPostProcessor.java
package ??????? ; // fill in whatever suits you
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.FatalBeanException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.core.Ordered;
import org.springframework.core.PriorityOrdered;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.util.StringUtils;
/**
@link
at.gv.brz.spring.beans.ChildOf@ChildOf
}@author
HAUSER@since
2009-05-12*/
public class ChildOfBeanFactoryPostProcessor implements
BeanFactoryPostProcessor, PriorityOrdered {
}
<bean id="childOfAnnotationsProcessor" class="??????.ChildOfBeanFactoryPostProcessor" />
4) and final annotate any
@Component
,@Controller
, ... etc like:@ChildOf
(parent = "baseController")@Controller
public class MyDerivedController extends BaseController {
Affects: 2.5.6
Reference URL: http://jira.springframework.org/browse/SPR-5580
This issue is a sub-task of #10251
1 votes, 0 watchers
The text was updated successfully, but these errors were encountered: