在使用@Value注解的时候要注意以下几点: 1,要使用在被@Component修饰的类中 还有就是在启动类上被@ComponentScan(basePackages = { "xxxx.xxxx.xxx.xx" })扫描到 2,被@Configuration修饰的配置类中 3,不能作用于静态变量(static); 4,不能作用于常量(final);