#190 - More simplifications for Spring Boot 1.4 M3.

Replaced all occurrences of @SpringApplicationConfiguration with @SpringBootTest. Using SpringRunner instead of @SpringJUnit4ClassRunner now.
This commit is contained in:
Oliver Gierke
2016-06-11 11:26:23 +02:00
parent 24ca298de2
commit 6684c8c69b
86 changed files with 411 additions and 640 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014 the original author or authors.
* Copyright 2014-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,15 +18,13 @@ package example.springdata.redis;
import javax.annotation.PreDestroy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.redis.connection.RedisConnectionFactory;
/**
* @author Christoph Strobl
*/
@Configuration
@EnableAutoConfiguration
@SpringBootApplication
public class RedisTestConfiguration {
@Autowired RedisConnectionFactory factory;
@@ -34,8 +32,7 @@ public class RedisTestConfiguration {
/**
* Clear database before shut down.
*/
@PreDestroy
public void flushTestDb() {
public @PreDestroy void flushTestDb() {
factory.getConnection().flushDb();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014 the original author or authors.
* Copyright 2014-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +15,8 @@
*/
package example.springdata.redis.commands;
import example.springdata.redis.test.util.RequiresRedisServer;
import java.util.Iterator;
import java.util.Set;
import java.util.UUID;
@@ -24,25 +26,22 @@ import org.junit.ClassRule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.Cursor;
import org.springframework.data.redis.core.ScanOptions;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import example.springdata.redis.RedisTestConfiguration;
import example.springdata.redis.test.util.RequiresRedisServer;
import org.springframework.test.context.junit4.SpringRunner;
/**
* Show usage of operations on redis keys using low level API provided by {@link RedisConnection}.
*
* @author Christoph Strobl
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { RedisTestConfiguration.class })
@RunWith(SpringRunner.class)
@SpringBootApplication
public class KeyOperationsTests {
// we only want to run this tests when redis is up an running

View File

@@ -0,0 +1 @@
logging.level.root=WARN

View File

@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d %5p %40.40c:%4L - %m%n</pattern>
</encoder>
</appender>
<root level="warn">
<appender-ref ref="console" />
</root>
</configuration>