Skip to content

Commit

Permalink
add support redis cache session sample (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomsun28 authored Apr 6, 2021
1 parent 5d03038 commit daa2ac4
Show file tree
Hide file tree
Showing 9 changed files with 861 additions and 0 deletions.
1 change: 1 addition & 0 deletions samples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
<module>quarkus-sureness</module>
<module>spring-webflux-sureness</module>
<module>sureness-session</module>
<module>sureness-redis-session</module>
</modules>
</project>
65 changes: 65 additions & 0 deletions samples/sureness-redis-session/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>sureness</artifactId>
<groupId>com.usthe.sureness</groupId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>sureness-redis-session</artifactId>

<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>com.usthe.sureness</groupId>
<artifactId>sureness-core</artifactId>
</dependency>
<!--test-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.1.4.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
267 changes: 267 additions & 0 deletions samples/sureness-redis-session/sample-session-postman.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,267 @@
{
"info": {
"_postman_id": "d85057b4-004a-4fc4-a9f2-7d791e826326",
"name": "sureness-sample-session",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "http://localhost:8088/api/v1/source1-basic auth",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "username",
"value": "tom",
"type": "string"
},
{
"key": "password",
"value": "32113",
"type": "string"
}
]
},
"method": "GET",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "http://localhost:8088/api/v1/source1",
"protocol": "http",
"host": [
"localhost"
],
"port": "8088",
"path": [
"api",
"v1",
"source1"
]
}
},
"response": []
},
{
"name": "http://localhost:8088/api/v1/source1-basic auth",
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "username",
"value": "tom",
"type": "string"
},
{
"key": "password",
"value": "32113",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "http://localhost:8088/api/v1/source1",
"protocol": "http",
"host": [
"localhost"
],
"port": "8088",
"path": [
"api",
"v1",
"source1"
]
}
},
"response": []
},
{
"name": "http://localhost:8088/api/v1/source1-basic auth",
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "username",
"value": "tom",
"type": "string"
},
{
"key": "password",
"value": "32113",
"type": "string"
}
]
},
"method": "PUT",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "http://localhost:8088/api/v1/source1",
"protocol": "http",
"host": [
"localhost"
],
"port": "8088",
"path": [
"api",
"v1",
"source1"
]
}
},
"response": []
},
{
"name": "http://localhost:8088/api/v1/source1-basic auth",
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "username",
"value": "tom",
"type": "string"
},
{
"key": "password",
"value": "32113",
"type": "string"
}
]
},
"method": "DELETE",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "http://localhost:8088/api/v1/source1",
"protocol": "http",
"host": [
"localhost"
],
"port": "8088",
"path": [
"api",
"v1",
"source1"
]
}
},
"response": []
},
{
"name": "http://localhost:8088/api/v1/source1-basic auth",
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "username",
"value": "tom",
"type": "string"
},
{
"key": "password",
"value": "32113",
"type": "string"
}
]
},
"method": "PATCH",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "http://localhost:8088/api/v1/source1",
"protocol": "http",
"host": [
"localhost"
],
"port": "8088",
"path": [
"api",
"v1",
"source1"
]
}
},
"response": []
}
],
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.usthe.sureness.sample.redis.session;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;

/**
* BOOT
* @author tomsun28
* @date 17:17 2019-05-12
*/
@SpringBootApplication
@ServletComponentScan
@EnableRedisHttpSession
public class RedisSessionApplication {

public static void main(String[] args) {
SpringApplication.run(RedisSessionApplication.class, args);
}
}
Loading

0 comments on commit daa2ac4

Please sign in to comment.