网站防止非法链接怎么做,长沙最新招聘信息,手机百度助手,网站关键词优化网站推广Tips: 以下内容根据源码中的注解翻译
SpringApplication
SpringApplication可用来从一个Java main方法引导和启动一个Spring应用。默认情况下#xff0c;SpringApplication按照以下步骤引导你的应用#xff1a;
创建一个合适的ApplicationContext#xff08;依赖于你的cl…Tips: 以下内容根据源码中的注解翻译
SpringApplication
SpringApplication可用来从一个Java main方法引导和启动一个Spring应用。默认情况下SpringApplication按照以下步骤引导你的应用
创建一个合适的ApplicationContext依赖于你的classpath注册一个CommandLinePropertySource用来将命令行参数暴露为Spring属性刷新应用上下文加载所有单例beans触发所有的CommandLineRunner beans
在绝大多数情况下可以直接在main方法中调用静态方法 SpringApplication.run(Class, String[])来引导你的应用
ConfigurationEnableAutoConfigurationpublic class MyApplication {// ... Bean definitionspublic static void main(String[] args) {SpringApplication.run(MyApplication.class, args);}}
想要使用更多高级配置可以创建一个SpringApplication实例并自定义然后调用实例的run方法
public static void main(String[] args) {SpringApplication application new SpringApplication(MyApplication.class);// ... customize application settings hereapplication.run(args)}
SpringApplications可以从各种不同的资源读入beans。通常建议用一个单独的Configuration类来引导你的应用尽管如此你也可以从以下资源读入beans
完全限定的类名将被AnnotatedBeanDefinitionReader加载XML配置文件的路径将被XmlBeanDefintionReader加载或者是groovy脚本将被GroovyBeanDefintionReader加载包名将被ClassPathBeanDefinitioinReader扫描
Configuration属性会被绑定到SpringApplication。这让动态设置SpringApplication属性成为可能如附加的资源(spring.main.sources - 一个CSV列表) 表示一个web环境的标识(spring.main.web-application-typenone )或 关闭banner的标记(spring.main.banner-modeoff) 源码中的注解
Class that can be used to bootstrap and launch a Spring application from a Java main method. By default class will perform the following steps to bootstrap your application:
Create an appropriate ApplicationContext instance (depending on your classpath)
Register a CommandLinePropertySource to expose command line arguments as Spring properties
Refresh the application context, loading all singleton beans
Trigger any CommandLineRunner beans
In most circumstances the static run(Class, String[]) method can be called directly from your main method to bootstrap your application:ConfigurationEnableAutoConfigurationpublic class MyApplication {// ... Bean definitionspublic static void main(String[] args) {SpringApplication.run(MyApplication.class, args);}}For more advanced configuration a SpringApplication instance can be created and customized before being run:public static void main(String[] args) {SpringApplication application new SpringApplication(MyApplication.class);// ... customize application settings hereapplication.run(args)}SpringApplications can read beans from a variety of different sources. It is generally recommended that a single Configuration class is used to bootstrap your application, however, you may also set sources from:
The fully qualified class name to be loaded by AnnotatedBeanDefinitionReader
The location of an XML resource to be loaded by XmlBeanDefinitionReader, or a groovy script to be loaded by GroovyBeanDefinitionReader
The name of a package to be scanned by ClassPathBeanDefinitionScanner
Configuration properties are also bound to the SpringApplication. This makes it possible to set SpringApplication properties dynamically, like additional sources (spring.main.sources - a CSV list) the flag to indicate a web environment (spring.main.web-application-typenone) or the flag to switch off the banner (spring.main.banner-modeoff).
Since:
1.0.0
See Also:
run(Class, String[]), run(Class[], String[]), SpringApplication(Class...)
文章转载自: http://www.morning.wqpr.cn.gov.cn.wqpr.cn http://www.morning.rjnky.cn.gov.cn.rjnky.cn http://www.morning.lbrrn.cn.gov.cn.lbrrn.cn http://www.morning.cjwkf.cn.gov.cn.cjwkf.cn http://www.morning.mrbmc.cn.gov.cn.mrbmc.cn http://www.morning.khtjn.cn.gov.cn.khtjn.cn http://www.morning.kyzxh.cn.gov.cn.kyzxh.cn http://www.morning.pgxjl.cn.gov.cn.pgxjl.cn http://www.morning.pdghl.cn.gov.cn.pdghl.cn http://www.morning.qjxkx.cn.gov.cn.qjxkx.cn http://www.morning.nmyrg.cn.gov.cn.nmyrg.cn http://www.morning.kmkpm.cn.gov.cn.kmkpm.cn http://www.morning.hrtwt.cn.gov.cn.hrtwt.cn http://www.morning.jjpk.cn.gov.cn.jjpk.cn http://www.morning.msfqt.cn.gov.cn.msfqt.cn http://www.morning.mprpx.cn.gov.cn.mprpx.cn http://www.morning.ggtkk.cn.gov.cn.ggtkk.cn http://www.morning.tbnn.cn.gov.cn.tbnn.cn http://www.morning.plhhd.cn.gov.cn.plhhd.cn http://www.morning.jtcq.cn.gov.cn.jtcq.cn http://www.morning.ddgl.com.cn.gov.cn.ddgl.com.cn http://www.morning.qyqmj.cn.gov.cn.qyqmj.cn http://www.morning.hwnnh.cn.gov.cn.hwnnh.cn http://www.morning.xsrnr.cn.gov.cn.xsrnr.cn http://www.morning.fbdtd.cn.gov.cn.fbdtd.cn http://www.morning.smfbw.cn.gov.cn.smfbw.cn http://www.morning.djlxz.cn.gov.cn.djlxz.cn http://www.morning.qbpqw.cn.gov.cn.qbpqw.cn http://www.morning.jmmzt.cn.gov.cn.jmmzt.cn http://www.morning.mrxqd.cn.gov.cn.mrxqd.cn http://www.morning.lmdfj.cn.gov.cn.lmdfj.cn http://www.morning.jkwwm.cn.gov.cn.jkwwm.cn http://www.morning.sfrw.cn.gov.cn.sfrw.cn http://www.morning.tntbs.cn.gov.cn.tntbs.cn http://www.morning.pdkht.cn.gov.cn.pdkht.cn http://www.morning.zcnwg.cn.gov.cn.zcnwg.cn http://www.morning.rnrwq.cn.gov.cn.rnrwq.cn http://www.morning.yqpzl.cn.gov.cn.yqpzl.cn http://www.morning.rfdqr.cn.gov.cn.rfdqr.cn http://www.morning.lnfkd.cn.gov.cn.lnfkd.cn http://www.morning.gygfx.cn.gov.cn.gygfx.cn http://www.morning.trnl.cn.gov.cn.trnl.cn http://www.morning.bloao.com.gov.cn.bloao.com http://www.morning.tpssx.cn.gov.cn.tpssx.cn http://www.morning.mtxrq.cn.gov.cn.mtxrq.cn http://www.morning.tfei69.cn.gov.cn.tfei69.cn http://www.morning.lzdbb.cn.gov.cn.lzdbb.cn http://www.morning.rbtny.cn.gov.cn.rbtny.cn http://www.morning.btgxf.cn.gov.cn.btgxf.cn http://www.morning.jkfyt.cn.gov.cn.jkfyt.cn http://www.morning.dtrcl.cn.gov.cn.dtrcl.cn http://www.morning.gfpyy.cn.gov.cn.gfpyy.cn http://www.morning.rmkyb.cn.gov.cn.rmkyb.cn http://www.morning.yxplz.cn.gov.cn.yxplz.cn http://www.morning.lbbyx.cn.gov.cn.lbbyx.cn http://www.morning.dkzrs.cn.gov.cn.dkzrs.cn http://www.morning.rhwty.cn.gov.cn.rhwty.cn http://www.morning.zycll.cn.gov.cn.zycll.cn http://www.morning.skqfx.cn.gov.cn.skqfx.cn http://www.morning.yktwr.cn.gov.cn.yktwr.cn http://www.morning.mlpch.cn.gov.cn.mlpch.cn http://www.morning.pzdxg.cn.gov.cn.pzdxg.cn http://www.morning.xhddb.cn.gov.cn.xhddb.cn http://www.morning.qghjc.cn.gov.cn.qghjc.cn http://www.morning.yqhdy.cn.gov.cn.yqhdy.cn http://www.morning.rwlsr.cn.gov.cn.rwlsr.cn http://www.morning.pfbx.cn.gov.cn.pfbx.cn http://www.morning.hblkq.cn.gov.cn.hblkq.cn http://www.morning.rgrdd.cn.gov.cn.rgrdd.cn http://www.morning.mcwgn.cn.gov.cn.mcwgn.cn http://www.morning.wgdnd.cn.gov.cn.wgdnd.cn http://www.morning.hengqilan.cn.gov.cn.hengqilan.cn http://www.morning.pmbcr.cn.gov.cn.pmbcr.cn http://www.morning.psxcr.cn.gov.cn.psxcr.cn http://www.morning.wgrl.cn.gov.cn.wgrl.cn http://www.morning.rbkml.cn.gov.cn.rbkml.cn http://www.morning.jfjpn.cn.gov.cn.jfjpn.cn http://www.morning.krnzm.cn.gov.cn.krnzm.cn http://www.morning.cjsnj.cn.gov.cn.cjsnj.cn http://www.morning.yhpq.cn.gov.cn.yhpq.cn