0
我的應用程序有兩種運行模式:SHORT,LONG。 每種模式都有不同的源文件夾,它在配置文件中定義。 假設用戶將在運行時選擇模式,我如何設置所選的文件夾?Spring通過enum來選擇bean配置屬性
public enum Mode {
SHORT,
LONG
}
config.properties:
short.dir = short_test
full.dir = full_test
@Configuration
@PropertySource({"classpath:config/config.properties"})
public class runJob {
@Value("${default.dir}")
private String folder;
}
感謝,肺門