Micro-frame Spring boot detailed

Source: Internet
Author: User

Spring boot, a new framework provided by the pivotal team, is designed to simplify the initial set-up and development process of new spring applications. The framework is configured in a specific way so that developers no longer need to define a boilerplate configuration. In this way, boot is committed to becoming a leader in the booming field of rapid application development (rapid application development).

For years, the Spring IO platform has been criticized for a large number of XML configurations and complex dependency management. At last year's Springone 2GX meeting, Pivotal CTO Adrian Colyer responded to these criticisms, noting that one of the platform's future goals was to implement a development experience that was free of XML configuration. The functionality implemented by the Boot is beyond the description of this task, and developers are not only no longer required to write XML, but in some scenarios they do not even need to write tedious import statements. At the time of the release of the externally released beta release, the boot describes how to use the framework to implement a Web application that can be run within 140 characters, resulting in a great deal of attention, the sample being posted on a tweet.

However, spring boot is not intended to be a replacement for many of the "Foundation" layer projects in the Spring IO platform. The goal of Spring boot is not to provide new solutions for resolved problem domains, but to bring another development experience to the platform, simplifying the use of these technologies. Boot is an ideal choice for developers who are already familiar with the spring ecosystem, but for new spring technology, boot provides a more concise way to use these technologies.

In the quest for a boost to the development experience, spring Boot can even say that the entire Spring ecosystem uses the Groovy programming language. The many handy features provided by the boot are achieved with the help of groovy's powerful MetaObject protocol, the pluggable AST conversion process, and the built-in dependency solution engine. In its core compilation model, boot uses groovy to build the engineering file, so it can decorate the bytecode generated by the class using common import and boilerplate methods, such as the main method of the class (decorate). This application, which is written using the boot, can be very concise, but it can still provide many functions.

Install boot

At its most fundamental, Spring boot is a collection of libraries that can be used by the build system of any project. For simplicity, the framework also provides a command-line interface that can be used to run and test the boot application. The release version of the framework, including the integrated CLI (command-line interface), can be manually downloaded and installed in the Spring warehouse. A simpler way to do this is to use the Groovy Environment Manager (Groovy Environment MANAGER,GVM), which handles the installation and management of the boot version. The boot and its CLI can be installed through the GVM command line GVM install Springboot. Install boot on OS X to use the Homebrew Package Manager. To complete the installation, you first switch to the pivotal warehouse using brew tap Pivotal/tap, and then execute the Brew install Springboot command.

The projects to be packaged and distributed depend on a build system such as Maven or Gradle. To simplify the dependency graph, the boot function is modular, and many dependencies can be added to the project by importing the boot so-called "starter" module. To make it easier to manage dependent versions and use the default configuration, the framework provides a parent POM, which the project can inherit. The sample Pom file definition for the Spring boot project is shown in Listing 1 of the program.

Program Listing 1

<?xml version= "1.0" encoding= "UTF-8"?> <project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "http ://www.w3.org/2001/XMLSchema-instance "xsi:schemalocation=" http://maven.apache.org/POM/4.0.0 Http://maven.apach E.org/xsd/maven-4.0.0.xsd "> <modelVersion>4.0.0</modelVersion> <groupid>com.example</gro  Upid> <artifactId>myproject</artifactId> <version>1.0.0-SNAPSHOT</version> <!-- Inherit defaults from Spring Boot--> <parent> &LT;GROUPID&GT;ORG.SPRINGFRAMEWORK.BOOT&LT;/GROUPID&G
        T <artifactId>spring-boot-starter-parent</artifactId> <version>1.0.0.RC1</version> </ parent> <!--Add Typical dependencies for a Web application--> <dependencies> <depende Ncy> <groupId>org.springframework.boot</groupId> <artifactid>spring-boot-star Ter-web</artifactid> </dependency> <dependency> <groupid>org.springframework.boot</g
    Roupid> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> </dependencies> <repositories> <repository> <id>spring-snapshots</id&
            Gt <url>http://repo.spring.io/libs-snapshot</url> </repository> </repositories> < Pluginrepositories> <pluginRepository> <id>spring-snapshots</id> <

    Url>http://repo.spring.io/libs-snapshot</url> </pluginRepository> </pluginRepositories> <build> <plugins> <plugin> <groupid>org.springframework.bo Ot</groupid> <artifactId>spring-boot-maven-plugin</artifactId> </plugin
   >     </plugins> </build> </project> 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.