[JAVA] Change the port with SpringBoot

environment

Change port

Add the following to src> main> resources> application.yml.

application.yml


server:
  port : 8081

Run and verify that it has changed from the default port 8080.

$ curl http://localhost:8080/
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:03 --:--:--     0
curl: (7) Failed to connect to localhost port 8080: Connection refused

$ curl http://localhost:8081/
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    13  100    13    0     0    149      0 --:--:-- --:--:-- --:--:--   149
Hello World!

For application.properties

In the case of src> main> resources> application.properties, write as follows.

application.properties


server.port=8081

Recommended Posts

Change the port with SpringBoot
Change the layout when rotating with onConfigurationChanged
Overwrite the contents of config with Spring-boot + JUnit5
http: // localhost: How to change the port number
Change SSH port number
Supports multi-port with SpringBoot
How to change the action with multiple submit buttons
[Java] Change the process according to the situation with the Strategy pattern
Change the injection target for each environment with Spring Boot 2
Change Wordpress siteurl with command
Mock the constructor with PowerMock
How to change the setting value of Springboot Hikari CP
Change the setting value for each environment with Digdag (RubyOnRails)
If it doesn't change with the disable_with option in Safari
With the error Cordova-> Looper.prepare ()
Hello World with SpringBoot / Gradle
Monitor the clipboard with JNA
UnitTest with SpringBoot + JUnit + Mockito
How to change the file name with Xcode (Refactor Rename)
[Rails] How to introduce kaminari with Slim and change the design
Try Hello World with the minimum configuration of Heroku Java spring-boot
Draw screen with Thymeleaf in SpringBoot
Implement text link with Springboot + Thymeleaf
[Swift] Change the textColor of UIDatePicker
The basics of SpringBoot + MyBatis + MySQL
Introducing Flyway with SpringBoot + Maven + PostgreSQL
Automatically scroll the background with libGDX
Programming with ruby (on the way)
About creating an application with springboot
Follow the link with Selenium (Java)
Place in the middle with css
Follow the Datomic tutorial with Datascript
The guy who tries-with-resources with kotlin
Image processing: Let's play with the image
Change the deployment level of API documents with Gradle Swagger Generator Plugin
[swift5] How to change the color of TabBar or the color of item of TabBar with code