是否可以动态加载包中包含的所有属性文件?即MyClass.class.getResource('*。properties'); [英] Is it possible load all properties files contained in a package dynamically? i.e. MyClass.class.getResource('*.properties');

查看:178
本文介绍了是否可以动态加载包中包含的所有属性文件?即MyClass.class.getResource('*。properties');的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我熟悉在给定文件名的情况下获取属性文件的内容,显然MyClass.class.getResource('*。properties')不起作用,但是如何获取所有属性的列表与我班级位于同一个包裹中的文件?

I am familiar with obtaining the contents of a properties file given the name of the file, and obviously MyClass.class.getResource('*.properties') will not work, but how can I obtain a list of ALL the properties files located in the same package as my class?

推荐答案

你可以用 Spring 。请参见 4。资源,在 4.7.2应用程序上下文构造函数资源路径中的通配符

You can do these sort of things with Spring. See 4. Resources, particurlarely (or notabily ? ) (or principalementely ? ) (or mainly ? ) at 4.7.2 Wildcards in application context constructor resource paths.

这篇关于是否可以动态加载包中包含的所有属性文件?即MyClass.class.getResource('*。properties');的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆