I have had a look at creating my own BeanMetaDataVisitor implementation for use in
AspectBeanMetaDataFactory
| private boolean hasInjectedBeans(BeanMetaData beanMetaData)
| {
| DependencyBeanMetaDataVisitor visitor = new
DependencyBeanMetaDataVisitor(beanMetaData);
|
| beanMetaData.describeVisit(visitor);
| beanMetaData.initialVisit(visitor);
|
| return beanMetaData.getHasDependencies();
| }
|
|
| private static class DependencyBeanMetaDataVisitor extends AbstractMetaDataVisitor
| {
| private boolean hasDependencies;
|
| protected DependencyBeanMetaDataVisitor(BeanMetaData bmd)
| {
| // FIXME DependencyBeanMetaDataVisitor constructor
| super(bmd, new DependencyKernelControllerContext(bmd));
| }
|
| public boolean getHasDependencies()
| {
| return hasDependencies;
| }
|
| public void addDependency(DependencyItem dependency)
| {
| hasDependencies = true;
| }
| }
|
But describeVisit() does not work due to the underlying value not being picked up in
AbstractInjectionValueMetaData
| @SuppressWarnings("deprecation")
| public void describeVisit(MetaDataVisitor visitor)
| {
| // no bean and not by_name
| if (getUnderlyingValue() == null)
| {
| ...
| }
| super.describeVisit(visitor);
| }
|
installVisit() gives NPEs since we don't have a KernelControllerContext for the
created bean at this stage. I tried mocking one, but so far that does not work since it
needs a reference to the kernel etc., but I will try a bit more.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4207790#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...