Search code examples
micronaut

How to change default port(8080) of micronaut to something else?


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.


Solution

  • 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.