SpringBoot官方文档翻译(二十九):Spring Boot的功能

Part IV. Spring Boot features(Spring Boot的功能)

1
2
3
4
5
This section dives into the details of Spring Boot. Here you can learn     
about the key features that you may want to use and customize. If you
have not already done so, you might want to read the "Part II, “Getting
Started”" and "Part III, “Using Spring Boot”" sections, so that you have
a good grounding of the basics.

本章节将介绍SPirng Boot的细节,您可以学习到你想使用和定制的关键功能。如果您还没有准备好,您可以阅读第二部分“Getting Started”和第三部分“Using Spring Boot”章节,这样您可以具备良好的基础知识。

23. SpringApplication

1
2
3
4
The SpringApplication class provides a convenient way to bootstrap     
a Spring application that is started from a main() method. In many
situations, you can delegate to the static SpringApplication.run 
method, as shown in the following example:

SpringApplication类提供了一个非常便捷的方式通过main()方法去启动Spring应用。在大多数情况下,您可以通过委托给静态方法SpringApplication.run()去启动,如下:

1
2
3
public static void main(String[] args) {
SpringApplication.run(MySpringConfiguration.class, args);
}

1
2
When your application starts, you should see something similar     
to the following output:

当您的应用启动后,您将看到如下的景象:

1
2
3
4
5
6
7
8
9
10
11
12
  .   ____          _            __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: v2.1.0.BUILD-SNAPSHOT

2013-07-31 00:08:16.117 INFO 56603 --- [ main] o.s.b.s.app.SampleApplication : Starting SampleApplication v0.1.0 on mycomputer with PID 56603 (/apps/myapp.jar started by pwebb)
2013-07-31 00:08:16.166 INFO 56603 --- [ main] ationConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@6e5a8246: startup date [Wed Jul 31 00:08:16 PDT 2013]; root of context hierarchy
2014-03-04 13:09:54.912 INFO 41370 --- [ main] .t.TomcatServletWebServerFactory : Server initialized with port: 8080
2014-03-04 13:09:56.501 INFO 41370 --- [ main] o.s.b.s.app.SampleApplication : Started SampleApplication in 2.992 seconds (JVM running for 3.658)

1
2
3
4
By default, INFO logging messages are shown, including some     
relevant startup details, such as the user that launched the
application. If you need a log level other than INFO, you can
set it, as described in Section 26.4, “Log Levels”,

默认情况下,INFO级别的日志将会展示出来,包括一些相应的启动细节,诸如启动程序的用户等。如果您需要展示不仅仅是INFO级别的日志,您可以设置它,详情参照26.4章节“Log Levels”。

分享到