point cut of domain objects created outside spring container

the @Configurable annotation is the cure, basically, its till aspect/aspectJ to detect if any instantiation of beans marked as Configurable; and put into spring container if yes.


@Configurable

 

and it’s only put into spring container after the bean is manually instantiated. So autowired stuff won’t work in this manually instantiated bean still.

And  in order to have spring beans loaded/injected into aspects

    <bean id="aspect"
   class="com.bfm.app.cim.helper.PageDecorator"
   factory-method="aspectOf"  />

 

btw, I dont like spring docs now. it becomes so bulky !
8.8.1 Using AspectJ to dependency inject domain objects with Spring

8.8.3 Configuring AspectJ aspects using Spring IoC

http://docs.spring.io/spring/docs/current/spring-framework-reference/html/aop.html

Advertisements

Good to refresh: log4j additivity against double logging

https://logging.apache.org/log4j/1.2/manual.html

The addAppender method adds an appender to a given logger. Each enabled logging request for a given logger will be forwarded to all the appenders in that logger as well as the appenders higher in the hierarchy. In other words, appenders are inherited additively from the logger hierarchy. For example, if a console appender is added to the root logger, then all enabled logging requests will at least print on the console. If in addition a file appender is added to a logger, say C, then enabled logging requests for C and C's children will print on a file and on the console. It is possible to override this default behavior so that appender accumulation is no longer additive by setting the additivity flag to false.

The rules governing appender additivity are summarized below.

Appender Additivity

    The output of a log statement of logger C will go to all the appenders in C and its ancestors. This is the meaning of the term "appender additivity".

    However, if an ancestor of logger C, say P, has the additivity flag set to false, then C's output will be directed to all the appenders in C and its ancestors upto and including P but not the appenders in any of the ancestors of P.

    Loggers have their additivity flag set to true by default.

in short,

<Loggername="com.foo.Bar"level="trace"additivity="false">

http://logging.apache.org/log4j/2.x/manual/configuration.html

Java SimpleDateFormat Syntax

I re-encountered this again, in tedious ways.

HH vs hh; 24-hour vs 12 hour !!

Letter Date or Time Component Presentation Examples
G Era designator Text AD
y Year Year 1996; 96
Y Week year Year 2009; 09
M Month in year Month July; Jul; 07
w Week in year Number 27
W Week in month Number 2
D Day in year Number 189
d Day in month Number 10
F Day of week in month Number 2
E Day name in week Text Tuesday; Tue
u Day number of week (1 = Monday, …, 7 = Sunday) Number 1
a Am/pm marker Text PM
H Hour in day (0-23) Number 0
k Hour in day (1-24) Number 24
K Hour in am/pm (0-11) Number 0
h Hour in am/pm (1-12) Number 12
m Minute in hour Number 30
s Second in minute Number 55
S Millisecond Number 978
z Time zone General time zone Pacific Standard Time; PST; GMT-08:00
Z Time zone RFC 822 time zone -0800
X Time zone ISO 8601 time zone -08; -0800; -08:00

http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html