Primero
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package aadd.palomafp.anp.conexion;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
|
||||
public class ConfigConexion {
|
||||
|
||||
private static final String RUTA_CONFIG = "ficheros/config.properties";
|
||||
private static final Properties PROPS = new Properties();
|
||||
|
||||
static {
|
||||
try (FileInputStream fis = new FileInputStream(RUTA_CONFIG)) {
|
||||
PROPS.load(fis);
|
||||
} catch (IOException e) {
|
||||
throw new IllegalStateException("No se pudo leer" + RUTA_CONFIG, e);
|
||||
}
|
||||
}
|
||||
|
||||
private ConfigConexion() {}
|
||||
public static String get(String clave) {
|
||||
String valor = PROPS.getProperty(clave);
|
||||
if (valor == null) {
|
||||
System.out.println("Falta la propiedad: " + clave);
|
||||
}
|
||||
|
||||
return valor;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user