List of usage examples for org.springframework.beans.factory.config PropertiesFactoryBean setProperties
public void setProperties(Properties properties)
From source file:net.cloudkit.enterprises.infrastructure.configuration.ApplicationConfiguration.java
public PropertiesFactoryBean propertiesFactoryBean() { PropertiesFactoryBean propertiesFactoryBean = new PropertiesFactoryBean(); Properties properties = new Properties(); properties.put("text", 123456); propertiesFactoryBean.setProperties(properties); propertiesFactoryBean.setLocations(); propertiesFactoryBean.setFileEncoding("UTF-8"); return propertiesFactoryBean; }
From source file:info.naiv.lab.java.tool.sqlite.exporter.AppSettings.java
/** * * @return//from w ww. java 2 s. c o m */ @Bean(name = "externalProperties") public PropertiesFactoryBean propertiesFactoryBean() { Properties p = new Properties(); setPropertyIfNotBlank(p, "datasource.url", sourceUrl); setPropertyIfNotBlank(p, "datasource.schema", sourceSchema); setPropertyIfNotBlank(p, "datasource.username", sourceUsername); setPropertyIfNotBlank(p, "datasource.password", sourcePassword); setPropertyIfNotBlank(p, "jdbc.driver.directory", jdbcDriverDirectory); PropertiesFactoryBean bean = new ResolvablePropertiesFactoryBean(); bean.setIgnoreResourceNotFound(true); bean.setLocation(new FileSystemResource(propertyLocation)); bean.setProperties(p); bean.setLocalOverride(true); return bean; }
From source file:com.logsniffer.app.CoreAppConfig.java
@Bean(name = { BEAN_LOGSNIFFER_PROPS }) @Autowired//w ww .jav a 2 s .c om public PropertiesFactoryBean logSnifferProperties(final ApplicationContext ctx) throws IOException { if (ctx.getEnvironment().acceptsProfiles("!" + ContextProvider.PROFILE_NONE_QA)) { final File qaFile = File.createTempFile("logsniffer", "qa"); qaFile.delete(); final String qaHomeDir = qaFile.getPath(); logger.info("QA mode active, setting random home directory: {}", qaHomeDir); System.setProperty("logsniffer.home", qaHomeDir); } final PathMatchingResourcePatternResolver pathMatcher = new PathMatchingResourcePatternResolver(); Resource[] classPathProperties = pathMatcher.getResources("classpath*:/config/**/logsniffer-*.properties"); final Resource[] metainfProperties = pathMatcher .getResources("classpath*:/META-INF/**/logsniffer-*.properties"); final PropertiesFactoryBean p = new PropertiesFactoryBean(); for (final Resource r : metainfProperties) { classPathProperties = (Resource[]) ArrayUtils.add(classPathProperties, r); } classPathProperties = (Resource[]) ArrayUtils.add(classPathProperties, new FileSystemResource(System.getProperty("logsniffer.home") + "/" + LOGSNIFFER_PROPERTIES_FILE)); p.setLocations(classPathProperties); p.setProperties(System.getProperties()); p.setLocalOverride(true); p.setIgnoreResourceNotFound(true); return p; }