
我最终使用apache commons配置:
pom.xml:
<dependency> <groupId>commons-configuration</groupId> <artifactId>commons-configuration</artifactId> <version>1.6</version> </dependency>
src /…/ PropertiesLoader.java
PropertiesConfiguration config = new PropertiesConfiguration();config.load(PROPERTIES_FILENAME);config.getInt("someKey");/src/main/resources/application.properties
someKey: 2
我不想将我的库变成Spring应用程序(我想要
@Value注释,但没有应用程序上下文+
@Component,多余的bean,多余的Spring生态系统/包,这在我的项目中没有意义)。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)