Correciones 15-10-2026
This commit is contained in:
@@ -1,22 +1,31 @@
|
||||
package org.palomafp.aadd.jaec.config;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
public class Configuracion {
|
||||
|
||||
private static final String RUTA_FICHERO_CONFIGURACION = "application.properties";
|
||||
private static final Properties PROPIEDADES = new Properties();
|
||||
|
||||
// Constructor privado: de esta manera conseguimos que esta clase no se pueda
|
||||
// instanciar
|
||||
private Configuracion() {
|
||||
}
|
||||
|
||||
// Cargamos el fichero de configuracion
|
||||
static {
|
||||
try (InputStream input = new FileInputStream("config/application.properties")) {
|
||||
try (InputStream input = Configuracion.class.getClassLoader().getResourceAsStream(RUTA_FICHERO_CONFIGURACION)) {
|
||||
|
||||
if (input == null) {
|
||||
throw new IOException("No se encuentra " + RUTA_FICHERO_CONFIGURACION + " en el classpath");
|
||||
}
|
||||
|
||||
PROPIEDADES.load(input);
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("No se pudo cargar config/application.properties", e);
|
||||
throw new RuntimeException("No se pudo cargar el fichero de configuración", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user