首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何为spring.datasource.url=找到“application.properties”?

如何为spring.datasource.url=找到“application.properties”?
EN

Stack Overflow用户
提问于 2022-07-04 19:44:05
回答 1查看 1.6K关注 0票数 0

我是一个发展的初学者。

如何获得application.properties?的“spring.datasource.url=”

在这里输入图像描述

application.properties

代码语言:javascript
复制
 spring.datasource.url=jdbc:mysql://localhost:3306/sms?useSSL=fals&serverTimezone=UTC&useLegacyDatetimecode=false
spring.datasource.username=root
spring.datasource.password=123123

#Hibernate
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect

#Hibernate auto ddl
spring.jpa.hibernate.ddl-auto=update

logging.level.org.hibernate.SQL=DEBUG

我的数据库在这里输入图像描述

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-07-05 07:21:33

您可以使用Properties:

封装java.util.Properties

代码语言:javascript
复制
Properties springProperties = new Properties();
springProperties.getProperty("spring.datasource.url");

学习更多=> https://www.javatpoint.com/properties-class-in-java

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72861373

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档