@Around("execution(@ConfigureAgentThresholdMillis void org.jmonitor..*Test.*())") public void aroundConfigureAgentThresholdMillisPointcut(ProceedingJoinPoint joinPoint) throws Throwable { ConfigureAgentThresholdMillis annotation = getAnnotation(ConfigureAgentThresholdMillis.class, joinPoint); AgentConfigurationImpl mutableConfiguration = getMutableAgentConfiguration(); int previousValue = mutableConfiguration.getThresholdMillis(); // set it to annotated value mutableConfiguration.setThresholdMillis(annotation.value()); ConfigurationServiceImpl.getInstance().updateAgentConfiguration(mutableConfiguration); try { joinPoint.proceed(); } finally { // set it back to original value mutableConfiguration.setThresholdMillis(previousValue); ConfigurationServiceImpl.getInstance().updateAgentConfiguration(mutableConfiguration); } }