tags:

views:

499

answers:

1

consider a JSF web application with a managed bean FooBean.java. I've declared this "FooBean" in my faces-config.xml file. Now, if I want to add the Spring AOP advice for the methods of FooBean, how do I do that?

  • Should I add an applicationContext.xml file and declare the managed beans inside it?
  • or will it work even if I am not declaring the managed beans inside a Spring configuration file?

Note: I've created an Aspect bean and defined a point-cut like @Pointcut("within(dummy.web.reporting..*)") inside the aspect bean.

+1  A: 

You can load a regular spring context xml file from within your web.xml like so:

<context-param>
   <param-name>contextConfigLocation</param-name>
   <param-value>/WEB-INF/classes/spring-context.xml</param-value>
</context-param>

You can then define your managed beans in here in the regualar spring way and you can still refer to these beans by id in your jsps.

You will also be able to use all the standard Spring AOP stuff within your spring-context.xml

mR_fr0g