打印/下载
简介
配置
运行

WebMIS( SpringBoot )

采用Java+SpringBoot开发,包括HMVC模块化管理、Token验证、Redis缓存

Demo

环境要求

  • Java、Maven、Redis、MariaDB

下载

git clone https://github.com/webmiss/base
  • WebMIS-Base > java

创建数据库

  • 数据库文件( project/数据库/data.sql )

配置文件( vip.webmis.java/Env.java )

package vip.webmis.java;

import java.util.HashMap;

/* 配置 */
public class Env {

  /* 资源 */
  public static final String base_url = "https://demo-api.webmis.vip/"; //根目录
  /* 加密 */
  public static final String key = "e4b99adec618e653400966be536c45f8";  //KEY
  /* Token */
  public static final String admin_token_prefix = "AdminToken_";  //前缀
  public static final int admin_token_time = 1*3600;  //有效时长
  public static final boolean admin_token_auto = true;  //自动续期
  public static final String api_token_prefix = "ApiToken_";  //前缀
  public static final int api_token_time = 7*24*3600;  //有效时长
  public static final boolean api_token_auto = true;  //自动续期

  /* 数据库 */
  public static HashMap<String,Object> db() {
    HashMap<String,Object> conf = new HashMap<String,Object>();
    conf.put("jdbc","mysql://121.37.10.103:3306/data?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai"); //类型
    conf.put("user","webmis");  //用户名
    conf.put("password","e4b99adec618e653400966be536c45f8");  //密码
    conf.put("driver","com.mysql.cj.jdbc.Driver");  //驱动
    conf.put("initialSize",1);  //初始连接数
    conf.put("maxActive",10);  //最大连接数
    return conf;
  }

  /* 缓存数据库 */
  public static HashMap<String,Object> redis() {
    HashMap<String,Object> conf = new HashMap<String,Object>();
    conf.put("host","127.0.0.1"); //主机
    conf.put("port",6379);  //端口
    conf.put("password","");  //密码
    conf.put("db",0); //硬盘
    return conf;
  }

}

VSCode( java/.vscode/launch.json )

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "java",
      "name": "Debug (Launch) - Current File",
      "request": "launch",
      "mainClass": "${file}"
    },
    {
      "type": "java",
      "name": "Debug (Launch)-JavaApplication<java>",
      "request": "launch",
      "mainClass": "vip.webmis.java.JavaApplication",
      "projectName": "java"
    }
  ]
}
  • 打开java目录,按F5运行
{{copy}}