@ConfigurationProperties(spring-boot依赖下)、@Value(spring-beans依赖下)、@PropertySource(spring-context依赖下)

@ConfigurationProperties、@Value、@PropertySource

@ConfigurationProperties的使用

get和set方法必须要写

@ConfigurationProperties、@Value、@PropertySource

@ConfigurationProperties、@Value、@PropertySource

测试

@ConfigurationProperties、@Value、@PropertySource

@ConfigurationProperties、@Value、@PropertySource

@Value的使用

不需要写get和set方法

@ConfigurationProperties、@Value、@PropertySource

@ConfigurationProperties、@Value、@PropertySource

@PropertySource的使用 

@PropertySouce用于引用自定义的.properties属性文件

可以结合@ConfigurationProperties使用,同样需要写get和set方法

@ConfigurationProperties、@Value、@PropertySource

@ConfigurationProperties、@Value、@PropertySource

@ConfigurationProperties、@Value、@PropertySource

@ConfigurationProperties、@Value、@PropertySource

@ConfigurationProperties、@Value、@PropertySource

也可以结合@Value使用,同样不需要写get和set方法

@ConfigurationProperties、@Value、@PropertySource

@ConfigurationProperties、@Value、@PropertySource

 

相关文章:

  • 2021-10-07
  • 2022-12-23
  • 2022-02-10
  • 2021-11-02
  • 2021-12-14
  • 2022-12-23
  • 2021-07-08
  • 2022-01-10
猜你喜欢
  • 2022-12-23
  • 2021-12-23
  • 2021-04-10
  • 2021-07-25
  • 2021-05-21
  • 2021-10-05
  • 2022-12-23
相关资源
相似解决方案