spring-embedded-redis-server

A tiny redis embedded server fully integrated with Spring and Spring Boot, Only for testing or debugging.

License

License

Categories

Categories

Redis Data Databases
GroupId

GroupId

com.github.caryyu
ArtifactId

ArtifactId

spring-embedded-redis-server
Last Version

Last Version

1.1
Release Date

Release Date

Type

Type

jar
Description

Description

spring-embedded-redis-server
A tiny redis embedded server fully integrated with Spring and Spring Boot, Only for testing or debugging.
Project URL

Project URL

https://github.com/caryyu/spring-embedded-redis-server
Source Code Management

Source Code Management

https://github.com/caryyu/spring-embedded-redis-server

Download spring-embedded-redis-server

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.caryyu/spring-embedded-redis-server/ -->
<dependency>
    <groupId>com.github.caryyu</groupId>
    <artifactId>spring-embedded-redis-server</artifactId>
    <version>1.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.caryyu/spring-embedded-redis-server/
implementation 'com.github.caryyu:spring-embedded-redis-server:1.1'
// https://jarcasting.com/artifacts/com.github.caryyu/spring-embedded-redis-server/
implementation ("com.github.caryyu:spring-embedded-redis-server:1.1")
'com.github.caryyu:spring-embedded-redis-server:jar:1.1'
<dependency org="com.github.caryyu" name="spring-embedded-redis-server" rev="1.1">
  <artifact name="spring-embedded-redis-server" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.caryyu', module='spring-embedded-redis-server', version='1.1')
)
libraryDependencies += "com.github.caryyu" % "spring-embedded-redis-server" % "1.1"
[com.github.caryyu/spring-embedded-redis-server "1.1"]

Dependencies

compile (2)

Group / Artifact Type Version
org.springframework : spring-context jar 3.1.0.RELEASE
com.github.kstyrc : embedded-redis jar 0.6

Project Modules

There are no modules declared in this project.

spring-embedded-redis-server

A tiny redis embedded server fully integrated with Spring and Spring Boot, Only for testing or debugging.

version required

  • Spring 3.1 +
  • JDK 1.6 +

local installation

Note: this step is optional, Can be able to fetch the dependencies directly from Central.

git clone https://github.com/caryyu/spring-embedded-redis-server
mvn install

maven dependencies

<dependency>
    <groupId>com.github.caryyu</groupId>
    <artifactId>spring-embedded-redis-server</artifactId>
    <version>1.0</version>
</dependency>

spring configuration

We can pass the configuration as the following

Note: we just only need to choose one of following three ones to pass.

component scan

the package of com.github.caryyu is must.

<context:component-scan base-package="com.github.caryyu,xxxx" />

modify spring-context.xml file

the xml filename based on your real situation.

<beans:bean class="com.github.caryyu.spring.embedded.redisserver.RedisServerConfiguration" id="redisServerConfiguration" />

spring boot annotation

@Bean
public RedisServerConfiguration redisServerConfiguration(){
    return new RedisServerConfiguration();
}

usage

Here's two core variables to use.

  • global.redis.port - this is the embedded port for server listening.
  • global.redis.embedded - this is the switch to check whether or not it is ON/OFF.

Actually , we have lots of ways to use this library, ofcourse i really recommend you according to Spring official Environment Variables,so i just give some usages below.

jvm environment variables

using for JavaSE

java -Dspring.redis.embedded=true

using under Tomcat

we need to modify catalina.sh or catalina.bat or add new file that can name setenv.sh etc.

set JAVA_OPTS="-Dspring.redis.embedded=true"

application.properties

spring.redis.port=6379
spring.redis.embedded=true    

application.yml

spring:
  redis:
    port: 6379
    embedded: true

Contribution

All Contributions are welcomed.

Versions

Version
1.1
1.0