Hi !
First of all, I just want to express my love for this beautifull framework !
I am currently developping an extension to broadleaf that will feed an ERP instance (OpenERP for the curious). I want my newly created customer, products and orders to be feed to a temporary database. A seperate process will be responsible to handle the integration into OpenERP (I don't want my FRONT end Broadleaf to handle backoffice matters, I aim high availability for broadleaf). Once completed, I might share my connectors with the community since OpenERP is a great open source solution for accounting and business related stuff.
Back to my problem, I've read about the Bean Mergin functionnality and it seems like making wonders. However, I was interested into take an AOP approch with Spring AOP.
I built an Aspect who intercepts calls to org.broadleafcommerce.profile.core.service.CustomerService.registerCustomer(). Then I created a simple Junit tests who launches a Spring container with a mocked version of org.broadleafcommerce.profile.core.service.CustomerService. My aspect works perfectly when calling my registerCustomer method.
Next step, integrate my new aspect (as a jar dependency) inside the site project (the demo one). I've added my "Aspect Projet" as a dependency insite site/pom.xml. Then added the classpath of that aspect through a context:component-scan inside site/../WEB-INF/applicationContext-servlet.xml.
First run, my @PostContruct method inside my aspect is called properly meaning that Broadleaf's Spring Container instanciated it nicely. However, my final test upon calling CustomerService.registerCustomer fails. A debuging session proved me my that my test reaches the registerCustomer method properly. The method is simply not intercepted by my aspect.
Could it be that the CustomerService is not instanciated inside the same spring container than the one who is responsible of the applicationContext-servlet.xml. Another question I have is the following : "Is it possible to intercept methods from the "broadleaf-profile" module with Aspect imported by dependency in the site project ?". Is there any other Spring AOP configuration I might need to add inside the config files ?
I am sorry for theses tricky questions. But if it is impossible, I will fall back to the bean merging process which is well documented in your online help. If you don't see reason why my approch isn't suposed to work, I'll be glad to upload some snipets of my code. Sorry again for the long post, but some expert knowledge of broadleaf would be highly appreciated
Thanks in advance !
EDIT 2013-05-02 : I have resigned myself to use the context merging capability of Broadleaf and it proved to be pretty efficient. My functionality is working properly. However, I am still curious to know if there is anyway to use AOP over the core services of Broadleaf.
This forum is in readonly mode and serves as an archive of old information. All posting, registration and commenting abilities have been turned off. To get help, the Broadleaf team reguarly monitors the broadleaf-commerce tag on Stack Overflow so please ask your questions there.