@Bean public static PropertySourcesPlaceholderConfigurer prodPropertiesPlaceholderConfigurer() { PropertySourcesPlaceholderConfigurer p = new PropertySourcesPlaceholderConfigurer(); Resource[] resourceLocations = new Resource[] {new ClassPathResource(DATABASE_PROPERTIES_FILE)}; p.setLocations(resourceLocations); return p; }
@Bean public PropertySourcesPlaceholderConfigurer myPropertySourcesPlaceholderConfigurer() { PropertySourcesPlaceholderConfigurer p = new PropertySourcesPlaceholderConfigurer(); Resource[] resourceLocations = new Resource[] { new ClassPathResource("system.properties"), new ClassPathResource("my.properties"), }; p.setLocations(resourceLocations); return p; }
@Bean public static PropertySourcesPlaceholderConfigurer properties() { PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer(); Resource[] resources = new FileSystemResource[] { new FileSystemResource("src/main/app-dirs/x509annotationdir/conf/etomcat.properties") }; pspc.setLocations(resources); // pspc.setIgnoreUnresolvablePlaceholders(true); return pspc; }
@Bean public static PropertySourcesPlaceholderConfigurer properties() { PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer(); Resource[] resources = new FileSystemResource[] { new FileSystemResource(System.getProperty("user.home") + "/molgenis-server.properties") }; pspc.setLocations(resources); pspc.setIgnoreUnresolvablePlaceholders(true); pspc.setIgnoreResourceNotFound(true); return pspc; }
@Bean public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() { String propertyFilePath = Constants.CONFIG_PATH + File.separator + "config" + File.separator + "scoremaker.properties"; File f = new File(propertyFilePath); if (!f.exists()) { propertyFilePath = "config" + File.separator + "scoremaker.properties"; } PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer(); org.springframework.core.io.Resource[] properties = new FileSystemResource[] {new FileSystemResource(propertyFilePath)}; propertySourcesPlaceholderConfigurer.setLocations(properties); return propertySourcesPlaceholderConfigurer; }
/** * Necessary to make the @Value annotations work. for @Value When use @DependsOn must use small * letter like "AppSetup" of a AppSetup.class bean name. relative reference - * http://stackoverflow.com/questions/5314513/standard-naming-to-the-spring-beans * * @return */ @Bean @DependsOn("appSetup") // !! bean name convention is important for depends-on public static PropertySourcesPlaceholderConfigurer propertyPlaceholderConfigurer() { PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer(); Resource[] locations = null; locations = new Resource[] { // new PathResource(Files.exists(AppSetup.configPath.resolve("redis.properties")) == true // ? // AppSetup.configPath.resolve("redis.properties") : // AppSetup.configPath.resolve("redis.properties.default")), new PathResource( Files.exists(AppSetup.configPath.resolve("mysql.properties")) == true ? AppSetup.configPath.resolve("mysql.properties") : AppSetup.configPath.resolve("mysql.properties.default")), new PathResource( Files.exists(AppSetup.configPath.resolve("gcrawler.properties")) == true ? AppSetup.configPath.resolve("gcrawler.properties") : AppSetup.configPath.resolve("gcrawler.properties.default")), }; configurer.setLocations(locations); return configurer; }