It's cool that it can be done like that. However, it's still not clear
to me what the advantage (besides giving people more choice if they
It isn't clear to me either. But as I know of some people (including myself)
that i's using @Configurable to inject their domain objects (this is the
spring 2 recommended way to go with that kind of wizardry), they may prefer
to reutilize the same general technique for their presentation layer.
Also, forgive me if I missed something, but if those dependencies are
defined as transients and the components would be serialized and
deserialized, who/ where/ what would be in charge of re-injecting the
dependencies?
Take a look at
http://opensource.atlassian.com/projects/spring/browse/SPR-2896. The toy
aspect I have defined before won't take care of dependency injecting upon
deserialization, but it's a matter of advicing readResolve too as have been
done for the spring 2.0.3 AnnotationBeanConfigurerAspect; it's pretty easy,
I'll post the updated aspect later.
Cheers,
Carlos
Eelco
On 3/23/07, Carlos Pita <[EMAIL PROTECTED]> wrote:
>
>
>
> > heh, the biggest advantage of @SpringBean is that it is done _before_
the
> constructor. i use services in the constructor all the time. maybe you
can
> tweak the aspectj aspect to also do it before as well.
>
> (But do you explicitly invoke these services from inside the constructor
or
> just delay execution inside populateItem-like callbacks? Sorry if the
> question is silly but I'm still making my way into wicket.)
>
> Regarding tweaking the aspect, the off-the-shelf pointcut is an
> initialization one and the advice is an after one. Initialization
pointcut
> will encompass the period from the return from the super constructor
call to
> the return of the first-called constructor. So the advice will in fact
be
> called after the constructor returns. But redefining the advice to
> before-initialization (or before-call or before-execution) is trivial:
>
> @Aspect
> public class ConfigurerAspect extends BeanConfigurerSupport {
>
> public ConfigurerAspect() {
> setBeanWiringInfoResolver(new
> AnnotationBeanWiringInfoResolver());
> }
>
>
> @Before("initialization((@
org.springframework.beans.factory.annotation.Configurable
> *).new(..)) && this(bean)")
> public void beanCreation(Object bean) {
> configureBean(bean);
> }
> }
>
> Then you will need to replace <aop:spring-configured> for <bean
> class="toy.ConfigurerAspect" factory-method="aspectOf"/> in your
application
> context.
>
> The same can be done for matching your generic data providers but using
> ClassNameBeanWiringInfoResolver and a different pointcut instead.
>
> I've attached the example modified with the custom aspect.
>
> Cheers,
> Carlos
>
> >
> >
> >
> >
> > On 3/23/07, Carlos Pita < [EMAIL PROTECTED]> wrote:
> > >
> > > Here is an example of using @Configurable to integrate spring with
> wicket as some people has asked me for one. To launch it just:
> > >
> > > 1) set MAVEN_OPTS=-javaagent:<path-to-aspectwaver.jar
>/aspectjweaver.jar
> in the env.
> > > 2) run 'mvn jetty:run'
> > >
> > > Notice that dependencies are injected *after* constructor execution,
so
> for this simple toy page that just get a text message from its only
> dependency, it could seem a little contrived to setup a read only Model
just
> for feeding that message. More realistic scenarios generally will put a
dao
> behind a model so the dependency won't be directly needed at
construction
> time but instead when model callbacks are called.
> > >
> > >
> > >
> > > >
> > > >
> > > > >
> > > > >
> > > > > I clearly see what you mean now. Maybe you can define another
> pointcut for the ConfigurerAspect that is not annotation based so you
can
> advice classes which you are not able to modify. But anyway the
simplicity
> that appealed me at first about my suggestion was somewhat
> > > >
> > >
> > >
> > > I've been done a little research and find out that the class
> AbstractBeanConfigurerAspect is provided just for this need. See for
example
> http://forum.springframework.org/showthread.php?t=30993.
> > > Cheers,
> > > Carlos
> > >
> > >
> > >
>
-------------------------------------------------------------------------
> > > Take Surveys. Earn Cash. Influence the Future of IT
> > > Join SourceForge.net's Techsay panel and you'll get the chance to
share
> your
> > > opinions on IT & business topics through brief surveys-and earn cash
> > >
>
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > > _______________________________________________
> > > Wicket-user mailing list
> > > Wicket-user@lists.sourceforge.net
> > >
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> > >
> > >
> > >
> >
> >
> >
>
-------------------------------------------------------------------------
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance to
share
> your
> > opinions on IT & business topics through brief surveys-and earn cash
> >
>
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > _______________________________________________
> > Wicket-user mailing list
> > Wicket-user@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
> >
>
>
>
-------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
your
> opinions on IT & business topics through brief surveys-and earn cash
>
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>
>
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user