在使用properties中的内容,使用@ConfigurationProperties(prefix = “jdbc”)
必须添加依赖相关坐标


org.springframework.boot
spring-boot-configuration-processor

true
springboot项目引入外界配置文件的操作
引入相关坐标依赖之后前端控制层就能获得配置为文件中的数据,
prefix = "jdbc"为前缀
jdbc.properties配置文件中的数据源为:
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://127.0.0.1:3306/springboot_test
jdbc.username=root
jdbc.password=rootspringboot项目引入外界配置文件的操作

相关文章:

  • 2021-04-21
  • 2022-12-23
  • 2022-12-23
  • 2021-07-31
  • 2022-12-23
  • 2021-05-29
  • 2021-08-31
  • 2022-12-23
猜你喜欢
  • 2021-05-17
  • 2021-10-06
  • 2021-05-31
  • 2021-11-14
  • 2021-07-03
  • 2021-05-09
  • 2023-03-28
相关资源
相似解决方案