builder: use BuilderConfiguration to provide the classLoader
This commit is contained in:
parent
9f9096f657
commit
defa19a143
2 changed files with 10 additions and 3 deletions
|
@ -47,10 +47,16 @@ public class BuilderConfiguration {
|
||||||
* @return the ClassPath
|
* @return the ClassPath
|
||||||
*
|
*
|
||||||
* @throws IOException if there is an error
|
* @throws IOException if there is an error
|
||||||
|
* @param classLoader
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
public ClassPath classPath() throws IOException {
|
public ClassPath classPath(final ClassLoader classLoader) throws IOException {
|
||||||
return ClassPath.from(getClass().getClassLoader());
|
return ClassPath.from(classLoader);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ClassLoader classLoader() {
|
||||||
|
return BuilderConfiguration.class.getClassLoader();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -23,7 +23,8 @@ public class BuilderConfigurationTest {
|
||||||
@Test
|
@Test
|
||||||
public void canGetClassPath() throws IOException {
|
public void canGetClassPath() throws IOException {
|
||||||
//when
|
//when
|
||||||
final ClassPath classPath = new BuilderConfiguration().classPath();
|
final BuilderConfiguration builderConfiguration = new BuilderConfiguration();
|
||||||
|
final ClassPath classPath = builderConfiguration.classPath(builderConfiguration.getClass().getClassLoader());
|
||||||
//then
|
//then
|
||||||
assertThat(classPath).isNotNull();
|
assertThat(classPath).isNotNull();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue