fix: Fixed the issue the Spring Boot application cannot run when other GuidCreators are defined as beans
Added Quilifier to jtiCreator
This commit is contained in:
+2
-1
@@ -25,6 +25,7 @@ import com.auth0.jwt.interfaces.DecodedJWT;
|
|||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||||
@@ -85,7 +86,7 @@ public class AuthzeroTokenResolverAutoConfiguration {
|
|||||||
* @param objectMapper Jackson JSON Handler
|
* @param objectMapper Jackson JSON Handler
|
||||||
*/
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
public AuthzeroTokenResolverAutoConfiguration(SimpleJwtProperties simpleJwtProperties, GuidCreator<?> jtiCreator, ObjectMapper objectMapper) {
|
public AuthzeroTokenResolverAutoConfiguration(SimpleJwtProperties simpleJwtProperties, @Qualifier("jtiCreator") GuidCreator<?> jtiCreator, ObjectMapper objectMapper) {
|
||||||
this.jtiCreator = jtiCreator;
|
this.jtiCreator = jtiCreator;
|
||||||
this.simpleJwtProperties = simpleJwtProperties;
|
this.simpleJwtProperties = simpleJwtProperties;
|
||||||
this.objectMapper = objectMapper;
|
this.objectMapper = objectMapper;
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ import java.util.UUID;
|
|||||||
@AutoConfiguration
|
@AutoConfiguration
|
||||||
public class GuidAutoConfiguration {
|
public class GuidAutoConfiguration {
|
||||||
|
|
||||||
@Bean
|
@Bean(name = "jtiCreator")
|
||||||
@Conditional(GuidCreatorCondition.class)
|
@Conditional(GuidCreatorCondition.class)
|
||||||
public GuidCreator<?> jtiCreator() {
|
public GuidCreator<?> jtiCreator() {
|
||||||
return UUID::randomUUID;
|
return UUID::randomUUID;
|
||||||
|
|||||||
+2
-1
@@ -25,6 +25,7 @@ import io.jsonwebtoken.Claims;
|
|||||||
import io.jsonwebtoken.Jws;
|
import io.jsonwebtoken.Jws;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||||
@@ -82,7 +83,7 @@ public class JjwtTokenResolverAutoConfiguration {
|
|||||||
* @param simpleJwtProperties the SimpleJwtProperties instance
|
* @param simpleJwtProperties the SimpleJwtProperties instance
|
||||||
*/
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
public JjwtTokenResolverAutoConfiguration(SimpleJwtProperties simpleJwtProperties, GuidCreator<?> jtiCreator) {
|
public JjwtTokenResolverAutoConfiguration(SimpleJwtProperties simpleJwtProperties, @Qualifier("jtiCreator") GuidCreator<?> jtiCreator) {
|
||||||
this.jtiCreator = jtiCreator;
|
this.jtiCreator = jtiCreator;
|
||||||
this.simpleJwtProperties = simpleJwtProperties;
|
this.simpleJwtProperties = simpleJwtProperties;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user