0

I'm trying to figure out a way for getting a property values list, for example

test.property = val1, val2, val3

and for each value added, create at runtime another bean of the same certain type, with the added value.

Basically, getting the properties is not the issue, but creating the beans by them. If i'm trying to use BeanFactoryPostProcessor to create the new beans, the properties are null in the phase of postProcessBeanFactory...

Is it possible? Thanks!

user3027497
  • 117
  • 1
  • 7
  • Yes it is. If you want more detailed answer, you should better explain what you tried and where you are stuck. – Serge Ballesta Aug 03 '16 at 08:31
  • I think you want this http://stackoverflow.com/questions/12576156/reading-a-list-from-properties-file-and-load-with-spring-annotation-value – Essex Boy Aug 03 '16 at 08:40
  • @SergeBallesta I want to get a list of strings, and for each string create a bean of class type Foo, and set it inside. I've heared about BeanFactoryPostProcessor, but on 'postProcessBeanFactory' I dont get the properties yet (too early in the lifecycle) – user3027497 Aug 03 '16 at 08:52
  • @EssexBoy I know how to get the properties, just not how to create the bean from them. thanks – user3027497 Aug 03 '16 at 08:52
  • There are different ways, java config, xml config, pre 2.0 xml config... Show what you have tried in the question. – Serge Ballesta Aug 03 '16 at 08:54
  • @SergeBallesta I'm using java config @Value("${test.property}") private Collection values; – user3027497 Aug 03 '16 at 08:59
  • Where is your *certain type*s and what are they. Should be detailed. Give some bean definitions you have – sura2k Aug 03 '16 at 09:00

0 Answers0