Announcement Announcement Module
No announcement yet.
GenericFilterBean and init params -> bean props Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • GenericFilterBean and init params -> bean props

    I have a filter specified in the web.xml with init param as


    In my Filter's constructor i call


    and have added methods:

    public void setExcludePatterns(String patterns) {
    m_excludePatterns = patterns;

    public String getExcludePatterns() {
    return m_excludePatterns;

    Yet, this bean setter methods are never called.

    I see that the addRequiredProperty method is called, but for some reason i can't debug into this code when launched from web logic (perhaps the debugger hasn't attached yet).

    What am i doing wrong that these bean property calls are not working?

    (The filter is working correctly otherwise)

    Using Spring 3.0.5.RELEASE


  • #2
    How to get init-params read thru bean properties

    In order for the bean property setters to be called for <init-param> the following built-in param needs to be defined, so that the target Filter's init method is called. (which does all the bean reflection).


    This is ridiculously brain-dead on springs part. Why would i define initial parameters but not want them read.

    Anyway, any poor shlub who follows after, might find this helpful.


    • #3
      Thanks for the post! Definitely a time saver! After reading your post, took a quick look at the source code and see why they did it that way; Spring figures that the filter configuration should all be done via bean definition, and not via the web-xml. Interesting choice.

      But I agree - it should be smart enough to see that if there are params defined that it reads them.

      Tx again!