SpringBoot注解之@PropertySource与@PropertySources

    技术2023-07-12  89

    一不注意就自动补全出错,还找不到为啥错。 本来我想用@PropertySource的但是给我贱手,没看清就补全成@PropertySources,然后就蒙蔽了,所以就看一下有什么区别吧。 都可以加载多个配置文件,但是@PropertySources可以添加约束。

    @PropertySource(value = {"classpath:person.properties","classpath:dog.properties"}) @PropertySources({@PropertySource(value = "classpath:/config/load.properties",ignoreResourceNotFound = true,encoding = "UTF-8"), @PropertySource(value = "classpath:/config/load.properties",ignoreResourceNotFound = true,encoding = "UTF-8")})
    Processed: 0.009, SQL: 9