[英]best way to maintain properties files in spring mvc application
在我的Spring MVC应用程序应用程序中,我们维护着许多配置文件,例如.properties
和.txt
文件。 我想读取所有配置文件并将它们保留在应用程序上下文级别,以便可以访问整个应用程序中的配置数据。
例:
db.properties
db.driveClassName=packages.DataSource db.URL=some url....
errorCodes.properties
<error-code>=<error description> ERR001=time out error occured ERR002=The request was tampered ERR003=transaction id is missing
最好的方法是使用@ConfigurationalProperties,然后它们是类型安全的,您甚至可以查看此指南来验证它们, 网址为http://www.baeldung.com/configuration-properties-in-spring-boot
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.