Spring boot&&spring Cloud Series Spring Boot initial knowledge

Source: Internet
Author: User
Tags spring initializr

First, Spring boot advantages
    1. Tips for easier use and rapid development of spring development
    2. With out-of-the-box default configuration features that can be configured automatically based on project dependencies
    3. A more powerful service system, including embedded services, security, performance indicators, health checks, etc.
    4. Absolutely no code generation, no need for XML configuration to make applications lighter and more flexible
    5. The use of third-party technologies provides a perfect integration
Second, the project creation method
    1. Create a new project with Maven
    2. Create a new project with spring INITIALIZR (see previous article)
Three, basic dependency configuration
1 <Parent>2         <groupId>Org.springframework.boot</groupId>3         <Artifactid>Spring-boot-starter-parent</Artifactid>4         <version>1.5.6.RELEASE</version>5         <RelativePath/> <!--Lookup parent from repository -6     </Parent>7 <Dependency>8             <groupId>Org.springframework.boot</groupId>9             <Artifactid>Spring-boot-starter-web</Artifactid>Ten         </Dependency>
Iv. Simple Examples
1 Package COM.SLP;2 3 import Org.mybatis.spring.annotation.MapperScan;4 import org.springframework.boot.SpringApplication;5 import org.springframework.boot.autoconfigure.SpringBootApplication;6 7 @SpringBootApplication8 @MapperScan ("Com.slp.mapper")9 Public class DemoApplication {Ten  One Public static void Main (string[] args) { A Springapplication.run (Demoapplication.class, args); -     } -}

Annotations @springbootapplication Annotations This is a spring boot application

The main method makes him a main program that will be executed first when the app is launched

V. Spring Boot Configuration

Create a application.properties or Application.yum file in the Project resource folder that will be automatically published to classpath and automatically read by spring boot.

Different files are configured differently, but the same parameter entries are implemented:

APPLICATION.YML:

1 Server: 2       port:803      Tomcat:4              uri-encoding:utf-8

Application.properties:

1 Server.port = 2 server.tomcat.uri-encoding = UTF-8

Spring boot&&spring Cloud Series Spring Boot initial knowledge

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.