问题
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