Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude GenericFilterBean from proxying #261

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions chaos-monkey-docs/src/main/asciidoc/changes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Built with Spring Boot {spring-boot-version}
=== Bug Fixes
- https://github.com/codecentric/chaos-monkey-spring-boot/pull/252[#252] Update Maven Wrapper from 0.5.5 to 0.5.6.
- https://github.com/codecentric/chaos-monkey-spring-boot/pull/251[#251] Fix missing AssaultPropertiesUpdate validation.
- https://github.com/codecentric/chaos-monkey-spring-boot/pull/261[#261] Fix crash when GenericFilterBean Component exists.
// - https://github.com/codecentric/chaos-monkey-spring-boot/pull/xxx[#xxx] Added example entry. Please don't remove.

=== Improvements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ public void classInChaosMonkeyPackage() {}
@Pointcut("!within(is(FinalType)) || within(com.sun.proxy.*)")
public void nonFinalOrJdkProxiedClassPointcut() {}

// GenericFilterBean cannot be proxied due to final init method.
@Pointcut(
"classInChaosMonkeyPackage() || target(org.springframework.web.filter.GenericFilterBean)")
public void isBlackListedPointcut() {}

@Pointcut("nonFinalOrJdkProxiedClassPointcut() && execution(* *.*(..))")
public void allPublicMethodPointcut() {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class SpringBootHealthIndicatorAspect extends ChaosMonkeyBaseAspect {
@Pointcut("execution(* org.springframework.boot.actuate.health.HealthIndicator.getHealth(..))")
public void getHealthPointCut() {}

@Around("getHealthPointCut() && !classInChaosMonkeyPackage()")
@Around("getHealthPointCut() && !isBlackListedPointcut()")
public Object intercept(ProceedingJoinPoint pjp) throws Throwable {
Health health = (Health) pjp.proceed();
if (watcherProperties.isActuatorHealth()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void classInSpringCloudContextPackage() {}

@Around(
"classAnnotatedWithComponentPointcut() && !classInSpringCloudContextPackage() "
+ "&& allPublicMethodPointcut() && !classInChaosMonkeyPackage() && !springHooksPointcut()")
+ "&& allPublicMethodPointcut() && !isBlackListedPointcut() && !springHooksPointcut()")
public Object intercept(ProceedingJoinPoint pjp) throws Throwable {
if (watcherProperties.isComponent()) {
log.debug("Watching public method on component class: {}", pjp.getSignature());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class SpringControllerAspect extends ChaosMonkeyBaseAspect {
public void classAnnotatedWithControllerPointcut() {}

@Around(
"classAnnotatedWithControllerPointcut() && allPublicMethodPointcut() && !classInChaosMonkeyPackage()")
"classAnnotatedWithControllerPointcut() && allPublicMethodPointcut() && !isBlackListedPointcut()")
public Object intercept(ProceedingJoinPoint pjp) throws Throwable {

if (watcherProperties.isController()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class SpringRepositoryAspectJDBC extends ChaosMonkeyBaseAspect {
public void classAnnotatedWithRepositoryPointcut() {}

@Around(
"classAnnotatedWithRepositoryPointcut() && allPublicMethodPointcut() && !classInChaosMonkeyPackage()")
"classAnnotatedWithRepositoryPointcut() && allPublicMethodPointcut() && !isBlackListedPointcut()")
public Object intercept(ProceedingJoinPoint pjp) throws Throwable {

if (watcherProperties.isRepository()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class SpringRepositoryAspectJPA extends ChaosMonkeyBaseAspect {
"this(org.springframework.data.repository.Repository) || within(@org.springframework.data.repository.RepositoryDefinition *)")
public void implementsCrudRepository() {}

@Around("implementsCrudRepository() && allPublicMethodPointcut() && !classInChaosMonkeyPackage()")
@Around("implementsCrudRepository() && allPublicMethodPointcut() && !isBlackListedPointcut()")
public Object intercept(ProceedingJoinPoint pjp) throws Throwable {

if (watcherProperties.isRepository()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class SpringRestControllerAspect extends ChaosMonkeyBaseAspect {
public void classAnnotatedWithControllerPointcut() {}

@Around(
"classAnnotatedWithControllerPointcut() && allPublicMethodPointcut() && !classInChaosMonkeyPackage()")
"classAnnotatedWithControllerPointcut() && allPublicMethodPointcut() && !isBlackListedPointcut()")
public Object intercept(ProceedingJoinPoint pjp) throws Throwable {

if (watcherProperties.isRestController()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class SpringServiceAspect extends ChaosMonkeyBaseAspect {
public void classAnnotatedWithServicePointcut() {}

@Around(
"classAnnotatedWithServicePointcut() && allPublicMethodPointcut() && !classInChaosMonkeyPackage()"
"classAnnotatedWithServicePointcut() && allPublicMethodPointcut() && !isBlackListedPointcut()"
+ "&& !springHooksPointcut()")
public Object intercept(ProceedingJoinPoint pjp) throws Throwable {

Expand Down