Haipeng Lin Backend Development Notes

website·Indexed 31 days ago

https://blog.haipeng-lin.cn

A comprehensive collection of backend development notes covering Java (JDK 8 to 17), Go, and SpringMVC. It includes detailed guides on databases (MySQL, Redis, MongoDB, Elasticsearch), message queues (RabbitMQ, RocketMQ), ORM frameworks (MyBatis, MyBatis-Plus), and infrastructure tools like Kubernetes (K8s), Canal, and Loki+Grafana.

Tokens
146.5K
Snippets
561
Records
804
Agent score
55%

What's inside Haipeng Lin Backend Blog

  1. Overview of MyBatis ORM Framework

    MyBatis is a semi-automatic Object-Relational Mapping (ORM) framework that maps Java entity classes to database records. Unlike fully automatic frameworks (like Hibernate), MyBatis allows for customized SQL and stored procedures, providing a clear separation between Java business logic and SQL data access. It encapsulates most JDBC boilerplate code, including parameter setting and result set retrieval.
  2. Overview of Alibaba Canal

    Canal is a component based on MySQL database incremental log parsing. It provides incremental data subscription and consumption, allowing data changes to be delivered to downstream consumers (such as Kafka, RocketMQ) or storage systems (such as Elasticsearch, HBase). Essentially, Canal detects MySQL data changes, parses them, and sends them to a message queue or another database for further business processing.
  3. Overview of AgentScope Java Tooling Concepts

    AgentScope Java utilizes three core concepts to manage capabilities exposed to an AI model:

    1. Tool: An object that implements the AgentTool interface (typically by extending ToolBase) or a method in a standard class marked with the @Tool annotation (referred to as a reflective function tool).
    2. Toolkit: A container responsible for registering tools, MCP (Model Context Protocol) clients, and skills. It exposes their JSON schemas to the model and dispatches tool calls to the appropriate tool object.
    3. Tool Group: A named collection of tools, MCPs, or skills that can be activated or deactivated as a unit. Agents can switch groups at runtime using a built-in meta tool to maintain context focus.
  4. Overview of Redis Persistence Methods

    Redis provides two primary methods for persisting data to disk:

    1. RDB (Redis DataBase): A point-in-time full backup of the dataset stored as a compact binary serialization file (dump.rdb).
    2. AOF (Append Only File): A continuous incremental backup that records every write operation executed by the server as text logs (appendonly.aof).

    If both are enabled, Redis will prioritize loading the AOF file upon restart because it typically contains a more complete dataset.

  5. Overview of Claude Code

    Claude Code is a command-line interface (CLI) coding assistant developed by Anthropic. Unlike a standard chatbot, it acts as an AI pair programmer with operational permissions, allowing it to read local codebases, write files, run terminal commands, execute tests, and manage Git commits and pull requests.
  6. Overview of Java ArrayList implementation

    ArrayList is a dynamic array implementation of the List interface. Unlike standard Java arrays, its capacity can grow dynamically. To minimize the number of incremental reallocations when adding a large number of elements, the ensureCapacity method can be used to increase the instance capacity manually. It extends AbstractList and implements several key interfaces: List (standard list operations), RandomAccess (indicates support for fast random access via index), Cloneable (supports copying), and Serializable (allows conversion to byte streams for storage or transmission).
    public class ArrayList<E> extends AbstractList<E>
            implements List<E>, RandomAccess, Cloneable, java.io.Serializable {
    }
  7. Overview of Chat Memory in Spring AI Alibaba

    Chat Memory allows Large Language Models (LLMs) to 'remember' previous interactions by storing and retrieving historical conversation messages. This enables context-aware multi-turn dialogues. Its core functions include:

    1. Storing History: Automatically saving user messages and model responses after each interaction.
    2. Retrieving History: Automatically retrieving historical messages and injecting them into the current prompt before a request is sent.
    3. Session Isolation: Using a conversationId to distinguish between different users, ensuring memories remain independent.
  8. Overview of MyBatis-Plus features

    MyBatis-Plus (MP) is an enhancement tool for MyBatis that provides a non-invasive way to simplify development and increase efficiency without changing the core MyBatis functionality. Key features include:

    • Automatic CRUD: Built-in generic Mapper and Service for single-table operations.
    • Lambda Support: Use Lambda expressions for query conditions to avoid hardcoded field names.
    • Primary Key Generation: Supports 4 primary key strategies, including a distributed unique ID generator (Sequence).
    • ActiveRecord Pattern: Entities can inherit from the Model class to perform CRUD operations directly.
    • Pagination Plugin: Physical pagination support for multiple databases (MySQL, Oracle, PostgreSQL, SQLServer, etc.).
    • Code Generator: Quickly generate Mapper, Model, Service, and Controller layers via Maven plugins or code.
  9. Overview of AbstractQueuedSynchronizer (AQS)

    AbstractQueuedSynchronizer (AQS) is a base framework used to implement locks and synchronizers in Java (introduced in JDK 5). It provides the foundation for high-level concurrency utilities such as ReentrantLock, ReentrantReadWriteLock, Semaphore, and CountDownLatch. AQS manages synchronization between threads using a volatile int state variable and a FIFO wait queue. It supports two primary modes of resource acquisition: SHARED and EXCLUSIVE.
  10. Overview of Java 8 Key Features

    Java 8 introduced several foundational changes to the language:

    • Lambda Expressions: Allows passing functions as method arguments.
    • Stream API (java.util.stream): Enables functional-style operations on sequences of elements.
    • Method References: Compact syntax to refer to existing methods or constructors.
    • Date Time API: Improved handling of dates and times.
    • Optional Class: A container object used to reduce NullPointerException risks.
  11. Overview of Go Concurrency primitives

    Go implements concurrency through three primary components:

    • Goroutines: Lightweight execution units (similar to threads) that are non-blocking and allow thousands of concurrent tasks without manual thread allocation.
    • Channels: Mechanisms for data transfer between Goroutines, supporting synchronization and data sharing without explicit locks.
    • Scheduler: Manages the distribution of Goroutines to system threads using the GMP model (Goroutine, Machine, Processor).