Configure Spring Boot with two ports

前端 未结 4 2102
半阙折子戏
半阙折子戏 2020-11-29 08:31

I\'m trying configure an application in Spring Boot with two differents ports, but I haven\'t got still. My first aproximation has been with two controllers and I have defi

4条回答
  •  执笔经年
    2020-11-29 09:08

    To run 2 or more applications within a single project or change the default port, you can perform the action like this

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

提交回复
热议问题