Authentication authentication = getAuthentication();
// 这里使用了一个上届通配符
// authentication.getAuthorities(); 返回一个Collection接口,这个接口是必须是GrantedAuthority的子类,包含它自己
Collection<? extends GrantedAuthority> authorities = authentication.getAuthorities();
上下界流的泛型在传入子类之后,当前容器的set方法会失效,只能用get方法
// 下界泛型,传入当前容器中的类必须是test类的父类
List<? super test> list = new ArrayList<>();
为什么说是轻量级的锁,因为它保证了多个线程在操作同一变量时都会将这个变量修改后的值实时同步到主内存中,从而保证其它变量都是从主内存中获取这个变量