angular mysql spring spring-boot

Remote Spring boot app still connect to my local mysql

I work with Angular 4, Spring boot and Mysql. In local, all works fine. I try to deployed on a remote server, a Centos 7. All works fine except that when I access to my website, it takes data from my local database, and not from the mysql database which is located on the remote server.

I tried on another computer and the result is the same, it takes data from local computer !

Here is my Spring boot’s file:

server.port = 8081

netstat -tln on the remote server (Only usefull fields):

Proto Recv-Q Send-Q local address           remote address          State       
tcp 0 0* LISTEN
tcp6 0 0 :::8081 :::* LISTEN

Mysql databases have exactly the same structure, and the same username/password.


Thanks for suggestions, I finnally solved this problem. It came from the connection between Angular and Spring, and not from Spring and Mysql.

A Springboot instance was running on my local computer, and the remote Angular was connected to it. In Angular’s config file, I replaced apiUrl=localhost:8081 by apiUrl=<my remote IP>:8081, deploy again, I opened the port 8081 (port of Springboot) to everyone and now it works well.

But to be honest, I don’t like this method because my Springboot app is accessible by everyone, whereas it need to be accessible only by the Angular app. If someone have a solution, this question is still open. Thanks