By default, all applications that you create using Spring Boot will run on Port 8080, if you want your application to run on some other port, you need to add server.port property in the application.properties file located in the resources folder.
1. Change default 8080 Port using configuration file
- Go to src > main > resources package in your project,
- If you have a application.properties file,
server.port=<custom_port_no>
- If you have application.yml file,
server:
port: <custom_port_no> - Save the file.
- Run your Spring Boot app and it should now run on the custom port you set.

2. Change default 8080 Port using VM Argument in IDE
You can also change the default port using the VM Argument, add it to your IDE,
IntelliJ IDE- Go to Menu: Run,
- Select Edit Configurations.
- Now in VM options add -Dserver.port=<custom_port_number>
Visual Studo Code IDE:
- Open launch.json file under .vscode directory
- Add the below "vmArgs": "-Dserver.port=<custom_port_number>"

Eclipse IDE
- Right Click on your Project,
- Select Run Configurations,
- Add "-Dserver.port=<custom_port_number>" under VM Arguments
3. Change default 8080 Port while running the jar file:
When you are executing your jar file app, you can pass the option --server.port
Example:
% java -jar my/jar/path/my-boot-app.jar --server.port=8070
Have Questions? Post them here!
- Error: Can not find the tag library descriptor for
- Create a Database Table using JDBC PreparedStatement
- Java JDBC Select Multiple Records from table as List using PreparedStatement
- Java Jackson with Maven Example
- [fix] Java JDBC ConnectException: Connection refused
- Spring Boot: Transactions Management with JDBCTemplate Example
- Java Get Current Date for a Specific Time Zone
- What are the 8 Primitive Data Types in Java
- Java JDBC: Insert Java 8 LocalDate and Time using PreparedStatement
- Maven Eclipse (M2e) No archetypes currently available
- How to Sort a LinkedList in Java
- [Fatal Error] XML The markup in the document following the root element must be well-formed.
- Split a String in Java with Examples
- Struts 2 : There is no Action mapped for namespace [/] and action name [form] associated with context path [/proj]
- Truncate table using Java JDBC Example
- Java: Generate random numbers within a range
- Parse XML file in Java using DOM Parser
- How to get Client IP address using Java Code Example
- JDBCTemplate Querying Examples with Spring Boot 3
- [Java Threads] Should we extend Thread Class or implement Runnable interface
- String Boot + Redis - SET and GET String Commands Examples
- Setting up Spring Boot 3 + Maven + MySQL + JDBC Example
- Spring Boot: JdbcTemplate Update Query With Parameters Example
- Java Split String by Spaces
- Unbound classpath container: JRE System Library [JavaSE-1.7]
- Change Title text for Android Activity using java code - Android
- How to make a div tag clickable - Html
- Skip Test Maven while creating package command - Java
- Windows 10 now has a new enhanced Calculator with a new icon - News
- SharePoint Server 2016 error Microsoft Office Online Server 2016 cant be installed on the same machine as a Microsoft SharePoint Server product - SharePoint
- How to make macOS Terminal window Transparent (or Opaque) - MacOS
- Check SSH/OpenSSH version Command - Linux
- List of All Apple Silicon ARM Based M1/M2 Mac [updated Oct 2022) - MacOS