<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<br>
<div class="moz-cite-prefix">On 2/6/14 2:39 PM, Tom Zeller wrote:<br>
</div>
<blockquote
cite="mid:CAMNmQDQ9U3Xtei+=Lqs9jNVC64JKbB-eaue4fN-TLG8JypXYVQ@mail.gmail.com"
type="cite">
I have not tried a PostProcessor nor plan to anytime soon, would
be
good to know if that works.<br>
</blockquote>
<br>
I tried it. It mostly seems to work ok. Rough sketch attached.<br>
<br>
Couple of notes:<br>
1) Would need real error handling, some other conditional checking,
etc<br>
<br>
2) BeanDefinition doesn't give you the actual Class of the bean,
only the String name, so have to use something to load the Class
instance from the name (perhaps not Class.forName(), maybe Thread
context classloader, etc). As they note, that may or may not be the
runtime class of the bean, depending on use of bean definition
inheritance. I suppose also theoretically BeanPostProcessor can
muck with that also, as the returned bean need not be the same class
as the input bean. Probably not relevant to our use case, but
probably needs some more in-depth thought to confirm.<br>
<br>
3) Most importantly: You probably already know this, but in Java
annotations aren't "inherited" by design on Class instances. So
assuming we'd want to be able to declare @Scope on superclasses
and/or interfaces, this code would need to implement the annotation
"inheritance" by traversing up the inheritance tree looking for the
@Scope at each level (and each level's implemented interfaces if we
wanted to support on interfaces).<br>
</body>
</html>