国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 學(xué)院 > 開(kāi)發(fā)設(shè)計(jì) > 正文

Spring Boot簡(jiǎn)介

2019-11-08 01:35:35
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

SPRing Boot簡(jiǎn)介

Spring Boot won’t replace the Spring Framework. That’s because Spring Bootisthe Spring Framework! Youcan view Spring Boot as a new way to create Spring applications with ease.Spring Boot simplifies the way you develop, because it makes it easy to create production-ready Spring-based applications that you canjust run. You will find out that, with Spring Boot, you can create standalone applications that use an embedded server, making them 100% runnable applications. I will talk about this in several chapters of the book. One of its best features is that Spring Boot is an “opinionated” technology in that it will help you follow the best practices for creating robust, extensible, and scalable Spring applications.     spring boot  基于spring框架,是一種新的創(chuàng)建spring應(yīng)用的新方式,這種方式主要是基于maven的設(shè)計(jì)哲學(xué)--約定優(yōu)于配置。一行代碼,一個(gè)注解就可以運(yùn)行一個(gè)spring boot應(yīng)用,其底層的配置,spring boot默認(rèn)基于規(guī)則幫我們自動(dòng)化處理了,避免了繁瑣的xmljava 方式的配置。

Spring Applications

If you are a Spring developer like me, you already know that in order to create a simple Spring webapplication, you must follow certain rules of the J2EE stack and some of the Spring Framework. Those rulesinclude the following:過(guò)去,我們創(chuàng)建一個(gè)spring web應(yīng)用,要按照一系列步驟:Create a folder structure that contains your WAR (Web ARchive):? It must contain aWEB-INFfolder withliband classessubfolders that contain the third-party libraries andyour web application classes, respectively.? Some jsp (if needed), HTML, CSS, images, and JavaScript (if needed) files.? A file namedweb.xmlthat will contain the Springorg.springframework.web.servlet.DispatcherServletclass.? Your Spring beans in the form<servlet-name>-servlet.xml(of course, you canoverride this and add the complete location and name of your Spring beans).

Spring Boot to the Rescue

現(xiàn)在我們創(chuàng)建一個(gè)spring boot 應(yīng)用: 
package com.sdcuike.spring;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplicationpublic class SimpleWebApp {    public static void main(String[] args) {        SpringApplication.run(SimpleWebApp.class, args);    }}基本上一行代碼,一個(gè)注解搞定。

Why Spring Boot?

Spring Boot has many features that make it suitable for:? Cloud Native Applications that follow the 12 factor patterns (developed by the Netflixengineering team at http://12factor.net/)? Productivity increases by reducing time of development and deployment? Enterprise-production-ready Spring applications? Non-functional requirements, such as the Spring Boot Actuator (a module thatbrings metrics, health checks, and management easily) and embedded containersfor running web applications (such as Tomcat, Undertow, Jetty, etc.)The term “microservices” is getting attention for creating scalable, highly available, and robustapplications, and Spring Boot fits there perfectly by allowing developers to focus only on the business logicand to leave the heavy lifting to the Spring Framework.

Spring Boot Features

Spring Boot has a lot of features that you’ll learn about in the following chapters, and here is just a taste:? The SpringApplicationclass. I showed you that in a Java Spring Boot application, the main method executes this singleton class. This particular class provides a convenient way to initiate a Spring application.啟動(dòng)很方便。? Spring Boot allows you to create applications without requiring any XML configuration. Spring Boot doesn’t generate code.無(wú)需xml配置,利用java默認(rèn)的配置或定制配置即可。? Spring Boot provides a fluent builder API through theSpringApplicationBuilder singleton class that allows you to create hierarchies with multiple application contexts. This particular feature is related to the Spring Framework and how it works internally. If you are a Spring developer already, you’ll learn more about this feature in the following chapters. If you are new to Spring and Spring Boot, you just need to know that you can extend Spring Boot to get more control over your applications.? Spring Boot offers you more ways to configure the Spring application events and listeners. This will be explained in more detail in the following chapters.? I mentioned that Spring Boot is an “opinionated” technology, which means that Spring Boot will attempt to create the right type of application, either a web application (by embedding a Tomcat or Jetty container) or a single application.? The ApplicationArgumentsinterface. Spring Boot allows you to access any application arguments. This is useful when you want to run your application with some parameters. For example, you can use--debug mylog.txtor--audit=true and have access to those values.? Spring Boot allows you to execute code after the application has started. The only thing you need to do is implement theCommandLineRunnerinterface and provide the implementation of the run(String ...args)method. A particular example is to initialize some records in a database as it starts or check on some services and see ifthey are running before your application starts. ? Spring Boot allows you to externalize configurations by using an application.propertiesorapplication.ymlfile. More about this in the following chapters.? You can add administration-related features, normally through JMX. You do this simply by enabling thespring.application.admin.enabledproperty in the application.propertiesorapplication.ymlfiles.? Spring Boot allows you to have profiles that will help your application run in different environments.? Spring Boot allows you to configure and use logging very simply.? Spring Boot provides a simple way to configure and manage your dependencies by using starter poms. In other Words, if you are going to create a web application, you only need to include thespring-boot-start-webdependency in your Maven pom or Gradle build file.? Spring Boot provides out-of-the-box non-functional requirements by using the Spring Boot Actuator, so you can see the health, memory, and so on, of your application.? Spring Boot provides@Enable<feature>annotations that help you to include, configure, and use technologies like databases (SQL and NoSQL), caching, scheduling, messaging, Spring integration, batching, and more.As you can see, Spring Boot has all these features and more, and you’ll learn more about these features inthe following chapters. Now it’s time to start learning more about Spring Boot by seeing how it works internally

Pro Spring Boot 讀書(shū)筆記

  

Pro Spring Boot

A no-nonsense guide containing case studies and best practices for Spring Boot

Author:Felipe GutierrezIsbn:1484214323Year:2016Pages:365Language:English
發(fā)表評(píng)論 共有條評(píng)論
用戶(hù)名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 新巴尔虎左旗| 黄石市| 宜良县| 抚顺县| 潜江市| 昭苏县| 开封县| 驻马店市| 建平县| 揭西县| 乐清市| 西畴县| 襄汾县| 龙山县| 双柏县| 郁南县| 丹阳市| 东阿县| 清新县| 蒙山县| 五莲县| 神农架林区| 博爱县| 法库县| 壤塘县| 靖州| 鄄城县| 名山县| 和政县| 合肥市| 麻江县| 怀集县| 深泽县| 盐城市| 赤壁市| 郁南县| 隆林| 文山县| 小金县| 胶南市| 英吉沙县|