user1281598
user1281598

Reputation: 317

How can I store a "global" variable without having to persist it in Spring MVC?

I want to be able to access and change a variable on the server that represents a setting. I really don't see the reason to create a class and store it in a database. There will only be one instance of this variable. Would it be possible to have something that is a SettingsDAO that can read and alter a text file or is there a better way of doing things?

Upvotes: 1

Views: 2428

Answers (1)

smp7d
smp7d

Reputation: 5032

You can just use a Spring singleton bean and get it off the context. It will effectively act as a "constant".

Upvotes: 2

Related Questions