xbean can tell you about the subclasses of classes you found from an 
annotation.  The annotation tells you about Farmer, then since @Observes is 
inherited you look for subclasses of Farmer and find LazyFarmer.

I still don't see any problems as long as completely non-annotation-related 
pojo beans can be defined lazily on first (dynamic) use.

david jencks

On Mar 4, 2011, at 4:57 AM, Mark Struberg wrote:

> hi!
> 
> I've now fixed the DefinitionUtil#isPurePojoBean and a few other things which 
> means the TCK is now working again.
> 
> 
> @djencks: I fear we really have to scan all beans. In the official TCK there 
> is a class
> 
> public class LazyFarmer extends Farmer 
> {
> }
> 
> but since Farmer is
> 
> public class Farmer
> {
> 
>   public void observeEggLaying(@Observes Egg egg)
>   {
>      egg.recordVisit(this);
>   }
> 
> }
> 
> it is also a JSR-299 managed bean and MUST get picked up eagerly :(
> 
> So without the definition in the spec that any CDI bean have to define a 
> proper scope, we just need to suck all the classes :(
> 
> Currently all this class loading consumes a huge amount of PermGenSpace, and 
> here is where xbean could help. If we dont use 
> 
> Class#getDeclaredConstructors() / Annotations
> Class#getDeclaredMethods() / Annotations
> ...
> 
> but instead get this info from XBean, then we do not pollute the ClassLoader 
> and after the scanning, we can just clear the XBean cache again to reduce 
> memory consumption.
> 
> LieGrue,
> strub
> 
> 
> 

Reply via email to