I have actually set up the code in a way so as to redirect all the read requests to SLAVE & write requests to MASTER using REPLICATION DRIVER ( https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-master-slave-replication-connection.html) by using @Transactional(readOnly=true / false) annotation depending on Select (or) Insert/Delete Query in my code. It seemed to work correctly too when I checked in generic logs from SLAVE & MASTER when there are API requests hitting to my tomcat server.
But now the issue is we have a executable JAR process running in the servers & the requests from these process are being redirected to MASTER only despite having annotations specifying that they are (readOnly = true). I really dont understand why is this approach having issue for process running as a JAR. ?
I am using spring boot + MySQL-Conntector 5.1.38 version
Any idea / suggestion for this issue will be helpful. Thanks a lot in advance.