Backend System of XOJ
- OpenJDK 1.8.0
- MySQL 8.0.28
- Elasticsearch 7.6.2
- Redis 5.0.7
- Apache Maven 3.6.3
- Spring Boot 2.4.12
- MyBatis 2.2.0
- Install the version compliant MySQL, Maven, Redis and Elasticsearch.
- Start MySQL service. Then cd to the Redis folder, run redis-server in the terminal to start Redis service.
- To deploy the Elasticsearch:
- Add the following configuration to the elasticsearch.yml in config directory of Elasticsearch:
cluster.name: xoj-elasticsearch node.name: node-1 cluster.initial master nodes: [”node-1”] http.cors.enabled: true http.cors.allow-origin: /.*/ node.master: true node.data: true network.host: 0.0.0.0
- Can change the following configuration in the jvm.options in config directory of Elasticsearch if you don’t have a lot of memory:
-Xms4G -Xmx4G
- Make a directory named ik in the plugins directory of Elasticsearch, and put ik-analysis in this directory.
- Start the Elasticsearch in bin directory (For linux systems, you need to start with a non-root user).
- To connect to the services of MySQL and Redis, modify the password in the
src/main/resources/application.yml
. - Find the file
src/main/java/com/xoj/backend/BackendApplication.java
, run it, then the backend service will run in port 8081.
- The product environment configuration the process of starting MySQL, Redis and Elasticsearch services are the same as the development environment.
- cd to the folder XOJ/Backend.
- run mvn clean package in the terminal to create jar file.
- run java -jar target/Backend-0.0.1-SNAPSHOT.jar to run the jar file.
sql
store database table structure
src/main/java/com/xoj/backend/aspect
permission control and cross domain support
src/main/java/com/xoj/backend/base
store response and session class
src/main/java/com/xoj/backend/common
store some common constants and enumerations
src/main/java/com/xoj/backend/component
schedule task
src/main/java/com/xoj/backend/config
store basic configurations
src/main/java/com/xoj/backend/controller
preparing a model Map with data, select a view name and complete the request
src/main/java/com/xoj/backend/dto
data transfer object passed into the controller layer
src/main/java/com/xoj/backend/entity
store all the entities
src/main/java/com/xoj/backend/exception
deal with the exception in business logic
src/main/java/com/xoj/backend/mapper
mapping the entities to the database tables
src/main/java/com/xoj/backend/model
object to respond the frontend
src/main/java/com/xoj/backend/notation
notations to control the authority of users
src/main/java/com/xoj/backend/param
objects for data modification
src/main/java/com/xoj/backend/service
implement the business logic
src/main/java/com/xoj/backend/util
some tool classes
src/main/java/com/xoj/backend/BackendApplication
entry of the project
src/main/resources
some configuration files (xml, yml files)
src/test
some test cases