How to declare and use global variables?

丶灬走出姿态 提交于 2019-12-12 06:25:45

问题


i have a console application.i want to read some configuration settings from DB. And these settings should be stored in a global or session variable so i can use the variable through out the application , how can i implement it ? what are the ways ? which channels do i need to use ? and how payload should be stored?


回答1:


It's not at all clear what you mean, but you can declare a Map object as a @Bean (or <bean/>) and load it up during initialization.

You can then reference it directly in your components by @Autowired or via SpEL in expressions in integration components: @mapBean['foo'].



来源:https://stackoverflow.com/questions/40122805/how-to-declare-and-use-global-variables

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!