官术网_书友最值得收藏!

Creating an application object

The @SpringBootApplication annotation provides a convenient way to bootstrap a Spring application that can be started from a main() method. In many situations, you can just delegate to the static runApplication method:

@SpringBootApplication
class Chapter2Application

fun main(args: Array<String>) {
runApplication<Chapter2Application>(*args)
}

You can see that we have used the @SpringBootApplication annotation for marking a class that we will use as our application context. We will learn more about the Spring Application Context shortly.

When a Spring Boot application starts it will autoconfigure all the required systems; if it is a web app, it will start a web application.

Spring Boot provides an embedded Tomcat server that will start when our application starts. This is a fully functional server, so it's not required to deploy our software in any application server. However, Spring allows us to do it. We will discuss more on this in the section: Packing and running a Spring Boot application.

The application will also configure and run any other system that we need, such as a connection pool to a database or a queue.

主站蜘蛛池模板: 巴中市| 甘孜县| 宜兴市| 宁晋县| 克东县| 边坝县| 南投县| 长沙县| 房山区| 罗定市| 鸡西市| 武鸣县| 曲麻莱县| 龙州县| 嘉定区| 丹巴县| 潼关县| 莲花县| 和田县| 锡林浩特市| 专栏| 新龙县| 黑河市| 金阳县| 台东市| 迁安市| 富源县| 桑植县| 安西县| 芮城县| 锦州市| 沁源县| 西乌珠穆沁旗| 霍州市| 海林市| 江源县| 界首市| 铜鼓县| 毕节市| 伊宁县| 温泉县|