Could not resolve placeholder 'jwt.secret' in string value "${jwt.secret}"
<p>I have configured the property source using the annotation:</p>

<p><code>@PropertySource(value = {"classpath:application.properties"})</code> but I still get error saying <code>Could not resolve placeholder 'jwt.secret' in string value</code></p>

<pre><code>@PropertySource(value = {"classpath:application.properties"})
public class JwtAuthenticationTokenFilter extends AbstractAuthenticationProcessingFilter {

    @Value("${jwt.header}")
    private String tokenHeader;

    public JwtAuthenticationTokenFilter() {
        super("/**");
    }
}
</code></pre>

<p>dispatcher-servlet:</p>

<pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:security="http://www.springframework.org/schema/security"
       xmlns:jpa="http://www.springframework.org/schema/data/jpa"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xsi:schemaLocation="
        http://www.springframework.org/schema/beans     
        http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context-4.1.xsd
        http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd
        http://www.springframework.org/schema/security 
        http://www.springframework.org/schema/security/spring-security-4.1.xsd
        http://www.springframework.org/schema/data/jpa
        http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
        http://www.springframework.org/schema/tx
        http://www.springframework.org/schema/tx/spring-tx.xsd"&gt;

    &lt;context:component-scan base-package="com.rsc."/&gt;
    &lt;mvc:annotation-driven /&gt;

    &lt;mvc:resources mapping="/resources/**" location="/resources/"/&gt;

    &lt;bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource"&gt;
        &lt;property name="basenames"&gt;
            &lt;list&gt;
                &lt;value&gt;classpath:validation&lt;/value&gt;
            &lt;/list&gt;
        &lt;/property&gt;
    &lt;/bean&gt;

&lt;!--    &lt;bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;
        &lt;property name="locations"&gt;
            &lt;list&gt;
                &lt;value&gt;classpath:application.yml&lt;/value&gt;
            &lt;/list&gt;
        &lt;/property&gt;
    &lt;/bean&gt;--&gt;

    &lt;!--    &lt;security:authentication-manager alias="authenticationManager"&gt;
        &lt;security:authentication-provider user-service-ref="userDetailsServiceImpl"&gt;
            &lt;security:password-encoder ref="encoder"&gt;&lt;/security:password-encoder&gt;
        &lt;/security:authentication-provider&gt;
    &lt;/security:authentication-manager&gt;--&gt;   

    &lt;!--&lt;bean id="userDetailsServiceImpl" class="com.rsc.service.UserDetailsServiceImpl"&gt;&lt;/bean&gt;--&gt;

    &lt;bean id="JwtAuthenticationTokenFilter" class="com.rsc.security.JwtAuthenticationTokenFilter"&gt;
        &lt;property name="authenticationManager" ref="authenticationManager" /&gt;
        &lt;property name="authenticationSuccessHandler" ref="jwtAuthenticationSuccessHandler" /&gt;
    &lt;/bean&gt;

    &lt;security:authentication-manager alias="authenticationManager"&gt;
        &lt;security:authentication-provider ref="jwtAuthenticationProvider" /&gt;
    &lt;/security:authentication-manager&gt;

    &lt;bean id="encoder" class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder"&gt;
        &lt;constructor-arg name="strength" value="11"/&gt;
    &lt;/bean&gt;

    &lt;!-- Configure the data source bean --&gt;
    &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"&gt;
        &lt;property name="driverClassName" value="${jdbc.driverClassName}"/&gt;
        &lt;property name="url" value="${jdbc.url}"/&gt;
        &lt;property name="username" value="${jdbc.username}"/&gt;
        &lt;property name="password" value="${jdbc.password}"/&gt;
    &lt;/bean&gt;

    &lt;!-- Configure the entity manager factory bean --&gt;
    &lt;bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt;
        &lt;property name="dataSource" ref="dataSource"/&gt;
        &lt;property name="packagesToScan" value="com.rsc.model"/&gt;
        &lt;property name="jpaVendorAdapter"&gt;
            &lt;bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"/&gt;
        &lt;/property&gt;
        &lt;property name="jpaProperties"&gt;
            &lt;props&gt;
                &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/prop&gt;
                &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
                &lt;prop key="hbm2ddl.auto"&gt;create&lt;/prop&gt;
                &lt;prop key="hibernate.id.new_generator_mappings"&gt;false&lt;/prop&gt;
            &lt;/props&gt;
        &lt;/property&gt;
    &lt;/bean&gt;

    &lt;!-- Configure the transaction manager bean --&gt;
    &lt;bean id="transactionManager"
          class="org.springframework.orm.jpa.JpaTransactionManager"&gt;
        &lt;property name="entityManagerFactory" ref="entityManagerFactory"/&gt;
    &lt;/bean&gt;

    &lt;!-- Enable annotation driven transaction management --&gt;
    &lt;tx:annotation-driven/&gt;

    &lt;jpa:repositories base-package="com.rsc.repository"/&gt;

    &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
        &lt;property name="prefix" value="/WEB-INF/views/"/&gt;
        &lt;property name="suffix" value=".jsp"/&gt;
    &lt;/bean&gt;
&lt;/beans&gt;
</code></pre>

<p>Application properties:</p>

<pre><code>jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/rs_education
jdbc.username=admin
jdbc.password=admin

jwt:
  header: Authorization
  secret: my-very-secret-key
logging:
  level:
    org.springframework.security: DEBUG
server:
  port: 8888
spring:
  resources:
    chain:
      enabled: true
management:
  security:
    enabled: true # set to false to disable 'default' Spring Boot security
</code></pre>