Update samples to use @SpringBootApplication
Update the relevant samples to use the new @SpringBootApplication annotation. Closes gh-1842
This commit is contained in:
@@ -19,13 +19,11 @@ package sample.data.redis;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.data.redis.core.ValueOperations;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@SpringBootApplication
|
||||
public class SampleRedisApplication implements CommandLineRunner {
|
||||
|
||||
@Autowired
|
||||
@@ -33,9 +31,9 @@ public class SampleRedisApplication implements CommandLineRunner {
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
ValueOperations<String, String> ops = template.opsForValue();
|
||||
ValueOperations<String, String> ops = this.template.opsForValue();
|
||||
String key = "spring.boot.redis.test";
|
||||
if (!template.hasKey(key)) {
|
||||
if (!this.template.hasKey(key)) {
|
||||
ops.set(key, "foo");
|
||||
}
|
||||
System.out.println("Found key " + key + ", value=" + ops.get(key));
|
||||
|
||||
Reference in New Issue
Block a user