I'am confused how to set location for External Configuration,
based on https://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/reference/html/boot-features-external-config.html i do some external configuration but fail, Here is my code
package com.org.tre.myth.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
@Configuration
public class ExternalPropertyConfig {
@Bean
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
final PropertySourcesPlaceholderConfigurer properties = new PropertySourcesPlaceholderConfigurer();
Resource[] resources = new Resource[ ] {
new ClassPathResource("/myth/app/data/weblogic_configuration/config/conf.properties"), // i want this config used when i deploy it in dev
new FileSystemResource("src/main/resources/conf.properties") // i want this config used when in local test
};
properties.setLocations( resources );
properties.setIgnoreResourceNotFound(true);
properties.setIgnoreUnresolvablePlaceholders(false);
return properties;
}
}
it's always running on FileSystemResource, when i deploy, it doesn't wanna to read automatically from ClassPathResource when on dev. My config actually have same content (dev&test), the different is just at the directory because my dev do some layering and i want the configuration automatically running without even made a profile for spring.
I'am sorry
UPDATE
Im using this
Resource[] resources = new Resource[ ] {
new FileSystemResource("/myth/app/data/weblogic_configuration/config/conf.properties"),
new FileSystemResource("src/main/resources/conf.properties")
};