0

I have a filter which extends OncePerRequestFilter. I'm trying to read a property value from property file using @Value. I'm not getting the actual value from the properties file instead i get the string of the expression used for getting the value.

@Value("${project.version}")
private String projectVersion;

If i try to use the variable it has {project.version} as the value. Am i missing something here ? Any help is appreciated.

My web.xml looks like below

<filter>
    <filter-name>ModifyRequestFilter</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    <init-param>
        <param-name>targetBeanName</param-name>
        <param-value>modifyRequestFilter</param-value>
  </init-param> 
</filter>
<filter-mapping>
    <filter-name>ModifyRequestFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

And applicationcontext.xml config for the filter bean is as below

<bean id="modifyRequestFilter" class="com.mycompany.filters.ModifyRequestFilter"/>

0 Answers0