Skip to content

Instantly share code, notes, and snippets.

@tylertreat
Created December 31, 2014 21:31
Show Gist options
  • Select an option

  • Save tylertreat/a912aa32457ddd4d98ad to your computer and use it in GitHub Desktop.

Select an option

Save tylertreat/a912aa32457ddd4d98ad to your computer and use it in GitHub Desktop.
@Component
public class ClientStubPostProcessor implements BeanFactoryPostProcessor {
private Logger logger;
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
logger = Logger.getLogger(ClientStubPostProcessor.class);
// Don't register stubs if testing against localhost
if (isTestingLocally())
return;
logger.info("Registering client stubs");
int count = registerClientStubBeans((DefaultListableBeanFactory) beanFactory);
logger.info(count + " client stubs registered");
}
private boolean isTestingLocally() {
String endpointTestServer = System.getProperty("endpoint.test.server");
if (endpointTestServer == null)
 return false;
return endpointTestServer.toLowerCase().startsWith("localhost") || endpointTestServer.startsWith("127.0.0.1");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment