Home > Back-end >  SpringBoot learning
SpringBoot learning

Time:10-05

Spring the Boot base article
Introduction of Spring 1.1 Boot
Spring the Boot is the starting point of all based on the development of the Spring projects, SpringBoot actually is not a new framework, the use of it to the default configuration many frameworks, like maven integrates all the jars, Spring Boot incorporates a lot of technology, provided the JavaEE great integration,

1.1.1 springboot learning bedding and requirements
1. The IOC has in-depth understanding of the spring, springboot is based on the spring,
2. Learn how spring's annotations development, traditional old programmers understanding of annotations,
3. It is better for SSM project development experience, because springboot is integrated the javaEE technology,
4. Have good source learning experience,
5. Have the experience of idea and the eclipse and use this course idea,
6. In the domestic IT companies is a key job requirement,


1.1.2, SpringBoot main feature
Spring's official website: https://spring.io/

1, SpringBoot Starter: he will commonly used depend on the group consolidated, merged into a dependency, it can be added to the project at once so Maven or Gradle build;

2, make it simple encoding, SpringBoot used to configure Spring JavaConfig way, and to provide a large number of comments, greatly improve the working efficiency,

3, automatic configuration: SpringBoot automatic configuration characteristics of the use of Spring's support for conditional configuration, reasonably speculated that bean and automation configuration required for application;

4, make it simple deployment, SpringBoot built three Servlet container, Tomcat, Jetty, undertow. We just need a Java runtime environment can run SpringBoot project, SpringBoot project can be blended into a jar package,

5, now popular micro service and distributed systems, micro springboot is a very good service development framework, you can use it to quickly set up a system, at the same time, you can also use a spring cloud (spring cloud is a spring-based Boot implementation of cloud application development tools) to build a distributed architecture,



1.1.3 springboot shortcomings
1. Converts the existing or traditional Spring Framework project to Spring the Boot application is a very difficult and time-consuming process, it only applies to new Spring projects,
2. Simple to use, high cost, acquire a good knowledge of difficult,

1.2 environment to

Recommended jdk1.8 jdk1.8: Spring Boot and above;
Maven3. X: maven 3.3 above;
IntelliJIDEA2019, do not use 2017
SpringBoot 2.3.0. RELEASE


Day 1
1.2.1 MAVEN Settings
1. Configuration ali cloud image

Nexus - aliyun
Central
The Nexus aliyun
http://maven.aliyun.com/nexus/content/groups/public

2. To maven Settings. The XML configuration files of the profiles TAB to add

The JDK 1.8 & lt;/id>

True
1.8 & lt;/jdk>


1.8 & lt;/maven.com piler. Source>
1.8 & lt;/maven.com piler. Target>
1.8 & lt;/maven.compiler.com pilerVersion>


1.2.2 IDEA set
1. Specify JDK environment


2. Specify the maven environment


1.3 Spring Boot HelloWorld
1.3.1 father create a maven project tx_sboot (pom)

Pom. XML
<? The XML version="1.0" encoding="utf-8"?>
XMLNS: xsi="http://www.w3.org/2001/XMLSchema-instance"
Xsi: schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" & gt;
4.0.0 & lt;/modelVersion>

Cn. Tx. Springboot
Tx_sboot & lt;/artifactId>
1.0 - SNAPSHOT
Pom



Org. Springframework. Boot
Spring - the boot - starter - parent
2.3.0. RELEASE





Org. Springframework. Boot
Spring - the boot - starter - web






1.3.2 the parent project created under springboot - first (jar)

1.3.3 create test Controller
@ RestController
Public class TestController {

@ RequestMapping (" hello ")
Public String hello () {
Return "hello".
}
}
1.3.4 create a springboot start class
@ SpringBootApplication
Public class FirstSpringApplication {

Public static void main (String [] args) {
SpringApplication. Run (FirstSpringApplication. Class, args);
}
}

Start-up and testing: http://localhost:8080/hello
Success,
1.3.5 add build dependencies in the parent project tx_sboot



Org. Springframework. Boot
Spring - the boot - maven - plugin




We can put the springboot project into an executable jar
MVN -f springboot - first clean package
After the jars, we cut into the corresponding jar package execution


1.3.6 finish the question of the first example,
1. The starter is what? We how to use these starter?
2. The embedded Tomcat is how to achieve
3. Use the web corresponding starter, how automatic assembly is for springmvc?
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related