分布式锁有很多种实现方式,下面是用redis实现的一个比较简单实用的方式。源码如下: import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data…