loading default properties

This commit is contained in:
Antonis Lempesis 2021-10-09 00:03:18 +00:00
parent 24a93263b0
commit 275ce34ce4
1 changed files with 17 additions and 6 deletions

View File

@ -1,13 +1,24 @@
package eu.dnetlib.repo.manager.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.annotation.PropertySources;
import org.bouncycastle.util.Arrays;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import org.springframework.context.annotation.*;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import java.io.IOException;
@Configuration
@ImportResource("classpath*:/gr/uoa/di/driver/app/springContext-commons.xml")
@PropertySource(value = "classpath*:/gr/**/springContext-*.properties", ignoreResourceNotFound = true)
@PropertySource(value = "classpath*:/eu/**/springContext-*.properties", ignoreResourceNotFound = true)
public class Config {
@Bean
public PropertySourcesPlaceholderConfigurer getPropertySourcesPlaceholderConfigurer() throws IOException {
PropertySourcesPlaceholderConfigurer ppc = new PropertySourcesPlaceholderConfigurer();
ppc.setLocations((new PathMatchingResourcePatternResolver().getResources("classpath*:/**/springContext-*.properties")));
ppc.setIgnoreResourceNotFound(true);
return ppc;
}
}