@RequestMapping("/bb") public String index(){
Runnable runnable = new Runnable() { @Override public void run() { redisTemplate.opsForValue().set("t"+UUID.randomUUID(),"123"); } }; //多线程测试 ExecutorService executorService = Executors.newFixedThreadPool(25); for(int i= 0;i<10000;i++){ executorService.submit(runnable); } return redisTemplate.opsForValue().get("yy"); }
说明:此处开启25个线程,循环10000次。