title: declaration can be found for element 'context:property-placeholder'. Spring 4
body: <p>I browsed around 30 webpages and 50 articles about this and it's still not working.<br><br>
  Here is my code its really simple I'm only a Spring beginner.</p>
  
  <p><strong>App.java</strong></p>
  
  <pre><code>package com.procus.spring.simple.simple;
  
  import org.springframework.context.ApplicationContext;
  import org.springframework.context.support.ClassPathXmlApplicationContext;
  
  /**
   *
   * @author procus
   */
  public class App {
  
      public static void main(String[] args) {
          ApplicationContext con = new ClassPathXmlApplicationContext("SpringBeans.xml");
          SampleSimpleApplication sam = (SampleSimpleApplication) con.getBean("sam");
          sam.run(args);
      }
  }
  </code></pre>
  
  <p><strong>SampleSimpleApplication.java</strong></p>
  
  <pre><code>package com.procus.spring.simple.simple;
  
  import com.procus.calculator.basic.BasicCalculator;
  import com.procus.spring.simple.simple.service.HelloWorldService;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.boot.CommandLineRunner;
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
  import org.springframework.context.annotation.ComponentScan;
  import org.springframework.context.annotation.Configuration;
  
  @Configuration
  @EnableAutoConfiguration
  @ComponentScan(basePackageClasses = BasicCalculator.class)
  public class SampleSimpleApplication implements CommandLineRunner {
  
  
      // intentional error
      @Autowired
      BasicCalculator calculator;
  
  
      // Simple example shows how a command line spring application can execute an
      // injected bean service. Also demonstrates how you can use @Value to inject
      // command line args ('--name=whatever') or application properties
  
      @Autowired
      private HelloWorldService helloWorldService;
  
          public SampleSimpleApplication() {
          }
  
  
      @Override
      public void run(String... args) {
          System.out.println(this.helloWorldService.getHelloMessage());
      }
  
      public static void main(String[] args) throws Exception {
          SpringApplication.run(SampleSimpleApplication.class, args);
      }
  }
  </code></pre>
  
  <p><strong>HelloWorldService.java</strong></p>
  
  <pre><code>package com.procus.spring.simple.simple.service;
  
  import org.springframework.beans.factory.annotation.Value;
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.context.annotation.PropertySource;
  import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
  import org.springframework.stereotype.Component;
  
  @Component
  @Configuration
  @PropertySource(value = { "classpath:application.properties" })
  public class HelloWorldService {
  
      @Value("${app.name:World}")
      private String name;
  
  
      public String getHelloMessage() {
          return "Hello " + this.name;
      }
  
      /**
       * @param name the name to set
       */
      public void setName(String name) {
          this.name = name;
      }
  
      @Bean
      public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
          return new PropertySourcesPlaceholderConfigurer();
      }
  
  }
  </code></pre>
  
  <p><strong>SpringBeans.xml</strong></p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;beans xmlns="http://www.springframework.org/schema/beans"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns:context="http://www.springframework.org/schema/context"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd"&gt;
  
      &lt;bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"/&gt;
  
  &lt;context:property-placeholder location="classpath*:application.properties"/&gt;
  
      &lt;bean id="DBProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean"&gt;
      &lt;property name="locations"&gt;
          &lt;value&gt;classpath*:application.properties&lt;/value&gt;
        &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;bean id="sam" class="com.procus.spring.simple.simple.SampleSimpleApplication"/&gt;
      &lt;bean id="serv" class="com.procus.spring.simple.simple.service.HelloWorldService"&gt;
          &lt;property name="name" value="Jano" /&gt;
      &lt;/bean&gt;
      &lt;bean id="calc" class="com.procus.calculator.basic.BasicCalculator"&gt;
          &lt;constructor-arg value="1.0"/&gt;
      &lt;/bean&gt;
  
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>And in resources folder is my application.properties file which contains only <strong>app.name=Phil</strong></p>
  
  <blockquote>
    <p>Exception in thread "main"
    org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
    Line 12 in XML document from class path resource [SpringBeans.xml] is
    invalid; nested exception is org.xml.sax.SAXParseException;
    lineNumber: 12; columnNumber: 81; cvc-complex-type.2.4.c: The matching
    wildcard is strict, but no declaration can be found for element
    'context:property-placeholder'.</p>
  </blockquote>
  
  <p>I really tried most of solutions which I found at stackoverflow and few other forums. I`m really new in spring and I will appreciate any help.</p>