On Fri, 2011-07-15 at 16:00 +0200, Reinhard Pötz wrote:
> On 07/13/2011 08:12 PM, Thorsten Scherler wrote:
> > Hi all,
> >
> > I developed a small @Logger annotation for a customer project which I
> > would like to contribute. The question is ATM what is the best way?
> >
> > ATM I have implemented the annotation based on an independent
> > BeanPostProcessor which I then invoke with adding
> > <!-- logger annotation implementation -->
> > <bean class="org.apache.cocoon.common.LoggerInjector"/>
> >
> > Basically the class is doing:
> > if (field.getAnnotation(Logger.class) != null) {
> > Log log = LogFactory.getLog(bean.getClass());
> > field.set(bean, log);
> > }
> >
> > I saw SpringRESTController and I wonder whether we should add it there
> > in getController as populateLogger(configuration, unpackedController,
> > annotatedFields);
> >
> > or to leave it independent to allow usages as well in REST independent
> > components such as generators, etc.
>
> Injection logger instances is already supported. You can use the
> org.apache.cocoon.rest.controller.annotation.Inject annotation on a
> field of type org.apache.commons.logging.Log.
Hmm but how I do get then the instance of
LogFactory.getLog(bean.getClass()); injected?
The javadoc is not very clear for @interface Inject, what is the
difference from @autowired?
salu2
>
> BTW, in the beta phase we should move our codebase to slf4j ...
>
--
Thorsten Scherler <thorsten.at.apache.org>
codeBusters S.L. - web based systems
<consulting, training and solutions>
http://www.codebusters.es/