Grails3配置单独的数据库properties(二)

  • 在grails-app/conf下创建application-jdbc.properties
  1. username=root
  2. password=password
  3. driver=com.mysql.jdbc.Driver
  4. url=jdbc:mysql://localhost:3306/test?characterEncoding=UTF-8&useSSL=false
  • 然后在application.yml中添加配置
  1. spring:
  2. profiles:
  3. include:
  4. test,api,jdbc
  5. ---
  6. dataSource:
  7. pooled: true
  8. jmxExport: true
  9. driverClassName: ${driver}
  10. username: ${username}
  11. password: ${password}
  12. environments:
  13. development:
  14. dataSource:
  15. dbCreate: create-drop
  16. url: ${url}

请注意,spring.profiles.include这部分放到application.yml最前面


0
0
0

添加评论

正在回复:
取消
0
0
0
0