#396 - Polishing.

Add SpringBootApplication to ApplicationConfiguration. Use SpringRunner instead of SpringJUnit4ClassRunner. Fix application.properties.

Original pull request: #401.
This commit is contained in:
Mark Paluch
2018-09-19 15:17:17 +02:00
parent e9405dfa04
commit 44b8d42a64
3 changed files with 15 additions and 16 deletions

View File

@@ -15,12 +15,7 @@
*/
package example.springdata.redis.repositories;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.repository.configuration.EnableRedisRepositories;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* Redis connection, template, etc autoconfigured via application.properties.
@@ -28,6 +23,5 @@ import org.springframework.data.redis.repository.configuration.EnableRedisReposi
* @author Christoph Strobl
* @author Mark Paluch
*/
@Configuration
@EnableRedisRepositories
@SpringBootApplication
public class ApplicationConfiguration {}

View File

@@ -1,3 +1,8 @@
spring.data.redis.repositories.enabled=true # Whether to enable Redis repositories.
spring.redis.host=localhost # Redis server host, default localhost
spring.redis.port=6379 # Redis server port. default 6379
# Whether to enable Redis repositories.
spring.data.redis.repositories.enabled=true
# Redis server host, default localhost
spring.redis.host=localhost
# Redis server port. default 6379
spring.redis.port=6379

View File

@@ -44,16 +44,16 @@ import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.core.RedisOperations;
import org.springframework.data.redis.core.index.GeoIndexed;
import org.springframework.data.redis.core.index.Indexed;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit4.SpringRunner;
/**
* @author Christoph Strobl
* @author Oliver Gierke
* @author Mark Paluch
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = ApplicationConfiguration.class)
public class PersonRepositoryTests<K, V> {
@RunWith(SpringRunner.class)
@SpringBootTest
public class PersonRepositoryTests {
/**
* We need to have a Redis server instance available. <br />
@@ -67,7 +67,7 @@ public class PersonRepositoryTests<K, V> {
/** {@link Charset} for String conversion **/
private static final Charset CHARSET = StandardCharsets.UTF_8;
@Autowired RedisOperations<K, V> operations;
@Autowired RedisOperations<Object, Object> operations;
@Autowired PersonRepository repository;
/*