Read about microservices with spring boot part 2, The latest news, videos, and discussion topics about microservices with spring boot part 2 from alibabacloud.com
The Springboot project and the traditional Web project have a certain difference in the project structure or project deployment, because it is an external chapter, so the blogger will make a long story short.
The Spring boot project is typically a jar package that runs in three different ways: 1.main function
This method is generally suitable for use in local debugging situations
Spring Boot because of its1, easy to develop and maintain. 2, a single micro-service start fast. 3, local modification deployment is easy. 4, the technology stack is not subject to language restrictions and other advantages by more and more companies pay attention to. Spring-boot
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
Part II Spring3.0 new featuresNew features and enhancements in 2.spring3.0
If you have been using spring, you will know that spring has gone through two important editions: the Spring2.0 of October 2006 and the Spring2.5 of November 2007. Now, Spring3.0 is the third most important version.
(Java SE and Java EE support:
[emailprotected]The above program will parse the value of the name and email parameters into the records in the user table in the database and save the browser interface such as:
Enter the URL Localhost:8080/demo/all in the browser and just look at the records we inserted into MySQL (in JSON format):
Finally we went to MySQL to see if the data was inserted successfully, as shown in the following:
Conclusion?? This article describes how
I. What is Spring Boot
Takes an opinionated view of building Production-ready Spring applications. Spring Boot Favors convention over-configuration and is designed-to get-up and running as quickly as possible.
--Excerpt from official website
Translation: The
1.Adding the Maven DependencyAs mentioned above, we'll use the Springfox implementation of the Swagger specification. To add it to my Maven project, we need a dependency in the Pom.xml file.
Io.springfox
Springfox-swagger2
2.7.0
2.Integrating Swagger 2 into the Project
2.1.Java Configuration The configuration of Swagger mainly centers around the docket Bean.
Swagger
It 's written in front .
This demo demonstrates how to troubleshoot a common spring expected single matching bean but found 2 exception.
Https://github.com/hengyunabc/spring-boot-inside/tree/master/demo-expected-single Debugging Troubleshooting expected single Matching Bean but found
Directory
Springapplication instance Run method running procedure
Summarize
"Spring Boot 2.x start the whole process of source analysis (a) Import class analysis" We analyzed the Spring boot entry class Springapplication source code, and know its constructi
"Spring Boot 2.x start the whole process of source analysis (a) Import class analysis" We analyzed the Spring boot entry class Springapplication source code, and know its construction principle, this we continue to analyze its core run method.[TOC]Springapplication instance
Springboot Cache (EhCache 2.x) Springboot cacheIn spring boot, the @EnableCaching appropriate cache manager (CacheManager) is configured with annotation automation, and Spring boot detects the cache provider according to the following sequence:* Generic* Jcache (JSR-107)* Eh
springboot Cache (EhCache 2.x)
Springboot Cache
In spring boot, the appropriate cache manager (CacheManager) is configured with @enablecaching annotation automation, and Spring boot detects the cache provider according to the following sequence:* Generic* Jcache (JSR-107)*
The main contents of this section:1: Thinking question: How to read multiple configuration files, what if the file does not exist2: Configure the database connection poolStatement:This is the important note for the Spring boot framework to learn preschool (4)-Read the external resource Profile 2 by annotating the Edith with you learning Series-Framework Learning
Original: HTTPS://WWW.JIANSHU.COM/P/840B4F83C3B5At present, most of the program development is separated by front and rear platform. In this way, the cross-domain resource sharing cors problem will be encountered. Spring Boot 2 provides a good workaround for this.For more information about cors, please see here: cors Introduction1. Annotation implementationIn
Jedisconnectionfactory ();
}
@Bean public
redistemplate
After the configuration is completed, write the test case experiment effect@RunWith (Springjunit4classrunner.class)
@SpringApplicationConfiguration (application.class) Public
class applicationtests {
@Autowired
private redistemplate Of course the data operations provided in Spring-data-redis are much more than this, this article is only used as a configuration reference w
Spring Boot 2.x has been released for a long time, and now spring Cloud has released the Finchley version based on spring boot 2.x, and now it's time to do an overall framework upgrade
Jrebel Hot Deployment Plugin I believe a lot of people know, but this is a commercial plug-in, Spring-boot framework also provides a similar function, namely: Devtools, the key is free! Here's how to use it:First, add Devtools dependencydependencies { compile (' org.springframework.boot:spring-boot-starter-web ') compile (' Org.springframework.boot:spring-
Learn how to connect to the view layer by using idea to build spring boot in Java learning-11: Add Dependency package for view (Modify Pom.xml) Dependency > groupId >org.springframework.bootgroupId> Artifactid>spring-boot-starter-freemarkerartifactid> dependency>
Integer Getage () { return age; } public void Setage (Integer age) { This.age = age; }}Girlreposistory.javajparepository Search by age Public list}5. Create a new controller class and complete the annotations@RestController@RequestMapping (value = "/girls")public class Girlcontroller {@Autowired private girlreposistory girlreposistory;Get a list of girls@GetMapping (value = "/list")Public listReturnGirlreposistory.findall ();}Add a Girl@PostMapping (value = "/add
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.