Gavin King wrote:
On Mon, Oct 19, 2009 at 7:55 PM, Roberto Chinnici
<Roberto.Chinnici@sun.com> wrote:

  
But that's the issue, because it triggers scanning of all application
classes.
    

No it doesn't! Thats the whole point!

Pete of course has implemented this without scanning of non-bean
deployment archives.
  

Scanning for @Resource at deployment time, not scanning for beans as such.

On top of that, it's speculative scanning. If the bean isn't
discovered until we find a use of the "second bean" (with @New), should we
tentatively retain as valid all the resources the bean declares, during
scanning, only to discard them if it turns out the bean does not actually
exist (i.e. there is no usage with @New)? I'm also starting to wonder where
this process ends, given that the SPI lets the application register new
beans at runtime. Does that mean that all resources declared anywhere are
valid?
    

Nononononono!

The 299 impl creates the Bean object for the "second bean"
(unfortunate term) when it notices the injection point with @New.
  

But surely it must create the bean for the first bean too, in that it'll show up in the metamodel.