예제 #1
0
 public SpringUtils(AbstractResource conf, AbstractResource properties) {
   this.context = new XmlBeanFactory(conf);
   if (properties != null) {
     PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
     cfg.setLocation(properties);
     cfg.postProcessBeanFactory(context);
   }
 }
 @Bean
 public static PropertyPlaceholderConfigurer securityPropertyPlaceholderConfigurer() {
   PropertyPlaceholderConfigurer propertyPlaceholderConfigurer =
       new PropertyPlaceholderConfigurer();
   propertyPlaceholderConfigurer.setLocation(
       new ClassPathResource("application-security.properties"));
   propertyPlaceholderConfigurer.setIgnoreUnresolvablePlaceholders(true);
   return propertyPlaceholderConfigurer;
 }
 public void init() {
   File file = new File(CASSANDRA_CONFIG_FILE);
   try {
     InputStream input = new FileInputStream(file);
     Resource location = new InputStreamResource(input);
     super.setLocation(location);
   } catch (IOException e) {
     System.out.println("cass file:" + file.getAbsolutePath() + "\n");
     e.printStackTrace();
   }
 }
  @Override
  public void afterPropertiesSet() throws Exception {
    File properties =
        new File(
            config
                .getConfiguration(EmbeddedBrokerConfiguration.EMBEDDED_BROKER_PROPERTIES_KEY)
                .toString());
    if (!properties.isAbsolute() && !properties.isFile()) {
      // try to resolve as absolute
      properties = new File(JMSConfiguration.getConfigPathDir(), properties.getPath());
      if (!properties.isFile()) {
        // copy the defaults
        IOUtils.copy(defaults.getFile(), properties);
      }
    }
    final Resource res = new FileSystemResource(properties);
    super.setLocation(res);

    // make sure the activemq.base is set to a valuable default
    final Properties props = new Properties();
    props.setProperty("activemq.base", (String) config.getConfiguration("CLUSTER_CONFIG_DIR"));
    props.setProperty("instanceName", (String) config.getConfiguration("instanceName"));
    setProperties(props);
  }
 @Bean
 public static PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() {
   PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
   ppc.setLocation(new ClassPathResource("/persistence.properties"));
   return ppc;
 }
 @Bean
 public static PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() {
   PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
   ppc.setLocation(new ClassPathResource("/Chat-WebSocket_Backbone.properties"));
   return ppc;
 }