在配置类重写jdbcProperties方法

  1. // 数据源,必配,用的是阿里巴巴的 druid数据源,其他属性可自行查阅
  2. @Override
  3. public List<Properties> jdbcProperties() {
  4. List<Properties> list = new ArrayList<Properties>();
  5. Properties properties = new Properties();
  6. properties.put("name","dataSource");
  7. properties.put("url","jdbc:mysql://10.211.55.15:3306/mars?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8");
  8. properties.put("username","root");
  9. properties.put("password","Root123456!");
  10. properties.put("driverClassName","com.mysql.jdbc.Driver");
  11. list.add(properties);
  12. // 如果要多个数据源,add多个到list即可
  13. return list;
  14. }