Я действительно новичок в Spring и Maven, и я хотел создать среду, специфичную для среды. Основная идея состояла в том, чтобы создавать профили в maven, а в профиле заданы некоторые переменные, чтобы помочь загрузить правильный файл свойств.Не удалось разрешить placeholder
Вот один мой профиль в мавена:
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<env>dev</env>
</properties>
</profile>
А вот мой FTPProperties класс:
@Configuration
@PropertySource("classpath:/properties/ftp-${env}.properties")
public class FTPProperties {
@Autowired
private Environment environment;
private String server;
public FTPProperties() {
}
@PostConstruct
private void init(){
this.server = environment.getProperty("ftp.server");
}
public String getServer() {
return server;
}
}
Когда я пытаюсь построить его, я получаю следующее исключение:
java.lang.IllegalArgumentException: Could not resolve placeholder 'env' in string value "classpath:/properties/ftp-${env}.properties"
Любая помощь с благодарностью.