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 3219970
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:42:27+00:00 2026-05-17T15:42:27+00:00

There are 2 entries for a Servlet Filter, one in web.xml and one in

  • 0

There are 2 entries for a Servlet Filter, one in web.xml and one in Spring applicationContext.xml

I added the filter into applicationContext.xml because I wanted to inject creditProcessor bean into it.

The only problem is that the entry in web.xml got picked up by JBoss and then used, so creditProcessor is null.

Do I have to use Spring’s delegatingFilterProxy or similar so I can inject stuffs into the bean, or can I tweak the web.xml?

web.xml:

<filter>
    <filter-name>CreditFilter</filter-name>
    <filter-class>credit.filter.CreditFilter</filter-class>
</filter>

<filter-mapping>
    <filter-name>CreditFilter</filter-name>
    <url-pattern>/coverage/*</url-pattern>        
</filter-mapping>

Spring-applicationContext.xml:

<bean id="creditFilter" class="credit.filter.CreditFilter" >
      <property name="creditProcessor" ref="creditProcessor"/>
</bean>
  • 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-05-17T15:42:28+00:00Added an answer on May 17, 2026 at 3:42 pm

    You can’t make a Filter spring managed like this. With your setup it is instantiated once by spring, and once by the servlet container. Instead, use DelegatingFilterProxy:

    1. declare the filter proxy as a <filter> in web.xml
    2. Set the targetBeanName init-param of the filter definition to specify the bean that should actually handle the filtering:

      <init-param>
          <param-name>targetBeanName</param-name>
          <param-value>creditFilter</param-value>
      </init-param>
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web application that's based on Spring and the application contexts, applicationContext.xml
In my web.config file there are below entries. It seems like it is used
I have a servlet Filter that acts as the basis of my web stack.
The following code continues to be displayed even if there are entries in my
I've been working on a page where there are several entries contained in different
Are there any implementations of a static size hashtable that limits the entries to
My structure: in each category there are texts. These texts are entries of its
I have a database in MySQL which have entries of time. There are more
Is there a tool that can let one browse relational data as a graph
I'm going through a query in which there are 12 entries named choice_1 through

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.