how to change spring boot port number

how to change spring boot port number

Hi,

I have a web application developed in Spring boot which is running on port number 8080. I have to change the port number of the application to say 8084. How I can change the spring boot web application?

Do I need to install the application in separate tomcat server running on port number 8084?

Provide me easy steps to do the same.

Thanks

View Answers

October 2, 2020 at 12:20 PM

HI,

By default Spring Boot application runs on the embedded tomcat server and comes with the default configuration. By default spring boot web application runs on 8080 port.

The easiest way is to change the default configuration and update it to instruct Spring boot to run application on some other port say 8084.

If you are using application.properties in your application then add the following configuration:

server.port=8084

If you are using application.yml file in your project then add following in the application.xml file:

server:
  port : 8084

Above change will instruct Spring Boot to run the web application on port number 8084. This way you can change spring boot default port 8080 to new port 8084.

Hope this helps you.

Thanks


October 2, 2020 at 12:24 PM

HI,

You can also change the configuration grammatically. Here is simple example of configuration:

@SpringBootApplication
public class MyWebApplication {
    public static void main(String[] args) {
        SpringApplication app = new SpringApplication(MyWebApplication.class);
        app.setDefaultProperties(Collections
          .singletonMap("server.port", "8084"));
        app.run(args);
    }
}

Above example will instruct the application to run on 8084 port.

Thanks


October 2, 2020 at 12:26 PM

Hi,

You will find more tutorials at:

Thanks


October 15, 2020 at 8:02 AM

Hi

There are options to change the port number of tomcat from command line also. While running the jar file with java -jar command you can provide configuration to run Spring web application on other port also.

Here is example command:

java -jar myapp.jar --server.port=8083

or

java -jar -Dserver.port=8083 myapp.jar

Hope this helps you.

Thanks









Related Tutorials/Questions & Answers:
how to change spring boot port number
how to change spring boot port number  Hi, I have a web application developed in Spring boot which is running on port number 8080. I have to change the port number of the application to say 8084. How I can change the spring boot
MySQL default port number and how to change it
MySQL default port number and how to change it What is default port number... of MySQL server and how to change it?" The MySQL default port number... the port number in your program. You can also change the port number of MySQL
Advertisements
How to change MySQL default port Windows?
How to change MySQL default port Windows?  Hi, I am learning JDBC... of MySQL. How to change MySQL default port Windows? Thanks   Hi... tutorials of MySQL Server: MySQL Tutorials MySQL default port number and how
How to change MySQL default port Windows?
How to change MySQL default port Windows?  Hi, I am learning JDBC... of MySQL. How to change MySQL default port Windows? Thanks   Hi... tutorials of MySQL Server: MySQL Tutorials MySQL default port number and how
How to change default MySQL port in linux?
How to change default MySQL port in linux?  I have a sever and due to some reasons I want to run the MySQL server on the different port and not on the detault port 3306. How to change the MySQL default port on my Linux box
Changing MySQL Port Number
Changing MySQL Port Number  How to change the MySQL port... installation directory. Change the port number to desired port number. By default port... to the desired port number. After making change in my.ini file save the file
port number - JavaMail
port number  i want james2.1.3 port number like microsoft telnet>open local host _______(some port number) i wnat that port number
MySQL default port number in Linux
MySQL default port number and how to change it MySQL Tutorial JDBC...MySQL default port number in Linux - How to find the default port number... is for you. In this tutorial you learn "How to find the default port number
MySQL Default Port number
MySQL Default Port number  HI, What is MySQL Default Port number? Thanks   Hello, MySQL Server Default Port number is 3306. Thanks
mapr drill port number
mapr drill port number  Hi, What is the port number in Mapr for accessing Apache drill? I want to know all the mapr drill port numbers. Thanks   Hi, Here is the list of all the port of drill in mapr: Port Type
mapr drill port number
mapr drill port number  Hi, What is the port number in Mapr for accessing Apache drill? I want to know all the mapr drill port numbers. Thanks   Hi, Here is the list of all the port of drill in mapr: Port Type
mysql port number other than 3306
mysql port number other than 3306  Hi, Can I change MySQL port number? What can be mysql port number other than 3306? Thanks
what is redis default port number
in Python to connect to redis server and add/update data. I want to know the port number on which redis is running. Please help me in finding the default port number of redis. what is redis default port number? Thanks   Hi, Redis
Change port from 8080 to 80 in Apache tomcat - WebSevices
Change port from 8080 to 80 in Apache tomcat  Hi, Could you please tel me how to Change Apache Tomcat port 8080 to 80. Right now its running on port 8080. i want to change the port to 80. Please tel me how to change the port
Low port Scanner
Low port Scanner       In this section, you will learn how to get local port number... the massage on the command line very low port information. The java.net package
How long will it take to learn Spring boot
to learn it quickly. How long will it take to learn Spring boot? How much time...How long will it take to learn Spring boot  Hi, These days most of the Java enterprise project is shifting to the Spring Boot. This skill
How long will it take to learn Spring boot
to learn it quickly. How long will it take to learn Spring boot? How much time...How long will it take to learn Spring boot  Hi, These days most of the Java enterprise project is shifting to the Spring Boot. This skill
Simple Spring Boot Example
: How to import existing maven project in Eclipse? Step 2: Add Spring Boot...Simple Spring Boot Example - First example of Spring Boot for counting no of beans Spring Boot Simple Example, writing and running the first example code
Simple Spring Boot Example
Simple Spring Boot Example - First example of Spring Boot for counting no of beans Spring Boot Simple Example, writing and running the first example code in Spring boot to understand the steps of running spring boot project
How to change background, change background
How to change background       This example will teach you to change background of any object... a picture to change background.ADS_TO_REPLACE_1 Selection: Make selection
How to change the face, change the face
How to change the face       You have a chance to learn how to change the face of the person to another face. It has very simple technique to make this effect
spring boot 2.2.0 maven dependency
spring boot 2.2.0 maven dependency  Hi, I have spring boot old application and now I want to upgrade it to new version of Spring boot. For this I have to change version entry in pom.xml file. How to upgrade it to latest version
how to change color of titlebar in java
how to change color of titlebar in java  pls help
How to format number in Java?
How to format number in Java?  Hi, What is the best way to format a number in Java? How to format number in Java? Thanks   Hi, To format number in Java you can use the class java.text.NumberFormat. Here is simple
How to change functionlatiy in web page
How to change functionlatiy in web page  i need to change functionality of my web page..i came to know that by using collections it is possible..but i dont know how to use it...is any other way to change functionality of my web
How to change password mask field?
How to change password mask field?  I want to use '*' character in password. thanks in advanced............   password masking character in the standard password field can't be changed
how to generate bank account number?
how to generate bank account number?  how to generate account number?or format or rules for bank account number
How to get xml file form http port using web service
How to get xml file form http port using web service  hi I am suresh i am using netbeans 6.9 to develop a web service for getting xml from http port... struck with getting xml file. How to access xml file in web service? Please Help
How to change the checkbox value dynamically.
How to change the checkbox value dynamically.  Hi, I am using struts 1.2 checkbox tag. Requirement is on page load the value must be "true"(checked). And after loading the page i am uncheking the check box and again loading
How to change object item to integer item
How to change object item to integer item  How to change objectitem to integer item?thankyou
Is spring boot easy to learn
Is spring boot easy to learn  Hi, I am a software developer... company and they have told me to work learn Spring/Spring Boot. From Next month I have to work on Spring and Spring boot project. So, I have only 1 month time
Is spring boot easy to learn
Is spring boot easy to learn  Hi, I am a software developer... company and they have told me to work learn Spring/Spring Boot. From Next month I have to work on Spring and Spring boot project. So, I have only 1 month time
hibernate.archive.autodetection spring boot
hibernate.archive.autodetection spring boot  Hi, How to use hibernate.archive.autodetection option in spring boot? Thanks   Hi...   Hi, Do you want to learn Spring Boot for your next project? Check
How to make auto number? - JSP-Servlet
How to make auto number?  Dear, my friend... I really need your help.... I want to ask you, how to make auto number in mysql database... number 08 = month (august) 09 = year If system of date change
How to change the data in the table dynamically ?
How to change the data in the table dynamically ?  This is my code. I... datastore = DatastoreServiceFactory.getDatastoreService(); Query q = new Query...;Entity> employees = datastore.prepare(q).asList(FetchOptions.Builder.withLimit(100
How create auto number? - JSP-Servlet
How create auto number?  Dear, my friend... I really need your help.... I want to ask you, how to make auto number in mysql database... number 08 = month (august) 09 = year If system of date change to be next
spring boot 2.2.6 dependencies
spring boot 2.2.6 dependencies  Hello, Spring boot 2.2.6 is released and now I want to upgrade my project to this version of spring boot. What are the new features that comes with Spring Boot 2.2.6? Thanks
Spring Boot 2.7.0 Released
for seamless application development. The Major change in the Spring Boot 2.7.0... will be supported by Spring Boot 3.0, which is a major change. Related Tutorials...Spring Boot 2.7.0 Released - Check Spring Boot 2.7.0 new features and updates
Spring Boot 2.7.0 Released
for seamless application development. The Major change in the Spring Boot 2.7.0... will be supported by Spring Boot 3.0, which is a major change. Related TutorialsADS...Spring Boot 2.7.0 Released - Check Spring Boot 2.7.0 new features and updates
spring boot 2.3.1 dependencies
spring boot 2.3.1 dependencies  Hi, There is latest release of Spring boot 2.3.1 and I want to use the same in my project. What is the spring boot 2.3.1 dependencies? I want to try Spring boot 2.3.1 so I need the maven
how to change file from .txt to .mat(matrix)
how to change file from .txt to .mat(matrix)  i have a big file.txt and i want to change this file to file.mat(matrix) ...this is in windows not on any os ..thx if u answering quickly please
spring boot webflux dependency
spring boot webflux dependency  Hi, I want to use the webflux in spring boot application. What is the code for adding in pom.xml file? I need pom.xml code for spring boot webflux dependency. Thanks   HI, You can use
org.springframework.boot - spring-boot-starters version 1.4.0.RELEASE Maven dependency. How to use spring-boot-starters version 1.4.0.RELEASE in pom.xml?
1.4.0.RELEASE of spring-boot-starters in pom.xml? How to use spring-boot-starters...org.springframework.boot  - Version 1.4.0.RELEASE of spring-boot-starters... 1.4.0.RELEASE of spring-boot-starters in project by the help of adding the dependency
org.springframework.boot - spring-boot-starters version 1.5.21.RELEASE Maven dependency. How to use spring-boot-starters version 1.5.21.RELEASE in pom.xml?
1.5.21.RELEASE of spring-boot-starters in pom.xml? How to use spring-boot...org.springframework.boot  - Version 1.5.21.RELEASE of spring-boot... 1.5.21.RELEASE of spring-boot-starters in project by the help of adding the dependency
org.springframework.boot - spring-boot-test version 1.5.6.RELEASE Maven dependency. How to use spring-boot-test version 1.5.6.RELEASE in pom.xml?
1.5.6.RELEASE of spring-boot-test in pom.xml? How to use spring-boot-test version... Gradle  dependency? How to use  org.springframework.boot - spring-boot-test...org.springframework.boot  - Version 1.5.6.RELEASE of spring-boot-test
org.springframework.boot - spring-boot-test version 1.5.6.RELEASE Maven dependency. How to use spring-boot-test version 1.5.6.RELEASE in pom.xml?
1.5.6.RELEASE of spring-boot-test in pom.xml? How to use spring-boot-test version... Gradle  dependency? How to use  org.springframework.boot - spring-boot-test...org.springframework.boot  - Version 1.5.6.RELEASE of spring-boot-test
org.springframework.boot - spring-boot-devtools version 2.0.3.RELEASE Maven dependency. How to use spring-boot-devtools version 2.0.3.RELEASE in pom.xml?
2.0.3.RELEASE of spring-boot-devtools in pom.xml? How to use spring-boot-devtools...org.springframework.boot  - Version 2.0.3.RELEASE of spring-boot-devtools... 2.0.3.RELEASE of spring-boot-devtools in project by the help of adding the dependency
org.springframework.boot - spring-boot-starter version 1.0.0.RELEASE Maven dependency. How to use spring-boot-starter version 1.0.0.RELEASE in pom.xml?
1.0.0.RELEASE of spring-boot-starter in pom.xml? How to use spring-boot-starter...org.springframework.boot  - Version 1.0.0.RELEASE of spring-boot-starter... of spring-boot-starter in project by the help of adding the dependency
org.springframework.boot - spring-boot-devtools version 1.5.16.RELEASE Maven dependency. How to use spring-boot-devtools version 1.5.16.RELEASE in pom.xml?
1.5.16.RELEASE of spring-boot-devtools in pom.xml? How to use spring-boot...org.springframework.boot  - Version 1.5.16.RELEASE of spring-boot... 1.5.16.RELEASE of spring-boot-devtools in project by the help of adding the dependency
org.springframework.boot - spring-boot-autoconfigure version 2.1.3.RELEASE Maven dependency. How to use spring-boot-autoconfigure version 2.1.3.RELEASE in pom.xml?
; - Version 2.1.3.RELEASE of spring-boot-autoconfigure in pom.xml? How to use spring-boot...? How to use  org.springframework.boot - spring-boot-autoconfigure version...org.springframework.boot  - Version 2.1.3.RELEASE of spring-boot

Ads