Component injection in container
@Configuration+@Bean
Front
Create User and Pet classes
public class User {
private String name;
private Integer age;
public User(){
}
public User(String name, Integer age) {
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public void setName(String n ...
Added by brandon99999 on Fri, 19 Nov 2021 16:31:29 +0200
Springboot +AOP logging system
1. Foreword
A good arrangement and division of log information can enable us to better locate the wrong place. If we use the debugger breakpoint mechanism to reproduce the problem, locate the problem and solve the problem. Most of the time, we do this when we encounter a bug that is difficult to locate. If it is an ordinary bug, we believe t ...
Added by jck on Fri, 19 Nov 2021 09:10:49 +0200
Learn Spring Boot: using Docker in Spring Boot
preface
Simply learn how to use Docker to build and publish an image in Spring Boot. Now we build an image, run a container, publish an image and so on through the remote docker api.
Only two methods are introduced here:
Remote command api (need to know Docker command)maven plug-in (you don't need to know the Docker command)
Enable Docker a ...
Added by Ken2k7 on Thu, 18 Nov 2021 17:25:35 +0200
SpringBoot global configuration file
We can define the relevant properties of the Spring Boot project in the application.properties file. Of course, these related properties can be system properties, environment variables, command parameters and other information, or the name and location of the custom configuration file. Next, we will demonstrate a cu ...
Added by january_9th on Thu, 18 Nov 2021 17:01:51 +0200
Paging plug-in Pagehelper is used for paging in SSM framework
catalogue
1. Import jar package
2. In mybatis_ Import the paging plug-in in the config.xml file
3. Write mapper interface and mapper.xml
4. Write service layer
5. Writing test classes
6. Write Controller
7. Write the front-end interface to turn pages
8. The corresponding location of the view parser and the web directory
1. Import jar ...
Added by webweever on Thu, 18 Nov 2021 13:18:13 +0200
Springboot 2 -- indicator monitoring
SpringBoot provides us with indicator monitoring. After each micro service is deployed on the cloud in the future, we need to monitor, track, audit and control it. SpringBoot extracts the actor scenario, so that we can quickly reference each micro service to obtain production level application monitoring, audit and other functions
For detailed ...
Added by Kingkerry on Thu, 18 Nov 2021 05:00:35 +0200
Spring(SpringBoot) -- transaction propagation mechanism -- Application / instance / detailed explanation
Original website:
brief introduction
This paper introduces the transaction propagation mechanism in Spring, and illustrates its usage with an example.
This content is also a common question in Java back-end interview.
summary
Spring specifies seven types ...
Added by kyberfabrikken on Wed, 17 Nov 2021 14:20:46 +0200
Zero base spring boot day 8
brief introduction
Today, we mainly learn about global unified exception handling
step
try catch is often used in Web applications, which will lead to the feeling of disordered code structure and is not conducive to debugging code. It will be a good thing if all exceptions can be unified into one module. Then @ ControllerAdvice and @ Excepti ...
Added by robtbs on Wed, 17 Nov 2021 12:43:53 +0200
Spring Boot and multiple data sources
catalogue
preface The purpose of writing this article What are multiple data sources? When to use multiple data sources? Consolidate a single data source Integrate Mybatis How to integrate multiple data sources?
What is a dynamic data source? How does data source switching ensure thread isolation? How to construct a dynamic data s ...
Added by 44justin on Wed, 17 Nov 2021 03:46:55 +0200
SpringBoot -- JUnit 5 for unit testing
Article directory:
1. Changes in JUnit 5
2. JUnit 5 common notes and tests
2.1 @DisplayName,@Disabled,@BeforeEach,@AfterEach,@BeforeAll,@AfterAll
2.2 @Timeout
2.3 @RepeatedTest
3. Assertion
3.1 simple assertion
3.2 array assertion
3.3 combined assertions
3.4 exception assertion
3.5 timeout assertion
3.6 rapid failure
4. Preconditio ...
Added by Tucker1337 on Fri, 12 Nov 2021 11:25:08 +0200