Search code examples
spring-bootintellij-ideavaadin

Stop 'run spring-boot' in Intellij from opening browser window


I have recently installed a fresh version of Vaadin from their website.

As I use the maven command 'Run spring boot' it automatically opens a new browser window.

This is nice the first time, but when you are testing, you end up with 30 windows. It's annoying.

How can you fix that?


Solution

  • You need to remove LaunchUtil.launchBrowserInDevelopmentMode to disable the automatic opening of a browser tab.

    That is, assuming you have something like the following for your SpringBootServletInitializer class.

    public class Application extends SpringBootServletInitializer {
    
        public static void main(String[] args) {
            LaunchUtil.launchBrowserInDevelopmentMode(SpringApplication.run(Application.class, args));
        }
    
    }
    

    You need to change it to look like the following:

    public class Application extends SpringBootServletInitializer {
    
        public static void main(String[] args) {
            SpringApplication.run(Application.class, args);
        }
    
    }