Reputation: 1829
I would like to set a property to a class that is not managed by Spring. The actual case is as follows: I have a regex which I want to externalize to the properties file. So far what I have tried is to create a CommandLineRunner
, and read from properties file and set the regex to whatever field I want. But I wonder if there's an out of the box way to do so.
Upvotes: 1
Views: 470
Reputation: 18173
You might do one of the following:
@PostConstruct
).static
block in your class reading from the properties file (if it is available on the classpath!).Upvotes: 4