Java

Spring Boot项目整合Apollo错误:for env UNKNOWN from com.ctrip.framework.apollo.internals.DefaultMetaServerProvider

Spring Boot项目整合Apollo错误:for env UNKNOWN from com.ctrip.framework.apollo.internals.DefaultMetaServerProvider

Apollo支持完善的管理界面,支持多环境,配置变更实时生效,权限和配置审计等多种生产级功能 错误信息 App ID is set to appblog-gateway by app.id property from System Property Environment is set to nu

Joe.Ye Joe.Ye 2023-03-24
0 0 0
Spring Boot 集成 disconf-client

Spring Boot 集成 disconf-client

Disconf web的安装配置 Disconf web是Disconf的管理界面及服务器,通过它来配置管理我们的配置文件。 客户端配置 (1)创建普通的SpringBoot项目config-disconf,在pom.xml文件中增加如下依赖 <dependency> <gr

Joe.Ye Joe.Ye 2023-03-23
0 0 0
Spring Boot指定事务管理器

Spring Boot指定事务管理器

Spring Boot 使用事务非常简单,首先使用注解@EnableTransactionManagement开启事务支持后,然后在访问数据库的Service方法上添加注解@Transactional便可。 关于事务管理器,不管是JPA还是JDBC等都实现自接口PlatformTransaction

Joe.Ye Joe.Ye 2023-03-20
0 0 0
Spring Boot事务使用

Spring Boot事务使用

Spring Boot实现事务特别特别简单,没有多余操作,一个注解@Transactional搞定 依赖的Jar包pom.xml Spring Boot中实现事务没有额外的Jar包,还是基本的数据库访问包,比如Mybatis <dependency> <groupId&g

Joe.Ye Joe.Ye 2023-03-20
0 0 0
Spring Boot中的页面跳转

Spring Boot中的页面跳转

通常来说,Controller都会返回一个视图名称,Spring Boot会默认在main/resource/templates目录下找,因为该目录是安全的,意味着该目录下的内容是不允许外界直接访问的。有些情况下,Controller会返回客户端一个HTTP Redirect重定向请求,希望客户端按

Joe.Ye Joe.Ye 2023-03-20
0 0 0
Spring Boot使用@Async异步注解导致该Bean在循环依赖时启动报BeanCurrentlyInCreationException异常

Spring Boot使用@Async异步注解导致该Bean在循环依赖时启动报BeanCurrentlyInCreationException异常

现象描述 Spring Boot工程中使用@Async时,碰到循环依赖(circular reference)问题: Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creati

Joe.Ye Joe.Ye 2023-03-20
0 0 0
JWT InvalidClaimException – The Token can’t be used before

JWT InvalidClaimException – The Token can’t be used before

jwt token错误 Linux服务器上最近使用jwt token的时候遇到了一个奇怪的问题: InvalidClaimException: The Token can't be used before 某个时间 本地调试完全没问题,测试环境只使用一台也没问题,但是一旦启用多台服务器就

Joe.Ye Joe.Ye 2023-03-20
0 0 0
Spring Security Oauth2 中优雅的扩展自定义(短信验证码)登录方式

Spring Security Oauth2 中优雅的扩展自定义(短信验证码)登录方式

方案引入 跟踪Spring Security的登录逻辑发现,帐号密码的验证是在tokenGranter中完成的。帐号密码方式对应的是 org.springframework.security.oauth2.provider.password.ResourceOwnerPasswordTokenGra

Joe.Ye Joe.Ye 2023-03-20
0 0 0
Spring Security用户认证成功失败自定义实现

Spring Security用户认证成功失败自定义实现

在org.springframework.security.authentication.event包下定义了发生认证时的所有事件类型,其中AbstractAuthenticationEvent是所有事件的父类,其它事件都继承于AbstractAuthenticationEvent,其子类有 Ab

Joe.Ye Joe.Ye 2023-03-20
0 0 0
Spring Security用户认证成功失败源码分析

Spring Security用户认证成功失败源码分析

通常用户登录成功或者失败之后要做一些处理,比如日志记录、数据初始化等等;Spring中提供了事件及监听器,而Spring Security很好的运用了这一特点,框架中用了很多的事件来处理,要想很好的控制这些,先熟悉下源码,要知其所以然。 ProviderManager类分析 已经对该类进行过分析,

Joe.Ye Joe.Ye 2023-03-20
0 0 0
Spring Security 之多AuthenticationProvider认证模式实现

Spring Security 之多AuthenticationProvider认证模式实现

多AuthenticationProvider实现ProviderManager会按照加入认证请求链中的顺序来验证,前文的源码分析及实现原理已经说的很清楚了,本文直接看代码实现; AuthenticationProvider认证类UserSmsAuthenticationProvider实现 /*

Joe.Ye Joe.Ye 2023-03-20
0 0 0
Spring Security之AuthenticationManager、ProviderManager、AuthenticationProvider用户认证源码分析

Spring Security之AuthenticationManager、ProviderManager、AuthenticationProvider用户认证源码分析

AuthenticationManager类源码解析 public interface AuthenticationManager { Authentication authenticate(Authentication authentication) throws

Joe.Ye Joe.Ye 2023-03-20
0 0 0
Spring Security OAuth2 用户登录失败事件发布及监听

Spring Security OAuth2 用户登录失败事件发布及监听

Spring事件简介 Spring中的事件分为三部分:事件、监听器、事件源,其中事件是核心,涉及到ApplicationEventPublisher接口、ApplicationEvent类、ApplicationListener接口 定义用户登录失败事件 /** * @Description:

Joe.Ye Joe.Ye 2023-03-20
0 0 0
Spring Security OAuth2 自定义GrantedAuthority授权接口

Spring Security OAuth2 自定义GrantedAuthority授权接口

使用Security OAuth2的时候需要返回给前端用户的角色或者权限,框架提供了GrantedAuthority接口,有一个默认的实现SimpleGrantedAuthority,但是它只能返回简单 的字符串,如果我们想灵活的使用很难控制;所以我这边通过实现GrantedAuthority接口,

Joe.Ye Joe.Ye 2023-03-20
0 0 0
Spring Security OAuth2之scopes配置详解

Spring Security OAuth2之scopes配置详解

官方文档说明 地址:https://projects.spring.io/spring-security-oauth/docs/oauth2.html scope: The scope to which the client is limited. If scope is undefined or

Joe.Ye Joe.Ye 2023-03-20
0 0 0
1 14 15 16 17 18 29