0

I have an annotated bean with @Component that gets built using <context:component-scan/>, however I wish to set a boolean property after this has been created from a value within a properties file using <context:property-placeholder/>.

5
  • 3
    Annotate the field with @Value("propertyName"). See this answer: stackoverflow.com/questions/11890544/… Commented Apr 3, 2013 at 16:48
  • Thanks @SotiriosDelimanolis. Please make an answer and I shall accept it. Commented Apr 3, 2013 at 17:11
  • Too late :). Happy you got it. Commented Apr 3, 2013 at 17:41
  • 1
    LOL no that's not what I was getting at. Give him the answer, I don't care about points as long as you solved your problem. Commented Apr 3, 2013 at 17:49
  • @SotiriosDelimanolis if you add an answer, I will delete mine. you did answer first after all. I just wanted the question to show up as having been answered in the search. Commented Apr 3, 2013 at 17:52

1 Answer 1

2

Annotate the field with @Value("propertyName").

See related question: Spring @Value annotation in @Controller class not evaluating to value inside properties file

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.