The code in the previous section is a starter program for Spring-boot and a program on the official documentation. This section introduces the way in which Spring-boot official documentation is recommended to develop the code and introduces our call to the service layer in spring
Article Directory
1. Out of the box, hidden in the mystery
2. Summary
3. Source Code
Spring boot provides a lot of "out-of-the-box" dependency modules, so how does spring boot skillfully do it out of the box and automatically configure it?Out of the box, inside the hidden mysterySpring
Spring Boot is a new framework provided by the pivotal team designed to simplify the initial setup and development of new spring applications. The framework uses a specific approach to configuration, which eliminates the need for developers to define boilerplate configurations. In this way, Spring
Turn http://rapharino.com/coder/Spring-Boot-Induction/
Spring Boot InductionPosted in
2016-10-29 | Categories in
coder |
| Read Count
Spring boot simplifies
Spring Boot Learning route, this article plans to analyze and develop a roadmap for learning how to use Spring boot technology based on the author's work and learning experience in recent years.First, the preparatory workAs the saying goes: "工欲善其事 its prerequisite". In particular, software development, such a focus on
HTTP.
Using configuration Like the example above means the application would no longer support plain HTTP connector at port 8080. Spring Boot doesn ' t support the configuration of both a HTTP connector and an HTTPS connector via application.proper Ties. If you want to has both then you'll need to configure one of them programmatically. It ' s recommend
at the same priority location, the attributes inside the APPLICATION.YML will overwrite the attributes in the application.properties.profile-Multi-environment configurationWhen an application needs to be deployed to a different operating environment, some configuration details are usually different, the simplest of which is logging, which sets the log level to warn or higher, and writes the log to the log file, while development requires a log level
recommended to combine SPRING-JDBC to operate, write dynamic native SQL is easier to develop.Life cycle of JPA objects:New: Instantaneous object, no ID yet, and object associated with persistence context.Managed: Persisted managed object, with ID value, has already established an associated object with persistence context.Datached: A free-form offline object with an ID value, but no associated object with persistence context.Removed: deleted object w
, running and other cycles. Equivalent to compile, but the packaging phase did a exclude operation
System: In terms of engagement, the same as provided, but the dependencies are not downloaded from the Maven repository, but are taken from the local file system. You need to add Systempath properties to define the path
4. Writing Spring MVC Code
After the first 3 steps of configuration, the project configuration section has been com
Support Log framework: Java Util Logging, log4j2 and Logback, using Logback by defaultHow to configure: Default profile configuration and reference external configuration file configurationFirst, the default configuration file configuration (not recommended: not flexible, log4j2, etc. is not friendly)# log file name, for example: Roncoo.log, or/var/log/roncoo.logLogging.file=roncoo.log# Log level configurat
Spring Boot Controller
In the previous article, we have created a HellController in the HelloWorld program, which contains the JSON response method. This article will explain it to the Controller.
In the previous article, we used the @ RestController annotation in the Controller, which was introduced by Spring 4.0. View the source code to see that it contains the
not need to be introduced into the package,2. First, find your service implementation class, plus @Transactional annotations, if you add to the class, then all the methods of the class will be managed by the transaction, if you add to the method, then only the method conforms to the specific transaction. Of course, we are generally added to the method. Because only the increase, deletion and change will require business. For example, the following me
Resource Directory is classpath:/META-INF/resources/, classpath:/resources/, classpath:/static/, classpath: /public/
Note: This configuration overwrites the default static Resource Directory of Spring boot. For example, if it is configured in the example, you cannot access resources in the static, public, and resource
Friends who are just concerned, can review the first two articles:
Basic application Development
Distributed Application Development
The last article summarizes the second part of "in-depth practice spring Boot", which summarizes the third and final part of this article. This part mainly explains the core technology source code analysis, because the length and the ability reason, the analy
item in Spring.factories (the full path of the class) as the Spring boot configuration class
Spring Boot This concept of "convention over configuration" can greatly simplify the writing of configuration code. So, we can follow the above routines to write a Spring-
Spring boot testing and deployment method, springboot
Many netizens may ask me from time to time how to test the spring boot project, how to deploy the project, and whether there is any good Deployment Solution in production? This article introduces how to develop, debug, and package
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.