December 12, 2013, Spring released the 4.0 version. This was originally a repository for control reversal containers on the Java platform, and after nearly 10 years of development it has become a Big Mac product. However, it relies on a good layered design, each function module can maintain a good independence, Java platform is a rare and useful open source appli
Use Spring Boot to develop "Hello World" Web applications, springhelloEnvironment preparation
Because many ides currently support Maven, we will use Maven to build this project;
Before you start, install Java and Maven:
This project will be developed based on Spring Boot 1.4
after the install, and then Java-jar Xxx.jar mode can not start )
The target depends on the dependencies configuration:
Spring-boot-starter-web: Full stack Web development module with embedded tomcat, spring MVC
Spring-
Note Development for spring boot under Restful styleThe restful style often used by e-commerce websites is just a development idea, not a development framework, and today's technology does not fully implement restful styles. RESTful style is an architectural concept that perfectly interprets the HTTP protocol restful way requires a restful style of front controller to be configured with /to identify the url
First, Spring Data JPA Introduction
The JPA (Java Persistence API) Java Persistence API is the standard specification for Java persistence, and Hibernate is a technical implementation of the persistence specification, and Spring Data JPA is a framework encapsulated on Hibern
We complete our example by creating a fully self-contained executable jar file that can be run in production env. An executable jar (sometimes called a "fat jars") is an archive file that contains the classes you compile and all the jar dependencies your code needs to run.This example continues on the basis of Spring Boot (1): Guide.(1) Add the following dependencies in Maven:1 can be punched into a run
Overview
We talked about how to build a simple spring boot application (see Spring Boot-Explore), where we learned how to configure the project, including system build, automatic configuration, Dependency injection, development tools, and so on, to make it work better. System Building
To facilitate dependency manageme
I. Spring boot history backgroundSpring was born as a lightweight alternative to the Java Enterprise Edition (Java Business Edition,jee, also known as EE). Without the development of heavyweight Enterprise JavaBean (EJB), Spring provides a relatively simple way for enterpris
Setting property values from the command lineBelieve that users who have used spring boot for a period of time must know this command: Java-jar Xxx.jar--server.port=8888, set the Xxx.jar app port to 8888 by using the –server.port property.At the command line, two consecutive minus signs-the identification of the value of the property in Application.properties. So
+ @EnableAutoConfiguration + @ComponentScan . @RestController annotations are equivalent to @responsebody + @Controller combined@Configuration: This is a configuration class that configures spring.@Controller: Indicate that this is a SPRINGMVC controller. @ResponseBody: If you need to return Json,xml or customize mediatype content to the page, You need to add the @responsebody annotation to the corresponding method Main method: Launches an a
1. Maven constructs spring Boot
Create a MAVEN Web project that introduces spring-boot-starter-parent dependencies
Using Spring-boot-starter-parent to build a spring
whole business, it is some log or other auxiliary code. And many businesses need the same functionality, such as the need to log, it is necessary to copy the functions of these logging, even if it is packaged into a framework, but also need to call. Using complex design patterns here is not worth the candle.So we have to face the plane.3. Building AOPOriginally, Spring came with a set of AOP implementations, and we used this implementation directly,
Spring Boot Property configuration and use
Spring Boot allows you to use the same application code in different environments via an external configuration, simply by injecting the properties into the configuration file or by modifying the default configuration. Spring
complex. In order of precedence from highest to lowest, the specific list is as follows.
command-line arguments.
The Java system parameters obtained through System.getproperties ().
Operating system environment variables.
The JNDI attribute obtained from java:comp/env.
The "random.*" property generated by Randomvaluepropertysource.
Apply the properties file outside of the Jar file . (via spring.config.location parameter)
What is Spring Boot?
Spring Boot makes it easy to create stand-alone, Production-grade Spring based applications so you can "just run".You can use the Spring Boot to create
ObjectiveThe simple use of spring Boot as early as last year was shocked by its handy features. But that is also not in-depth research, as its application in the industry more and more widely, so decided to study deeply, will own learning experience in this record, this article mainly around the following points to explain:
About Spring
: spring boot entry. In the entire project, including its sub-projects, there can only be one main method. Otherwise, spring boot cannot be started.
Note: The first parameter of the run method does not apply to full-class names. We recommend that you use full-class names.
3. Start
Official document:http://projects.spring.io/spring-boot/Project code: Https://github.com/chenxing12/springboot-testFirst, IntroductionSpringmvc is a very great framework for open source and rapid development. Good design is bound to divide and decouple. Therefore, Spring has many sub-projects, such as core, context, Bean, MVC, and so on. This is simple and clear
OverviewThis article mainly writes about some common configurations of spring boot.
Spring Boot Basic Configuration Entry class:Spring boot usually has an entry class named *application, and the entry class has a Main method, which is actually a standard
through the CLI:Spring init-dweb,data-jpa,h2,thymeleaf--build Gradle readinglist The init command of the CLI cannot specify the project root package name and project name. The package name is demo by default and the project name is demo by default.2. Directory structureRegardless of the way we create a project, after importing the project into the IDE, we can see that the entire project structure follows the layout of a traditional Maven or Gradle project, where the main application code is lo
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.