You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
563 B
Java
30 lines
563 B
Java
|
5 years ago
|
package com.bsd.say.config;
|
||
|
|
|
||
|
|
import com.bsd.say.service.RedisService;
|
||
|
|
import org.springframework.beans.factory.annotation.Value;
|
||
|
|
import org.springframework.stereotype.Component;
|
||
|
|
|
||
|
|
import javax.annotation.PostConstruct;
|
||
|
|
import javax.annotation.Resource;
|
||
|
|
|
||
|
|
@Component
|
||
|
|
public class InitConfig {
|
||
|
|
|
||
|
|
@Value("${award.amount}")
|
||
|
|
private Integer amount;
|
||
|
|
@Resource
|
||
|
|
RedisService redisService;
|
||
|
|
|
||
|
|
@PostConstruct
|
||
|
|
public void initAwardConfig() {
|
||
|
|
|
||
|
|
|
||
|
|
for (int i = 0; i < amount; i++) {
|
||
|
|
|
||
|
|
redisService.set("award-" + i, i);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|