使用注解给类的属性注入参数

 @Autowired
    private RedisTemplate redisTemplate;
    @Autowired
    private StringRedisTemplate stringRedisTemplate;
    @Resource(
            name = "stringRedisTemplate"
    )
    private ValueOperations strOps;
    @Resource(
            name = "redisTemplate"
    )
    private ValueOperations valOps;
    @Resource(
            name = "redisTemplate"
    )
    private ListOperations listOps;
    @Resource(
            name = "redisTemplate"
    )
    private SetOperations setOps;
    @Resource(
            name = "redisTemplate"
    )
    private ZSetOperations zsetOps;
    @Resource(
            name = "redisTemplate"
    )
    private HashOperations hashOps;

你可能感兴趣的:(spring)