List of usage examples for java.util Properties setProperty
public synchronized Object setProperty(String key, String value)
From source file:com.iopr.PersistenceJPAConfig.java
Properties additionalProperties() { Properties properties = new Properties(); properties.setProperty("hibernate.hbm2ddl.auto", "create?drop"); properties.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQL5Dialect"); return properties; }
From source file:com.swarmcn.common.config.mybatis.MyBatisMapperScannerConfig.java
@Bean public MapperScannerConfigurer mapperScannerConfigurer() { MapperScannerConfigurer mapperScannerConfigurer = new MapperScannerConfigurer(); mapperScannerConfigurer.setSqlSessionFactoryBeanName("sqlSessionFactory"); mapperScannerConfigurer.setBasePackage("com.swarmcn.user.api.mapper"); Properties properties = new Properties(); properties.setProperty("mappers", "com.swarmcn.common.config.mybatis.MyMapper"); properties.setProperty("notEmpty", "false"); properties.setProperty("IDENTITY", "MYSQL"); mapperScannerConfigurer.setProperties(properties); return mapperScannerConfigurer; }
From source file:docs.http.gemfire.indexablesessionattributes.GemFireHttpSessionConfig.java
@Bean Properties gemfireProperties() {/* w w w . j a va 2 s . com*/ Properties gemfireProperties = new Properties(); gemfireProperties.setProperty("name", GemFireHttpSessionConfig.class.getName()); gemfireProperties.setProperty("mcast-port", "0"); gemfireProperties.setProperty("log-level", AbstractGemFireIntegrationTests.GEMFIRE_LOG_LEVEL); return gemfireProperties; }
From source file:jp.yustam.batch.SampleBatchApplication.java
@Bean protected Tasklet tasklet() { return new Tasklet() { @Override/*from w w w .ja v a 2 s. c o m*/ public RepeatStatus execute(StepContribution contribution, ChunkContext context) throws SQLException { System.out.println("Hello, world!"); System.out.println(config.getHost()); System.out.println(config.getPort()); String url = String.format("jdbc:postgresql://%s:%d/", config.getHost(), config.getPort()); Properties props = new Properties(); props.setProperty("user", "postgres"); // props.setProperty("password", "secret"); // props.setProperty("ssl", "true"); Connection conn = DriverManager.getConnection(url, props); Statement statement = conn.createStatement(); ResultSet rs = statement.executeQuery("SELECT * FROM company;"); while (rs.next()) { System.out.printf("%d %d %s\n", rs.getInt("id"), rs.getInt("code"), rs.getString("name")); } return RepeatStatus.FINISHED; } }; }
From source file:de.fhg.fokus.nubomedia.App.java
public void makeFile() { try {//from w ww. j av a 2s.co m String fileName = System.getProperty("user.home") + "/.kurento/config.properties"; log.info("saving the property file here : " + fileName); java.util.Properties p = new java.util.Properties(); p.setProperty("kms.url.provider", "de.fhg.fokus.nubomedia.kmc.KmsProvider"); File file = new File(fileName); FileOutputStream fileOut = new FileOutputStream(file); p.store(fileOut, "config.properties"); fileOut.close(); } catch (FileNotFoundException e) { System.out.println("property file could not be found!"); } catch (IOException e) { e.printStackTrace(); } }
From source file:com.anhth12.kafka.ulti.ProduceData.java
public void start() throws InterruptedException { KafkaUtils.maybeCreateTopic(host, zkPort, topic); RandomGenerator random = RandomManager.getRandom(); Properties producerProps = new Properties(); producerProps.setProperty("metadata.broker.list", "localhost:" + kafkaPort); producerProps.setProperty("serializer.class", "kafka.serializer.StringEncoder"); Producer<String, String> producer = new Producer<>(new ProducerConfig(producerProps)); try {//w w w . j ava2s . c o m for (int i = 0; i < howMany; i++) { Pair<String, String> datum = datumGenerator.generate(i, random); KeyedMessage<String, String> keyedMessage = new KeyedMessage<>(topic, datum.getFirst(), datum.getSecond()); producer.send(keyedMessage); log.debug("Sent datum {} = {}", keyedMessage.key(), keyedMessage.message()); if (intervalMsec > 0) { Thread.sleep(intervalMsec); } } } finally { producer.close(); } }
From source file:com.space.data.DomainStoreConfiguration.java
Properties additionalProperties() { Properties properties = new Properties(); properties.setProperty("hibernate.hbm2ddl.auto", "update"); properties.setProperty("hibernate.dialect", "org.hibernate.dialect.PostgreSQLDialect"); return properties; }
From source file:sample.server.GemFireServer.java
Properties gemfireProperties() { // <2> Properties gemfireProperties = new Properties(); gemfireProperties.setProperty("name", applicationName()); gemfireProperties.setProperty("mcast-port", "0"); gemfireProperties.setProperty("log-level", gemfireLogLevel()); return gemfireProperties; }
From source file:adalid.commons.properties.PropertiesHandler.java
public static Properties loadProperties(ResourceBundle bundle, boolean sortedKeys) { Properties properties = newProperties(sortedKeys); if (bundle == null) { logger.error("null properties bundle"); } else {// ww w .j a v a 2s .c o m logger.trace("loading bundle " + bundle); Set<String> keySet = bundle.keySet(); String value; for (String key : keySet) { try { value = bundle.getString(key); if (StringUtils.isBlank(value)) { continue; } properties.setProperty(key, value.trim()); } catch (MissingResourceException e) { } } printProperties(properties); } return properties; }
From source file:io.pivotal.example.java.SpringGemFireJavaBasedApplication.java
@Bean Properties gemfireProperties(@Value("${gemfire.log.level:config}") String logLevel, @Value("${gemfire.locator.host-port:localhost[10334]}") String locatorHostPort) { Properties gemfireProperties = new Properties(); gemfireProperties.setProperty("name", SpringGemFireJavaBasedApplication.class.getSimpleName()); gemfireProperties.setProperty("mcast-port", "0"); gemfireProperties.setProperty("log-level", logLevel); gemfireProperties.setProperty("locators", locatorHostPort); return gemfireProperties; }