-
-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support redis cache session sample (#88)
- Loading branch information
Showing
9 changed files
with
861 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
267
samples/sureness-redis-session/sample-session-postman.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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": [ | ||
"" | ||
] | ||
} | ||
} | ||
] | ||
} |
21 changes: 21 additions & 0 deletions
21
...ession/src/main/java/com/usthe/sureness/sample/redis/session/RedisSessionApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
Oops, something went wrong.