|
From: Magnus H. <ma...@fi...> - 2006-05-04 10:10:49
|
> If the new operator was called before Spring was initialized, the aspect
> would try to inject the new object, but fail because Spring won't yet hav=
e
> configured the aspect itself.
Ok, this is the problem then. Bean A implements InitializingBean and
creates bean B using the new operator in afterPropertiesSet(). LTW
using spring won't work until after afterPropertiesSet I guess?
> That doesn't totally surprise me. There is a *lot* more work going on whe=
n
> you load-time weave than when you simply load an existing class. The whol=
e
> aspect weaver has to be fired up, byte codes loaded into memory and
> examined, then possibly transformed before being defined. We're continual=
ly
> working on ways to reduce LTW footprint and weave times (AspectJ 1.5.1 is
> better than 1.5.0 in this regard, and we have more to do in 1.5.2), but L=
TW
> will always be more expensive than straight class loading.
But classes are only loaded once by the classloader? So this is a
startup cost that will fade away after running the app for some time?
I have these options in aop.xml
<weaver options=3D"-verbose
-XmessageHandlerClass:org.springframework.aop.aspectj.AspectJWeaverMessageH=
andler">
=09<include within=3D"se.lantmateriet.jollen.bryggan.domain.keys.Abstra=
ctExternalId"/>
=09<include within=3D"se.lantmateriet.jollen.bryggan.log.DatabaseAppend=
er"/>
</weaver>
I guess thats the best settings I can get? Just including the stuff I
know I want to weave does make a big difference.
What if you want to deploy the app in WLS? Do I have to specify
-javaagent for WLS, or just for the app somehow?
What other options do I have besides LTW? I got this going by reading
your blog at http://www.aspectprogrammer.org/blogs/adrian/2006/02/a_practic=
al_gui_2.html
I guess I need part 2 of that article now? ;)
Also, if I specify @Configurable like this:
@Configurable(autowire =3D Autowire.BY_NAME)
public abstract class AbstractExternalId implements ExternalId {
and only add "<aop:spring-configured/>" to my config, all subclasses
of AbstractExternalId will be injected and visible to the spring bean
context it seems. If I don't want to use autowire, I need to add a
<bean> entry for every subclass... would it be possible to add a
<aop:bean> tag or something that makes it possible to define the
baseclass and it's dependencies, and have it apply and create all
subclasses like it does if I don't add any <bean> tags at all?
Thanks!
--
/Magnus Heino
|