覆盖SpringBoot类

时间:2018-01-18 15:38:18

标签: java spring spring-mvc spring-boot

我有一个SpringBoot应用程序及其类:

Import({SecurityConfig.class})
public class TdkApplication  implements CommandLineRunner {
...
}

我想扩展以覆盖方法

public class MyTdkApplication extends TdkApplication {

}

但我无法将此类作为Java应用程序运行

1 个答案:

答案 0 :(得分:0)

TdkApplication 设为抽象类。

@SpringBootApplication
Import({SecurityConfig.class})
public abstract class TdkApplication  implements CommandLineRunner {    }



public class MyTdkApplication extends TdkApplication {
 SpringApplication.run(MyTdkApplication .class, args);
    }

    @Override
    public void run(String... args) throws Exception {

    }}