How to inject a value to bean constructor using annotations

前端 未结 2 1494
夕颜
夕颜 2020-12-03 02:46

My spring bean have a constructor with an unique mandatory argument, and I managed to initialize it with the xml configuration :



        
2条回答
  •  有刺的猬
    2020-12-03 03:15

    As Bozho said, instead of constructor arg you could set the property...@PostConstruct will only get called after all the properties are set...so, you will still have your string available ...

提交回复
热议问题