Java Spring@Value仅使用默认值

Java Spring@Value仅使用默认值,java,spring,Java,Spring,我正在使用@value向变量注入一个值。出于某种原因,当我有默认值时,它只使用它,而不在属性文件中查找它。当我不使用默认值时,它会从属性文件中注入值。没有更改其他配置 @Value("${migration.paths:#{'classpath:db/migration'}}") private String dbMigrationPaths; (我在默认值中使用SPEL,因为它有斜杠) 属性文件配置: @Bean public static PropertySourcesPlacehol

我正在使用
@value
向变量注入一个值。出于某种原因,当我有默认值时,它只使用它,而不在属性文件中查找它。当我不使用默认值时,它会从属性文件中注入值。没有更改其他配置

@Value("${migration.paths:#{'classpath:db/migration'}}")
private String dbMigrationPaths;
(我在默认值中使用SPEL,因为它有斜杠)

属性文件配置:

 @Bean
 public static PropertySourcesPlaceholderConfigurer configDataSourcesPropertyFile() {
        PropertySourcesPlaceholderConfigurer bean = new PropertySourcesPlaceholderConfigurer();
        bean.setLocations(new ClassPathResource[]{
                new ClassPathResource("/file1"),
                new ClassPathResource("/file2")
        });
        bean.setIgnoreUnresolvablePlaceholders(true);
        bean.setIgnoreResourceNotFound(true);
        return bean;
    }

这两个文件都是属性文件,并且所涉及的属性位于
file1
中,而不位于
file2

项目中是否有两个属性占位符?如果是,您可能会遇到以下记录的错误:。请参见结尾处的建议解决方法链接。

请查看,这似乎是一个类似的问题。