Did there have any way to set or put some values into org.springframework.core.env.Environment
?
We are using Spring-boot as below version.
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.1.RELEASE</version>
</parent>
Spring will load application.properties
into org.springframework.core.env.Environment
by default. We can @Autowired Environment and getString("key") to get the value.
Say we have a license file and will decoding it to load the licensing period to validate if this system is still valid or not, at the initialize()
of ApplicationContextInitializer
.
We would like to save this licensing period into Environment
for using later. For example, We will validate the licensing period again when user has sending some specified requests each time. So that, we don't have to load the license file in and decode it each time.
Or can we achieve this purpose in any others way which is more appropriately?
Any help is appreciated.