0

this is asked in a technical interview

suppose there are three version of a class and they are configured as three beans, but which one is to be loaded/injected has to be decided at runtime. Is this can be done using callBack method/Interfaces like BeanNameAware etc?

lowLatency
  • 5,534
  • 12
  • 44
  • 70
  • what do you mean by `loaded/injected`? Do you mean `instatiation` or `inject new bean definition`. If you mean dynamic bean definition change in runtime a suppose you can look at `AbstractRefreshableApplicationContext` interface. Doc says that it can be used for that. – VB_ Jan 18 '14 at 14:19
  • isn't it http://stackoverflow.com/questions/534030/reloading-refreshing-spring-configuration-file-without-restarting-the-servlet-co the same? – VB_ Jan 18 '14 at 14:29
  • Thanks for the link and showing the initial path , i will look into AbstractRefreshableApplicationContext – lowLatency Jan 18 '14 at 14:32
  • MyClass myClass = applicationContext.getBean("myClass"); – MariuszS Jan 18 '14 at 14:33

0 Answers0