摘要:
引言 微服务启动时,有可能需要刷redis等初始化信息,如将菜单资源刷入redis缓存。 初始化资源 方法 使用@PostConstruct在spring容器初始化的时候执行该方法。执行顺序:Constructor >> @Autowired >> @PostConstruct 代码示例 @Comp 阅读全文
摘要:
引言 防止横向越权,前端会传递token信息到header中,后端需要对header进行鉴权验证。 代码 定义token拦截器 @Component @Slf4j public class TokenAuthInterceptor implements HandlerInterceptor { /* 阅读全文