如何在Spring Boot中访问application.properties文件中定义的?
我想访问application.properties中提供的值,例如:如何在Spring Boot中访问application.properties文件中定义的?,spring,spring-boot,properties,Spring,Spring Boot,Properties,我想访问application.properties中提供的值,例如: logging.level.org.springframework.web: DEBUG logging.level.org.hibernate: ERROR logging.file=${HOME}/application.log userBucket.path=${HOME}/bucket 我想在Spring引导应用程序中访问主程序中的userBucket.path您可以使用@Value注释并访问您正在使用的任何Sp
logging.level.org.springframework.web: DEBUG
logging.level.org.hibernate: ERROR
logging.file=${HOME}/application.log
userBucket.path=${HOME}/bucket
我想在Spring引导应用程序中访问主程序中的userBucket.path您可以使用@Value注释并访问您正在使用的任何Spring bean中的属性
@Value("${userBucket.path}")
private String userBucketPath;
您可以使用@Value注释并访问正在使用的任何Springbean中的属性
@Value("${userBucket.path}")
private String userBucketPath;