Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Building an Online Novel Reading Platform with Spring Boot and Vue.js

Tech 1

System Architecture Overview

The backend of the platform is built using the Spring Boot frameowrk, which simplifies configuration and setup for production-ready applications. Spring Boot promotes convention over configuration, reducing boilerplate setup through sansible defaults and embedded servers like Tomcat.

Vue.js serves as the front end framework, providing a component-based architecture for building interactive user interfaces. Its reactive data binding and virtual DOM implementation optimize rendering performance and enhance developer productivity.

MySQL is used as the relational database management system, offering reliable data storage with support for SQL standards and multiple storage engines such as InnoDB and MyISAM.

Configuration Example

server:
  port: 8080
  servlet:
    context-path: /novelplatform
  tomcat:
    uri-encoding: UTF-8

spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/novelplatform?useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
    username: admin
    password: secret
  servlet:
    multipart:
      max-file-size: 300MB
      max-request-size: 300MB
  resources:
    static-locations: classpath:static/,file:static/

mybatis-plus:
  mapper-locations: classpath*:mappers/*.xml
  type-aliases-package: app.model
  global-config:
    id-type: 1
    field-strategy: 1
    db-column-underline: true
    refresh-mapper: true
    logic-delete-value: -1
    logic-not-delete-value: 0
  configuration:
    map-underscore-to-camel-case: true
    cache-enabled: false
    call-setters-on-nulls: true
    jdbc-type-for-null: 'null'

Data Access Layer Sample

<?xml version="1.0" encoding="UTF-8"?>
<mapper namespace="app.repository.ReaderMapper">

    <resultMap id="readerMap" type="app.model.Reader">
        <id property="id" column="reader_id"/>
        <result property="username" column="username"/>
        <result property="email" column="email"/>
        <result property="registrationDate" column="registration_date"/>
    </resultMap>

    <select id="findReaders" resultType="app.model.Reader">
        SELECT * FROM readers
        <where>
            <if test="username != null">AND username LIKE CONCAT('%', #{username}, '%')</if>
        </where>
    </select>

    <select id="getReaderById" resultMap="readerMap">
        SELECT reader_id, username, email, registration_date FROM readers WHERE reader_id = #{id}
    </select>

</mapper>
Tags: Spring Boot

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.