Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我希望能够访问和更改服务器上代表设置的变量。我真的不明白创建一个类并将其存储在数据库中的原因。这个变量只有一个实例。是否有可能拥有可以读取和更改文本文件的 SettingsDAO 或者有更好的做事方式?
您可以只使用 Spring 单例 bean 并将其从上下文中删除。它将有效地充当“常数”。