How to declare and use global variables?

2019-09-07 07:29发布

问题:

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'].