title: get properties from application.properties in spring boot
body: <p>I want to get values using @Value annotation from application.properties in spring boot web project. I thought I can just use @Value annotation because i thought the variables in application.properties are just loaded on the fly. But when I write just @Value annotation it doens't work.</p>
  
  <p>I have a property in application.poperties</p>
  
  <pre><code>google.recaptcha.site-key=???
  </code></pre>
  
  <p>And I wanted to load the value, so I coded like below.</p>
  
  <pre><code>@Controller
  @RequestMapping("/member")
  public class MemberController extends BaseController{
  
      @Value("#{google.recaptcha.site-key}")
      public String recaptchaSiteKey; 
  
  }
  </code></pre>
  
  <p>But eclipse returns error when I compile the code.</p>
  
  <pre><code>Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1008E: Property or field 'google' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext' - maybe not public?
      at org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty(PropertyOrFieldReference.java:226) ~[spring-expression-4.3.12.RELEASE.jar:4.3.12.RELEASE]
      at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:94) ~[spring-expression-4.3.12.RELEASE.jar:4.3.12.RELEASE]
      at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:81) ~[spring-expression-4.3.12.RELEASE.jar:4.3.12.RELEASE]
      at org.springframework.expression.spel.ast.CompoundExpression.getValueRef(CompoundExpression.java:51) ~[spring-expression-4.3.12.RELEASE.jar:4.3.12.RELEASE]
      at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:87) ~[spring-expression-4.3.12.RELEASE.jar:4.3.12.RELEASE]
      at org.springframework.expression.spel.ast.OpMinus.getValueInternal(OpMinus.java:98) ~[spring-expression-4.3.12.RELEASE.jar:4.3.12.RELEASE]
      at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:121) ~[spring-expression-4.3.12.RELEASE.jar:4.3.12.RELEASE]
      at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:262) ~[spring-expression-4.3.12.RELEASE.jar:4.3.12.RELEASE]
      at org.springframework.context.expression.StandardBeanExpressionResolver.evaluate(StandardBeanExpressionResolver.java:161) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
      ... 28 common frames omitted
  </code></pre>
  
  <p>Saying cannot resolve google object since the property name is starting with "google.XXX".</p>
  
  <p>How do I solve this issue??</p>