Home > Blockchain >  make JSON data available throughout Spring Boot application
make JSON data available throughout Spring Boot application

Time:10-12

Json data from a file is read in a spring boot application. This needs to be available through out the runtime of spring boot application across all the services once loaded. Is there any way to achieve this?

CodePudding user response:

Read it in a Service class (let's call it ConfigService) and keep it stored in memory using a private attribute. Then expose methods to get such data. So that other Services can get such data you will need to inject ConfigService on them.

  • Related