mirror of
https://gitee.com/dromara/sa-token.git
synced 2025-07-16 07:59:48 +08:00
修正 solon 相关 demo 案例
This commit is contained in:
parent
1850130e11
commit
1c05958d51
@ -2,8 +2,6 @@ package com.pj;
|
||||
|
||||
|
||||
import cn.dev33.satoken.SaManager;
|
||||
import cn.dev33.satoken.session.SaSession;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import org.noear.solon.Solon;
|
||||
import org.noear.solon.annotation.SolonMain;
|
||||
|
||||
@ -18,13 +16,5 @@ public class SaTokenDemoApp {
|
||||
public static void main(String[] args) {
|
||||
Solon.start(SaTokenDemoApp.class, args);
|
||||
System.out.println("\n启动成功:Sa-Token配置如下:" + SaManager.getConfig());
|
||||
|
||||
SaSession session = StpUtil.getSessionByLoginId(10001);
|
||||
session.set("name", "zhang");
|
||||
session.set("user", new SysUser(10001, "张三"));
|
||||
|
||||
session = StpUtil.getSessionByLoginId(10001);
|
||||
System.out.println(session.get("name"));
|
||||
System.out.println(session.get("user"));
|
||||
}
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
package com.pj;
|
||||
|
||||
/**
|
||||
* @author click33
|
||||
* @since 2024/5/11
|
||||
*/
|
||||
public class SysUser {
|
||||
|
||||
public int id;
|
||||
|
||||
public String name;
|
||||
|
||||
public SysUser() {
|
||||
}
|
||||
public SysUser(int id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取
|
||||
*
|
||||
* @return id
|
||||
*/
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取
|
||||
*
|
||||
* @return name
|
||||
*/
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SysUser{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -23,7 +23,7 @@ sa-token:
|
||||
sa-token-dao: #名字可以随意取
|
||||
redis:
|
||||
server: "localhost:6379"
|
||||
password: 123456
|
||||
# password: 123456
|
||||
db: 1
|
||||
maxTotal: 200
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user