Created
December 31, 2014 21:31
-
-
Save tylertreat/a912aa32457ddd4d98ad to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @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