we are considering using aspects for domain entity objects to ensure some constraints and check some conditions using AspectJ LTW since they are not beans.
Let’s say to prohibit calls for annotated methods in web block and that works well, since web block uses ParallelWebappClassLoader which supports transformations. Moreover with Spring @Configurable annotations there is an easier way to inject beans without boring AppBeans (actually not sure whether it’s a good idea or not).
Some troubles happen when <context:load-time-weaver> present in core block. Because of OrmXmlAwareClassLoader a bean implementing DefaultContextLoadTimeWeaver fails to initialize, using spring-instrumentation doesn’t help as well.
Any ideas about using aspects in general and this particular trouble?
Thanks in advance.
In that case you should define exact LoadTimeWeaver by set weaver-class attribute for <context:load-time-weaver> at spring.xml. With Tomcat it should be like: <context:load-time-weaver aspectj-weaving="on" weaver-class ="org.springframework.instrument.classloading.tomcat.TomcatLoadTimeWeaver"/>.