Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring MVC AOP Logger

 
Matt Thomassan
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ranchers,

I have successfully implemented AOP in a basic (non-MVC) Spring application.

But now I want to implement AOP in Spring MVC.

1) Here is the controller
AddEmployeeSimpleFormController


2) Here is the advisor class i.e. aspects class
LogAspects.java


3) Here is the main XML file:
springmvc-servlet.xml


The problem is whenever onSubmit() of the controller runs, all the aspects of LogAspects.java are not running.

I am unable to figure out the problem.

Please give me any pointers.

Thank You.

Best Regards
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where's the aspect bean definition?
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Spring AOP is proxy-based it will not work with onSubmit.

It works only with handleRequest (since version that it's not final).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic