Jkevin's Technical Notes and Project Documentation

website·Indexed 30 days ago

https://jkevin-5.github.io/

A collection of technical learning records and project documentation covering Spring Boot, Spring AOP, Spring Cloud Alibaba, Vue 2, VueRouter, JavaScript (Red Book), Linux shell commands, Docker Compose, and Node.js. Includes project case studies such as an Inbox Management System, Attachment Management Center (AMS), and QMS Management System.

Tokens
11.1K
Snippets
62
Records
86
Agent score
75%

What's inside Jkevin's Blog

  1. Overview of Spring Framework ecosystem versions

    The Spring ecosystem consists of several key projects designed to simplify Java application development:

    • Spring: A layered, lightweight open-source framework. Major versions include 1.0 (2004), 2.0 (2006), 3.0 (2009), 4.0 (2013), and 5.0 (2017).
    • Spring MVC: A web framework used as an alternative to servlets, evolving from early Struts integrations.
    • Spring Boot: Designed to simplify the creation, running, debugging, and deployment of Spring applications. Version 2.7 was the final 2.x release; version 3.0 was released around November 2022.
    • Spring Cloud: Provides patterns for distributed systems, primarily split into Netflix and Alibaba implementation standards.
  2. Overview of JavaScript reference types

    In JavaScript, a reference value (or object) is an instance of a specific reference type. New objects are created using the new operator followed by a constructor function. Functions are also a type of reference type.
  3. Overview of Spring Cloud Alibaba Components

    Spring Cloud Alibaba is a set of components designed to integrate Alibaba's cloud-native capabilities into the Spring Cloud ecosystem. The core components include:

    • Nacos: Serves as a service discovery and configuration center, acting as an alternative to Zookeeper and Eureka.
    • Dubbo: A high-performance, lightweight RPC (Remote Procedure Call) framework.
    • RocketMQ: A distributed messaging middleware for asynchronous communication.
    • Sentinel: Provides traffic flow control, circuit breaking, and degradation to protect services from overload.
    • Seata: Manages distributed transactions across multiple microservices.
    • Alibaba-cloud: Provides integration and support for the majority of Alibaba Cloud services.
    • Spring Cloud Gateway: Acts as the API gateway for microservices.
    • Spring Cloud OAuth2: Provides components for OAuth2 authentication and authorization.
  4. Understand Spring AOP concepts

    Spring AOP (Aspect-Oriented Programming) allows developers to modularize 'cross-cutting concerns'—functionality that spans multiple classes but is not part of the core business logic, such as logging, performance monitoring, and transaction management. By separating these concerns into 'Aspects', you can add behavior to target objects without modifying their original source code. Spring AOP implements this using dynamic proxies: JDK dynamic proxies for classes implementing interfaces, and CGLIB proxies for classes without interfaces.
  5. Install Docker Compose manually on Linux

    To install Docker Compose manually, download the appropriate binary for your architecture from the official GitHub releases page, move it to the /usr/local/bin directory, and grant it execution permissions.
    # Move the downloaded binary to /usr/local/bin
    mv /path/to/downloaded/docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
    
    # Grant execution permissions
    chmod +x /usr/local/bin/docker-compose
    chmod 755 /usr/local/bin/docker-compose
    
    # Verify installation
    docker-compose -version
  6. Integrate the inbox system as a plugin using AOP

    The inbox system can be integrated into other systems using a plugin architecture (Factory and Configuration patterns). Use Aspect-Oriented Programming (AOP) with custom annotations to trigger the generation of inbox messages, allowing objects to be passed via the annotation. For data storage, use JSONB fields to ensure compatibility across different systems regardless of the database dialect.
  7. Understand ES6 Module characteristics

    ES6 modules provide a standardized way to organize code. Key characteristics include:

    • Modules are singletons and execute only once after loading.
    • They support public interfaces for interaction and can request other modules.
    • Circular dependencies are supported.
    • Modules execute in strict mode by default.
    • They do not share the global namespace; the top-level this is undefined (unlike regular scripts where it is window).
    • var declarations at the top level of a module are not added to the window object.
    • Modules are loaded and executed asynchronously.
  8. Install Docker Compose using curl from GitHub

    You can install Docker Compose directly on your server by pulling the binary from GitHub using curl. This method automatically detects the system architecture using uname -s and uname -m.
    # Download the binary (example version 1.27.4) to /usr/local/bin
    curl -L https://github.com/docker/compose/releases/download/1.27.4/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
    
    # Grant execution permissions
    chmod +x /usr/local/bin/docker-compose
  9. Use CommonJS modules in Node.js

    CommonJS is the standard for Node.js. It uses require() to import dependencies and module.exports to define the public API. Modules are singletons; they are cached after the first time they are required.
    // moduleA.js
    module.exports = { a: 'A', b: 'B' };
    
    // main.js
    var moduleA = require('./moduleA');
    console.log(moduleA.a); // 'A'
  10. Implement backward compatibility for ES6 modules in HTML

    To support both modern browsers (that support ES6 modules) and legacy browsers, use the type="module" and nomodule attributes.

    • type="module": Executed only by browsers that support modules.
    • nomodule: Executed only by browsers that do NOT support modules.
    <!-- Modern browsers execute this -->
    <script type="module" src="module.js"></script>
    
    <!-- Legacy browsers execute this, modern browsers ignore it -->
    <script nomodule src="script.js"></script>
  11. Deploy MinIO with Disaster Recovery using Docker Compose

    Deploy a MinIO cluster with four server instances and an Nginx load balancer to ensure data redundancy and high availability. Data is replicated across four separate data paths to prevent loss if a node fails.
    version: '3.7'
    
    x-minio-common: &minio-common
      image: minio/minio
      command: server --console-address ":9001" http://minio{1...4}/data
      expose:
        - "9000"
      healthcheck:
        test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
        interval: 30s
        timeout: 20s
        retries: 3
    
    services:
      minio1:
        <<: *minio-common
        hostname: minio1
        ports:
          - "9001:9001"
        volumes:
          - ./data/data1:/data
    
      minio2:
        <<: *minio-common
        hostname: minio2
        ports:
          - "9002:9001"
        volumes:
          - ./data/data2:/data
    
      minio3:
        <<: *minio-common
        hostname: minio3
        ports:
          - "9003:9001"
        volumes:
          - ./data/data3:/data
    
      minio4:
        <<: *minio-common
        hostname: minio4
        ports:
          - "9004:9001"
        volumes:
          - ./data/data4:/data
    
      nginx:
        image: nginx:latest
        hostname: nginx
        volumes:
          - ./config/nginx.conf:/etc/nginx/nginx.conf:ro
        ports:
          - "9000:9000"
        depends_on:
          - minio1
          - minio2
          - minio3
          - minio4