赞
踩
- public class A {
- public static void main(String[] args) {
- SpringApplication.run(A.class, args);
- }
- }
- public class A {
- public static void main(String[] args) {
- SpringApplication sp = new SpringApplication(B.class);
- sp.run(args);
- }
- }
等价于
- public class A {
- public static void main(String[] args) {
- SpringApplication.run(B.class, args);
- }
- }
通过SpringApplicationBuilder来自定义构建启动程序
- public class A {
- public static void main(String[] args) {
- new SpringApplicationBuilder(B.class).
- web(WebApplicationType.NONE).
- beanNameGenerator(new FullBeanNameGenerator()).
- run(args);
- }
- }
总结:第三种启动方式最为灵活,可以自定义需要配置的信息,然后再启动
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。