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/>.
Asked
Active
Viewed 1,979 times
0
Brett Ryan
- 25,080
- 29
- 122
- 158
-
3Annotate the field with `@Value("propertyName")`. See this answer: http://stackoverflow.com/questions/11890544/spring-value-annotation-in-controller-class-not-evaluating-to-value-inside-pro – Sotirios Delimanolis Apr 03 '13 at 16:48
-
Thanks @SotiriosDelimanolis. Please make an answer and I shall accept it. – Brett Ryan Apr 03 '13 at 17:11
-
Too late :). Happy you got it. – Sotirios Delimanolis Apr 03 '13 at 17:41
-
1LOL 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. – Sotirios Delimanolis Apr 03 '13 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. – Mike Rylander Apr 03 '13 at 17:52
-
Okay, thanks for the help @SotiriosDelimanolis, it was very much appreciated. – Brett Ryan Apr 03 '13 at 17:52
1 Answers
2
Annotate the field with @Value("propertyName").
See related question: Spring @Value annotation in @Controller class not evaluating to value inside properties file
Community
- 1
- 1
Mike Rylander
- 18,208
- 25
- 87
- 138