SpringApplication.run main method

前端 未结 3 1232
自闭症患者
自闭症患者 2020-12-24 10:52

I created a project in Eclipse using the Spring Starter project template.

It automatically created an Application class file, and that path matches the path in the P

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-24 11:46

    One more way is to extend the application (as my application was to inherit and customize the parent). It invokes the parent and its commandlinerunner automatically.

    @SpringBootApplication
    public class ChildApplication extends ParentApplication{
        public static void main(String[] args) {
            SpringApplication.run(ChildApplication.class, args);
        }
    }
    

提交回复
热议问题