就像这样 application-{}.yml 在application.yml指定当前运行的环境 spring: profiles: active: dev 然后可以在不同的环境设置不同的数据库 如: