This guide demonstrates how to integrate Spring Security into a Spring Boot application using Gradle, MySQL, and MyBatis. We will cover the essential configurations for authentication and authorization, including password encryption and role-based access control. Database Setup First, create a datab...
In database operations, we often need to retrieve auto-generated primary key values after inserting records. MyBatis provides two approaches to accomplish this: using the useGeneratedKeys attribute and the selectKey element. Using useGeneratedKeys Attribute The useGeneratedKeys attribute enables aut...
MyBatis Parameter Passing: Trensferring parameters from Java code to mapper.xml files. Single Simple Parameter When a DAO interface method contains only one simple parameter (Java primitive type or String), the placeholder #{any_text} can be used, and it is independent of the method's parameter name...
Introduction MyBatis serves as a persistence framework that simplifies database operations by eliminating repetitive tasks associated with traditional JDBC usage. It allows developers to focus more on business logic rather than boilerplate code, offering flexible SQL construction and result mapping...
Understanding design patterns theoretically often differs from observing their practical application in large-scale frameworks. While there are 23 standard patterns, developers frequently encounter them more clearly within mature source codebases like Mybatis. Analyzing these internals reveals how c...
Understanding Frameworks A framework is a reusable design structure that defines the architecture of an application, outlining dependencies, responsibilities, and control flow among components. It serves as a foundation upon which developers build applications, abstracting common functionalities to...
Core Concepts of MyBatis MyBatis is a persistence framework for Java that enables custom SQL, stored procedures, and advanced object-relational mapping. Unlike full ORM tools like Hibernate, it focuses on flexible SQL control through configuration and ennotations, bridging Java objects and database...
Maven Dependency Add the following dependency to your pom.xml file: <dependency> <groupId>tk.mybatis</groupId> <artifactId>mapper-spring-boot-starter</artifactId> <version>2.1.5</version> </dependency> Defining Mapper Interfaces Create mapper interface...
Technology Stack Backend with Spring Boot Spring Boot simplifies application development by offering auto-configuration and embedded server support. Below is an example of a minimal REST controller implementation: import org.springframework.boot.SpringApplication; import org.springframework.boot.aut...
Introduction to MyBatis Generator MyBatis Generator (MBG), also referred to as MyBatis reverse engineering, is a specialized code generator designed for MyBatis framework users. It can rapidly generate corresponding mapping files, interfaces, and bean classes based on database tables. While it suppo...