The Spring framework is like a family with many derivative products such as boot, security, JPA, and so on. But they are based on the spring IOC and AOP IOC, which provides dependency injection of container AOP, solves cross-sectional programming, and then implements the advanced features of other extended products based on the two.
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
configuration. ;2. @Configuration: This is a configuration class that configures spring;3, @Controller: Marked this is a SPRINGMVC controller controllers;4, Main method: Start an application in the main method, that is: the application of the entrance; 1.3.5. Start the app
In the spring boot project, there are two ways to start a direct run
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
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
+ @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
;Importjava.io.IOException; @Service Public classAwareserviceImplementsbeannameaware,resourceloaderaware{//implement Beannameaware and Resourceloaderaware interfaces to get the bean name and resource Load service PrivateString Beanname; PrivateResourceloader Loader; @Override Public voidSetbeanname (String beanname) {//implementing Beannameaware requires overriding the Setbeanname method This. Beanname =Beanname; } @Override Public voidSetresourceloader (Resourceloader loader) {//impl
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-
The process of 1.Spring development1> First stage: XML configuration (XML configuration files need to be divided into different configuration files);2> second Stage: annotation configuration (provides annotations for declaring beans, such as @component, @Service, a basic configuration such as database configuration with XML, business Configuration annotated);3> third stage: Java configuration (
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
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
Spring Boot Basic Tutorial 1-spring tool Suite Tools InstallationSpring Boot Basic Tutorial 2-restfull Quick build of API Simple projectSpring Boot Basic Tutorial 3-configuration file in detail: properties and YamlSpring Boot Basi
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
configure multiple properties on our own
We delete the. properties suffix file, use the. yml file for a simple configuration, and then use the @Value to get the configuration properties:Restart Spring Boot, enter address: Localhost:8080/hello can see the correct result:
Note: We did not specify the type of the attribute in the Yml file, but it was defined when it was used.
You can 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
Recently work too busy, so delay to everyone to share the actual combat springboot framework of use.The following is the use of spring boot to integrate multiple frameworks.The first is to prepare for the job well.First, the package required to import the framework, we use the thing Maven to manage the package.The above example is my h5ds real background management project. The project is being financed wit
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
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.