MyBatis-Plus is an enhancement tool of MyBatis. On the basis of MyBatis, only enhancements are made without changes, and it is born to simplify development and improve efficiency.
1. Pre-work
1. Introduce dependencies.
<!--mybatis-plus-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-p ...
Posted by petethepirate on Sat, 14 Jan 2023 05:38:08 +0300
User login function
First analyze the idea: when the user enters the user name and password to submit the data to the background database for query, if there is a corresponding user name and password, it means that the login is successful, and after successful login, it will jump to the home page of the system.
1. Login - persistence layer
P ...
Posted by Kulak on Thu, 22 Dec 2022 10:38:36 +0300
Structure diagram
The relationship between the core components of mybatis can be represented by the following diagram:
Among them, add "I" before the class name to indicate the interface
SqlSessionFactoryBuilder
As can be seen from the figure, in addition to Configuration, the class name of each class contains a "SqlSession ...
Posted by egmax on Mon, 07 Nov 2022 05:38:32 +0300
1. Slot
normal slot, named slot, scoped slot
Slots allow us to pass templates to child components when calling them.
The <slot> element acts as an outlet to carry distribution content. A <slot> outlet without a name would carry the implicit name "default".
Everything in the parent template is compiled in the paren ...
Posted by Cardale on Thu, 06 Oct 2022 11:51:55 +0300
3.4 Builder Mode
Definition: The Builder Pattern is also called the Builder Pattern. In actual development, when the objects we need are very complicated to construct, and there are many steps to be processed, the Builder Pattern is very suitable. For example, in the creation of the SqlSessionFactory object in MyBatis, we not only need to ...
Posted by magmazing on Tue, 04 Oct 2022 10:32:38 +0300
3 DI
3.1 setter injection of dependency injection
Note: Dependency injection is actually a process of assigning values to properties in the current bean; it is actually very simple to implement this process in Spring, you only need to create a sub-label property for the corresponding bean tag in the configuration file, and specify the n ...
Posted by the_NEWBIE_ON_THE_BLOCK on Mon, 03 Oct 2022 00:26:35 +0300
In general, HashMap traversal can be divided into the following four categories:
Iterator mode traversal;For Each traversal;Lambda expression traversal (JDK 1.8+);Streams API traversal (JDK 1.8+).
However, each type has different implementation methods, so the specific traversal methods can be divided into the following 7 types:
1. Use Itera ...
Posted by bookbuyer2000 on Mon, 19 Sep 2022 21:21:02 +0300
Step 1: run first, see the effect, and then learn Step 2: imitation and troubleshooting Step 3: many to one relationship Step 4: see the effect before learning Step 5: modify product java Step 6: product xml Step 7: mybatis config xml Step 8: Test mybatis Step 9: runnable projects Step 10: Exercise - modify the many to one relationship ...
Posted by M. Abdel-Ghani on Tue, 24 May 2022 13:15:21 +0300
1, Background
Spring and spring MVC have a parent-child container relationship, and it is precisely because of this that the problem of package scanning often occurs. Here we analyze and understand the parent-child container relationship between spring and spring MVC, and give the official recommended method of package scanning in spring and sp ...
Posted by piyushsharmajec on Tue, 24 May 2022 03:28:59 +0300
Step 1: run first, see the effect, and then learn Step 2: imitation and troubleshooting Step 3: one to many based on annotation Step 4: add log Step 5: only query the classification without obtaining products Step 6: add the configuration of delayed loading Step 7: only query the classification without obtaining products Step 8: you can ...
Posted by agriz on Mon, 23 May 2022 16:49:16 +0300