27

How to change default port 8080 in Micronaut to something else? I use Micronaut for my project, and I cannot find the configuration for changing the port number.

Szymon Stepniak
  • 40,216
  • 10
  • 104
  • 131
RAJKUMAR NAGARETHINAM
  • 1,408
  • 1
  • 15
  • 26

1 Answers1

41

You can specify a custom server port in src/main/resources/application.yml file, for instance:

micronaut:
  server:
    port: 8081

Alternatively, you can set up an environment variable MICRONAUT_SERVER_PORT.

For more information, check the official documentation page for running on a specific port.

Philippe Fanaro
  • 6,148
  • 6
  • 38
  • 76
Szymon Stepniak
  • 40,216
  • 10
  • 104
  • 131