Code Monkey home page Code Monkey logo

studentscoremanagementsystem_springboot_distrbuted's Introduction

SpringBoot+Redis+Consul:实现学生成绩管理系统 分布式+邮箱功能

简介







本文基于SpringBoot2+Redis+Consul(+MyBatisPlus+Thymeleaf+Echarts) 实现一个分布式的学生成绩管理系统。它在上一SpringBoot+MyBatisPlus+Redis+Thymeleaf+Echarts版本基础上吸收分布式架构**,将项目拆分为多个模块,使整个项目易于扩展和维护。

任务


相关工作

本项目基于以上项目进行改进。主要内容有:

  • 应用SpringCloud H+SpringBoot2 目前主流的开发框架
  • 项目原有部分拆分为公共模块、用户模块和学生模块三个模块部署
  • 使用自带图形界面的Consul作为服务注册中心
  • 使用Redis实现不同端口的Session共享
  • 增加邮箱模块,实现向指定邮箱发送学生成绩统计信息
  • 增加未登录或登录过期页面

更新日志(已经在github上更新)

  • 暂无

项目结构

这是一个maven工程,具有4个子模块,都是maven项目。


注册中心

使用Consul作为注册中心管理不同服务的状态

        <!--Consul注册中心-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-consul-discovery</artifactId>
            <version>3.0.3</version>
        </dependency>


数据库

使用MySQL实现,和上一版本一致。

USE student_score_ssm;

CREATE TABLE student_score(
	id INT PRIMARY KEY AUTO_INCREMENT,
	NO VARCHAR(10) UNIQUE NOT NULL,
	NAME VARCHAR(20) NOT NULL,
	score FLOAT(20),
	class_name INT
);


CREATE TABLE USER(
	id INT PRIMARY KEY AUTO_INCREMENT,
	username VARCHAR(20) UNIQUE,
	PASSWORD VARCHAR(20) NOT NULL,
	email VARCHAR(20)
);

邮箱功能

使用javax.mail实现发送信息给指定邮箱功能

        <!--邮箱-->
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.5.0-b01</version>
        </dependency>

邮箱模块自测:


Session共享

        <!--redis-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.session</groupId>
            <artifactId>spring-session-data-redis</artifactId>
        </dependency>

Redis实现Session共享:实现用户模块的Session共享到其它模块,避免公共模块的拦截器拦截不同模块之间的正常调用. 自测:两个模块分别为8080和8081端口,使用8081可以访问8080端口的session.

参考:https://codeload.github.com/2010yhh/springBoot-demos/zip/refs/heads/master


增加未登录界面


其他页面见SpringBoot+MyBatisPlus+Redis+Thymeleaf+Echarts版本

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.