Building an Online Novel Reading Platform with Spring Boot and Vue.js
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>