Sloving Knowledge Base
website·Indexed 31 days ago
https://sloving.top/A personal knowledge base featuring technical guides on Java development (Spring, Spring Boot, SpringMVC, MyBatis, SSM framework), LeetCode algorithm solutions, and articles on personal finance, asset allocation, and life reflections.
What's inside Sloving
- The SSM framework is a lightweight and flexible JavaWeb development stack consisting of Spring, SpringMVC, and MyBatis. It is designed to simplify the development process, improve efficiency, and provide a stable, secure foundation for web projects, particularly those with simple data sources. It serves as a modern alternative to the older SSH (Struts+Spring+Hibernate) stack.
Overview of Linux and its common distributions
Linux is a free, open-source, Unix-like operating system based on POSIX. It is a multi-user, multi-tasking system supporting multiple threads and CPUs, designed with a network-centric architecture. It is widely used in server environments and development. Common distributions (which bundle the Linux kernel with application software) include Ubuntu, RedHat, CentOS, Debian, Fedora, SuSE, OpenSUSE, Arch Linux, and SolusOS. Kali Linux is specifically noted for its use in security penetration testing.Overview of Elasticsearch and the ELK Stack
Elasticsearch is an open-source distributed search engine used for full-text search, log statistics, analysis, and system monitoring. It is the core of the Elastic Stack (ELK), which consists of Elasticsearch (storage, search, and analysis), Logstash (data processing), Kibana (visualization), and Beats (lightweight data shippers). Unlike its underlying library Lucene, Elasticsearch provides a RESTful API and supports horizontal scaling for distributed environments.Overview of MyBatis Dynamic SQL
Dynamic SQL in MyBatis allows the generation of different SQL statements based on varying query conditions. This eliminates the need for manual string concatenation in Java, which is error-prone due to spacing and comma management. MyBatis uses OGNL expressions to evaluate conditions within XML tags.Overview of Spring Boot Testing Strategies
Spring Boot Test provides three primary testing categories based on the scope and isolation of the test:
- Unit Testing: Focuses on individual methods. High cost to implement for every method; best suited for complex logic with few external dependencies. Uses
@Test. - Slice Testing: Targets boundary functions that are difficult to test in isolation. Sits between unit and functional testing. Uses annotations like
@WebMvcTest. - Functional Testing: Focuses on complete business features (e.g., a Controller or public Service) within a single JVM, mocking most external dependencies. This is the recommended approach for core business logic. Uses
@SpringBootTest.
- Unit Testing: Focuses on individual methods. High cost to implement for every method; best suited for complex logic with few external dependencies. Uses
Overview of the Java Collections Framework
The Java Collections Framework is located in the
java.utilpackage. It is rooted in two primary interfaces:CollectionandMap.- Collection: A group of objects that can allow duplicates. It branches into
ListandSet. - Map: A mapping of key-value pairs. It is distinct from the
Collectioninterface and does not inherit from it.
Key categories:
- List: Ordered collections that allow duplicate elements and support index-based access.
- Set: Unordered collections that prohibit duplicate elements.
- Map: Key-value pairs where values are accessed via their unique keys.
- Collection: A group of objects that can allow duplicates. It branches into
Overview of the Spring Framework
Spring is a lightweight, open-source Java framework designed as a one-stop (full-stack) solution for enterprise application development. It focuses on reducing the complexity of J2EE development by providing a thin wrapper around difficult Java EE APIs (such as JDBC and Java Mail) and integrating seamlessly with other frameworks like MyBatis, Hibernate, and Quartz. Its core architecture is built upon Inversion of Control (IoC) and Aspect-Oriented Programming (AOP).Overview of HttpServletRequest and HttpServletResponse
In Java Servlet development,
HttpServletRequestandHttpServletResponseare used to handle the communication between the client (browser) and the server (e.g., Tomcat).- HttpServletRequest: Used to retrieve data sent by the client. Tomcat parses the incoming HTTP request (request line, headers, and body) and encapsulates it into this object.
- HttpServletResponse: Used to define the data the server sends back to the client. The developer populates this object, and Tomcat converts it into a valid HTTP response format (status line, headers, and body).
@WebServlet("/demo3") public class ServletDemo3 extends HttpServlet { @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Retrieve data from request String name = request.getParameter("name"); // Set response data response.setHeader("content-type", "text/html;charset=utf-8"); response.getWriter().write("<h1">" + name + ", welcome!</h1>"); } }Overview of Redis and NoSQL characteristics
Redis is an open-source, memory-based, key-value store written in ANSI C that supports multiple data structures, networking, and optional persistence. It is a prominent example of NoSQL (Not Only SQL) databases, which are designed to overcome the I/O bottlenecks of relational databases (RDBMS) in high-concurrency environments.
Key characteristics of NoSQL databases include:
- Scalability: Easy to extend and decouple as data lacks rigid relational constraints.
- High Performance: Capable of handling massive data volumes with low latency (e.g., Redis can perform ~80k writes and ~110k reads per second).
- Schema Flexibility: Supports diverse data types (Key-Value, Document, Column, Graph) without requiring predefined schemas.
- Availability: Focuses on high availability and eventual consistency (often guided by CAP theorem and BASE theory).
Overview of Nginx core concepts and use cases
Nginx is a high-performance HTTP and reverse proxy web server designed for high concurrency and low memory footprint. It is commonly used for:
- Static Resource Serving: Providing files directly from the local file system.
- Reverse Proxying: Acting as an intermediary to forward requests to internal servers, which enables hiding real server IPs, load balancing, and static/dynamic separation.
- Load Balancing: Distributing incoming traffic across a cluster of servers to prevent any single server from becoming a bottleneck. Supported strategies include:
- Round Robin: Default strategy; requests are distributed sequentially.
- Least Connections: Requests are sent to the server with the fewest active connections.
- Fastest Response Time: Requests are sent to the server with the lowest response time.
- IP Hash (Client IP Binding): Requests from the same IP are always routed to the same server, solving session sharing issues.
- Static/Dynamic Separation: Separating static content (served directly by Nginx) from dynamic content (proxied to a backend application), improving system robustness and access speed.
Overview of Java Deque Interface
TheDeque(Double-Ended Queue) interface in thejava.utilpackage is a subtype ofQueue. It supports element insertion and removal from both the head and the tail, allowing it to function as both a Stack (LIFO - Last-In-First-Out) and a Queue (FIFO - First-In-First-Out). Due to design flaws in the legacyStackclass (such as inefficient synchronization and exposure ofVectormethods), the official recommendation is to useDequeinstead ofStack.Overview of Spring Boot and its core philosophy
Spring Boot is a lightweight open-source framework built on top of Spring 4.0. It is not a replacement for Spring, but a tool to improve the developer experience by simplifying the setup and development process. Its core philosophy is "Convention over Configuration," providing default settings that allow developers to build applications quickly with minimal manual configuration. It integrates numerous third-party libraries (e.g., Redis, MongoDB, JPA, RabbitMQ, Quartz) to provide an "out-of-the-box" experience.