snippetjournal

– notes, snippet codes, and my journal

Archive for September 2014

Spring AOP : simple explanation and simple Example

leave a comment »

  • <aop:aspectj-autoproxy />

Many new spring developers forget that Spring AOP is proxy-based, i.e. its main idea is to return aspect-aware bean proxy instead of the bean itself from the context. So, the user thinks that he or she works with the bean itself and calls bean methods. However, the methods are invoked on a proxy object, hence, the proxy may execute aspect logic before/after delegating the call to the target bean.

That’s all is fine but how does proxy-based AOP relate to the ClassCastException? The answer is that spring framework offers two proxying mechanism – JDK proxy-based and CGLIB-based. The first one can create proxies only for the interfaces; the second one is able to proxy concrete classes with particular limitations (feel free to check spring reference to get more about that – 6.6. Proxying mechanisms). The same reference chapter says the following about proxying mechanism selection:

If the target object to be proxied implements at least one interface then a JDK dynamic proxy will be used. All of the interfaces implemented by the target type will be proxied. If the target object does not implement any interfaces then a CGLIB proxy will be created.

reference : Spring AOP top problem #2 – java.lang.ClassCastException: $Proxy7

example basic aop pada spring, contoh nya sederhana dan mudah di pahami, ada contoh konfigurasi dengan annotation dan juga dengan xml

Written by snippetjournal

September 30, 2014 at 3:10 am

18 Things mentally strong people do

leave a comment »

image

Written by snippetjournal

September 28, 2014 at 2:55 am

Posted in Uncategorized

zenjava – maven plugin for easy assembly application

leave a comment »

The JavaFX Maven Plugin provides a way to assemble distribution bundles for JavaFX applications (2.2+) from within Maven.

Written by snippetjournal

September 26, 2014 at 2:09 am

Posted in Collection Link

JSF – Spring – Hibernate Tutorial

leave a comment »

Written by snippetjournal

September 10, 2014 at 7:15 am

Posted in Collection Link

Password – Hashing and Salt Your Password

leave a comment »

Written by snippetjournal

September 3, 2014 at 9:56 am