cherry pick 2b43d40
Apply logic from https://github.com/spring-projects/spring-xd/pull/486