简体   繁体   中英

What's the right way to load a file in application context in spring boot?

I have an XML file (notice.xml) that I want to load into my Spring Boot Application. This file will be served to an API after some modification. I want this file to be loaded into the memory to minimize the I/O. What's the right way to load this file into memory at boot time, or just after start up?

The easiest way is, buy loading the Resource with @Value("classpath:FILENAME)

but there are tons of ways, you can try. To get a better understanding you can look here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM