数据库配置如下:
spring: datasource: dynamic: primary: ds1 #设置默认的数据源或者数据源组,默认值即为master strict: false #严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源 datasource: ds1: url: jdbc:sap://192.168.0.220:30015 username: system1024 password: Gelisi2023 driver-class-name: com.sap.db.jdbc.Driver ds2: url: jdbc:mysql://156.75.217.201:3306/ellassay_erp username: root password: '!1023-uP1588opop7551=!' driver-class-name: com.mysql.cj.jdbc.Driver
对应service加上注解
@Service @DS("ds2") public class DepotSyncToErpService {
此时自动切换到ds2数据库
建议在mapper层设置
public class test { public static void main(String[] args) { &...
public class test { public static void main(String[] args) { &...
java一个类可以有多个构造方法,根据传参类型和个数来匹配执行哪个构造方法。public class Member { public Member(){  ...
java限制1个方法同一时间只能被一个线程访问public synchronized void setOrderPay(){ }加上synchronized 修饰符即可...
java stringBuffer(1).stringBuffer和stringBuilder区别stringBuffer是线程安全的,stringBuilder速度更快(2).简单的stringBuffer例子StringBuffer sBuffer = new&nb...
System.out.println("当前时间戳(秒): " + System.currentTimeMillis()/1000); System.out.println("当前时间戳(毫秒): " +&nb...