ssh-keyscan -H remote-host-domain-or-ip >> ~/.ssh/known_hosts
Archive for March, 2018
add a remote host to ~/.ssh/know_hosts
Posted in Linux/Unix on March 15, 2018| Leave a Comment »
pass parameters from configuration file to java ee application
Posted in JAVA/J2EE on March 7, 2018| Leave a Comment »
public class MyConfig {
public static Properties appProperties() throws IOException {
//method 1: in application configuration, the configuration file my-config.properties is in src/main/resources
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
InputStream inStream = classLoader.getResourceAsStream(“ngs16s-config.properties”);
Properties properties = new Properties();
properties.load(inStream);
//method 2: in container configuration, the configuration file my-config.properties is in $WILDFLY_HOME/standalone/configuration
//https://stackoverflow.com/questions/27953261/wildfly-reading-properties-from-configuration-directory
String fileName = System.getProperty(“jboss.server.config.dir”) + “/my-config.properties”;
Properties properties = new Properties();
FileInputStream fis = new FileInputStream(fileName);
properties.load(fis);
}
}
my-config.properties file has key-value pairs separated by tab, such as
my_property_name my_property_value
How to use it:
String myProperty = MyConfig.appProperties().getProperty(“my_property_name”)