Reputation: 111
I have created a REST API example in Eclipse using Spring Boot.
When I access API using http://localhost:8080/getInfo
then it works, but if I am accessing the same API from external client using IP address http://<IP address>:8080/getInfo
then it gives error - Failed to connect to
How to access API using IP address OR Domain Name?
Upvotes: 4
Views: 2302
Reputation: 1225
If you want to specify different server address other than localhost or any other server configuration like port, error controller or timeout settings, you can do it using server default properties in application.properties. Spring will automatically load embedded tomcat configurations from the application.properties file. For different server address use.
server.address= # Network address to which the server should bind.
In you application.properties.
For other server configurations, have a look at : Spring Common Properties
Upvotes: 1