Fixed #1499, append slash to search-locations ending when it is missed.

This commit is contained in:
jixu.hjx
2021-06-03 20:04:19 +08:00
committed by spencergibb
parent 1ffe015a33
commit 238ab0cbaa
2 changed files with 8 additions and 1 deletions

View File

@@ -97,7 +97,7 @@ public class NativeEnvironmentRepository implements EnvironmentRepository, Searc
this.defaultLabel = properties.getDefaultLabel();
this.failOnError = properties.getFailOnError();
this.order = properties.getOrder();
this.searchLocations = properties.getSearchLocations();
setSearchLocations(properties.getSearchLocations());
this.version = properties.getVersion();
}

View File

@@ -344,4 +344,11 @@ public class ResourceControllerTests {
assertThat(resource).isEqualToIgnoringNewLines("foo: dev_bar/spam");
}
@Test
public void setSearchLocationsAppendSlashByConstructor() {
final NativeEnvironmentProperties properties = new NativeEnvironmentProperties();
properties.setSearchLocations(new String[]{"classpath:/test"});
NativeEnvironmentRepository repo = new NativeEnvironmentRepository(this.context.getEnvironment(), properties);
assertThat(repo.getSearchLocations()[0]).isEqualTo("classpath:/test/");
}
}