Skip to content

Commit 2a6a2ab

Browse files
Merge pull request #7 from officiallysingh/bug-fix-1.0
add qualifier to bean selection
2 parents 6cce5f8 + e9acd02 commit 2a6a2ab

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>io.github.officiallysingh</groupId>
88
<artifactId>spring-boot-problem-handler</artifactId>
9-
<version>1.9</version>
9+
<version>1.9.1</version>
1010
<name>spring-boot-problem-handler</name>
1111
<description>Commons exception handler library</description>
1212
<url>https://github.com/officiallysingh/spring-boot-problem-handler</url>

src/main/java/com/ksoot/problem/spring/advice/security/ProblemAccessDeniedHandler.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import jakarta.servlet.http.HttpServletRequest;
55
import jakarta.servlet.http.HttpServletResponse;
66
import java.io.IOException;
7-
import org.springframework.beans.factory.annotation.Qualifier;
87
import org.springframework.security.access.AccessDeniedException;
98
import org.springframework.security.web.AuthenticationEntryPoint;
109
import org.springframework.security.web.access.AccessDeniedHandler;
@@ -22,8 +21,7 @@ public class ProblemAccessDeniedHandler implements AccessDeniedHandler {
2221

2322
private final HandlerExceptionResolver resolver;
2423

25-
public ProblemAccessDeniedHandler(
26-
@Qualifier("handlerExceptionResolver") final HandlerExceptionResolver resolver) {
24+
public ProblemAccessDeniedHandler(final HandlerExceptionResolver resolver) {
2725
this.resolver = resolver;
2826
}
2927

src/main/java/com/ksoot/problem/spring/advice/security/ProblemAuthenticationEntryPoint.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import jakarta.servlet.http.HttpServletRequest;
44
import jakarta.servlet.http.HttpServletResponse;
5-
import org.springframework.beans.factory.annotation.Qualifier;
65
import org.springframework.security.core.AuthenticationException;
76
import org.springframework.security.web.AuthenticationEntryPoint;
87
import org.springframework.security.web.access.AccessDeniedHandler;
@@ -20,8 +19,7 @@ public class ProblemAuthenticationEntryPoint implements AuthenticationEntryPoint
2019

2120
private final HandlerExceptionResolver resolver;
2221

23-
public ProblemAuthenticationEntryPoint(
24-
@Qualifier("handlerExceptionResolver") final HandlerExceptionResolver resolver) {
22+
public ProblemAuthenticationEntryPoint(final HandlerExceptionResolver resolver) {
2523
this.resolver = resolver;
2624
}
2725

src/main/java/com/ksoot/problem/spring/boot/autoconfigure/web/WebSecurityExceptionHandler.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.ksoot.problem.spring.boot.autoconfigure.SecurityAdviceEnabled;
77
import com.ksoot.problem.spring.config.ProblemProperties;
88
import lombok.RequiredArgsConstructor;
9+
import org.springframework.beans.factory.annotation.Qualifier;
910
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
1011
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
1112
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
@@ -37,13 +38,15 @@ public class WebSecurityExceptionHandler
3738

3839
@ConditionalOnMissingBean
3940
@Bean
40-
AuthenticationEntryPoint authenticationEntryPoint(final HandlerExceptionResolver resolver) {
41+
AuthenticationEntryPoint authenticationEntryPoint(
42+
@Qualifier("handlerExceptionResolver") final HandlerExceptionResolver resolver) {
4143
return new ProblemAuthenticationEntryPoint(resolver);
4244
}
4345

4446
@ConditionalOnMissingBean
4547
@Bean
46-
AccessDeniedHandler accessDeniedHandler(final HandlerExceptionResolver resolver) {
48+
AccessDeniedHandler accessDeniedHandler(
49+
@Qualifier("handlerExceptionResolver") final HandlerExceptionResolver resolver) {
4750
return new ProblemAccessDeniedHandler(resolver);
4851
}
4952
}

0 commit comments

Comments
 (0)