Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8109821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:32:21+00:00 2026-06-06T01:32:21+00:00

I was trying to implement Spring AOP in web app. Unfortunately all the sample

  • 0

I was trying to implement Spring AOP in web app. Unfortunately all the sample code I found on the Web are console app. I was running out of clue how could I do it in web app?

In web.xml file, I load the applicationContext.xml like this:

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

In applicationContext.xml file, I have ProxyFactoryBean defined like this:

<bean id="theBo" class="my.package.TheBo">
  ...
</bean>    
<bean id="theProxy" class="org.springframework.aop.framework.ProxyFactoryBean">
      <property name="proxyInterfaces">
        <list>
            <value>my.package.ITheBo</value>
        </list>
    </property>
    <property name="target" ref="theBo"/>
    <property name="interceptorNames">
        <list>
            <value>loggingBeforeAdvice</value>
        </list>
    </property>
</bean>

My situation now is I don’t know where is the best place to put this code:

ApplicationContext context = new ClassPathXmlApplicationContext("WEB-INF/applicationContext.xml");
theBo = (ITheBo) context.getBean("theProxy");

If this was a console app, I would rather put it in the main(), but how could I do it in web app?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T01:32:22+00:00Added an answer on June 6, 2026 at 1:32 am

    Thanks to @Dave Newton giving me the clue. In order for me to inject theProxy from the web, for my case, it was JSF, I have to put following code in faces-config.xml.

    <application>
       <variable-resolver>
          org.springframework.web.jsf.DelegatingVariableResolver
       </variable-resolver>
    </application>
    
    <managed-bean>
       <managed-bean-name>theAction</managed-bean-name>
       <managed-bean-class>org.huahsin68.theAction</managed-bean-class>
          <managed-bean-scope>session</managed-bean-scope>
          <managed-property>
             <property-name>theBo</property-name>
                <value>#{theProxy}</value>
          </managed-property>
    </managed-bean>
    

    And the put in the listener provided by @tom as well into web.xml.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to implement a Session-Per-Conversation pattern in a JSF2-Spring-Hibernate Web App so
I am trying to implement Riot CMS to my Spring-java web application using http://www.riotfamily.org/docs/quickstart.html
I'm trying to make a simple username/password authentication in a Spring Security web app.
I'm trying to implement spring-security to handle authentication and authorization of my web application.
I'm new to Spring and Spring MVC. I'm trying to implement a basic web-application
I'm trying to implement my first Spring MVC controller, following Spring documentation, some tutorials
Iam trying to implement a simple JMS(traditional not using springs) code in eclipse using
Trying to implement a UITableView of names similar to the built-in Contacts iPhone app
I am trying to use Spring AOP with Spring MVC Controller. I have 3
I am trying to implement email functionality in my app but I keep getting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.