@PropertySource(value={"file:conf/application.properties"},encoding = "utf-8")(代

Posted tonggc1668

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了@PropertySource(value={"file:conf/application.properties"},encoding = "utf-8")(代相关的知识,希望对你有一定的参考价值。

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.PropertySource;

@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
@PropertySource(value={"file:conf/application.properties"},encoding = "utf-8")
public class XxlJobExecutorApplication {

    public static void main(String[] args) {
        SpringApplication.run(XxlJobExecutorApplication.class, args);
    }

}

conf/application.properties

以上是关于@PropertySource(value={"file:conf/application.properties"},encoding = "utf-8")(代的主要内容,如果未能解决你的问题,请参考以下文章

Spring读取外部的资源配置文件—@PropertySource和@Value实现资源文件配置

SpringBoot(十八)@value@Import@ImportResource@PropertySource

springboot中@PropertySource(value = {"classpath:FoundBean.properties"})读取不出内容

SpringBoot加载配置文件(@PropertySource@importSource@Value)

Autofac打标签模式PropertySource和Value

Spring-boot中@ConfigurationProperties,@Value,@PropertySource