Files
dev-toolbox/src/main/resources/application.yml
T
promise_cyf 9c04f81f2d build: 添加 Maven 项目配置并忽略 IDE 目录。
集成聚合数据的 每日天气、每日一句功能
2026-10-09 15:58:45 +08:00

67 lines
1.8 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
server:
port: 8077
spring:
application:
name: dev-toolbox
# 默认使用 H2 内存库,本地无需任何外部依赖即可启动
datasource:
driver-class-name: org.h2.Driver
url: jdbc:h2:mem:dev_toolbox;MODE=MySQL;DB_CLOSE_DELAY=-1;DATABASE_TO_LOWER=TRUE
username: sa
password: ""
h2:
console:
enabled: true
path: /h2-console
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
mybatis-plus:
configuration:
map-underscore-to-camel-case: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
global-config:
banner: false
db-config:
id-type: auto
# 聚合数据(每个接口使用各自的 key)
# 天气文档:https://www.juhe.cn/docs/api/id/73
# 每日一句文档:https://www.juhe.cn/docs/api/id/86
juhe:
connect-timeout: 3s
read-timeout: 5s
# 天气查询
weather:
base-url: https://apis.juhe.cn/simpleWeather/query
# 建议改用环境变量 JUHE_WEATHER_KEY 覆盖,避免明文提交到仓库
key: ${JUHE_WEATHER_KEY:ca38eda68ea7242a3601e4e98afa8499}
# 查询未来天气天数(1~7),不填写则只返回实时天气
future-num: 5
# 每日一句
soup:
base-url: https://apis.juhe.cn/fapig/soup/query
# 每日一句接口的 key,请填入并建议用环境变量 JUHE_SOUP_KEY 覆盖
key: ${JUHE_SOUP_KEY:cf8695f97027c22b346a468697ba11db}
---
# 切换为 MySQL 时使用该 profile:mvn spring-boot:run -Dspring-boot.run.profiles=mysql
spring:
config:
activate:
on-profile: mysql
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/dev_toolbox?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true
username: root
password: root
logging:
level:
com.cyf.devToolBox: debug