Bonjour a tous,

J'ai un fichier properties dans mon package configuration. J'arrive à lire ce fichier et accéder à ses informations.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
public class PropertyLoader {
	private static final String PROPERTY_FILE = "C://... conf.properties";
	private static Properties properties = null;
 
	public PropertyLoader() throws FileNotFoundException {
		properties = new Properties();
		FileInputStream input = new FileInputStream(PROPERTY_FILE);
		try {
			properties.load(input);
			//this.properties = properties;
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
 
	public String getString(String key) {
		return properties.getProperty(key);
	}
}
Seulement j'accède a ce fichier depuis plusieurs packages dans mon projet et à chaque fois je fais un PropertieLoader pl = new PropertieLoader () ce qui fait que je charge le fichier plusieurs fois.
Or j'aimerai le charger une seule fois pour éviter ce chargement multiple.
Je ne sais pas si cela est possible ou comment faire.

Je vous remercie de votre aide.

aureliend8800.