How to configure port for a Spring Boot application?

0 votes
Hii team,

How do I configure the TCP/IP port listened on by a Spring Boot application, so it does not use the default port of 8080.
May 22 in Java by kartik
• 27,360 points

1 answer to this question.

0 votes

Hello @kartik,

You can set port in java code:

HashMap<String, Object> props = new HashMap<>();
props.put("server.port", 9999);

new SpringApplicationBuilder()

Or in application.yml:

    port: 9999

Or in


Or as a command line parameter:


Hope this works!!

answered May 22 by Niroj
• 58,920 points

Related Questions In Java

0 votes
3 answers

How to check whether a string is empty or not? Is there a function for this?

str != null && str.length() != 0 alternatively str ...READ MORE

answered Sep 11, 2018 in Java by Sushmita
• 6,890 points
0 votes
1 answer

How to configure Android SDK for finding JDK

Actual SETUP: OS: Windows 8.1 JDK file: jdk-8u11-windows-x64.exe ADT file: ...READ MORE

answered Jun 29, 2018 in Java by Rishabh
• 3,580 points
0 votes
1 answer

How to download a file from spring controllers?

@RequestMapping(value = "/files/{file_name}", method = RequestMethod.GET) public void ...READ MORE

answered Sep 4, 2018 in Java by code.reaper12
• 3,470 points
0 votes
2 answers

How to log SQL statements in Spring Boot?

HI.. try using this in your properties file: ...READ MORE

answered 3 days ago in Java by SRI

edited 3 days ago by Sirajul 570 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,358 views
0 votes
0 answers
0 votes
1 answer

How to set base url for rest in spring boot?

Hello @kartik, Set it up in your application.yml ...READ MORE

answered May 22 in Java by Niroj
• 58,920 points
0 votes
1 answer

How to determine programmatically the current active profile using Spring boot ?

Hello, It doesn't matter is your app Boot ...READ MORE

answered May 21 in Java by Niroj
• 58,920 points