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
|
||||
*
|
||||
* @throws IOException if there is an error
|
||||
* @param classLoader
|
||||
*/
|
||||
@Bean
|
||||
public ClassPath classPath() throws IOException {
|
||||
return ClassPath.from(getClass().getClassLoader());
|
||||
public ClassPath classPath(final ClassLoader classLoader) throws IOException {
|
||||
return ClassPath.from(classLoader);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ClassLoader classLoader() {
|
||||
return BuilderConfiguration.class.getClassLoader();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,7 +23,8 @@ public class BuilderConfigurationTest {
|
|||
@Test
|
||||
public void canGetClassPath() throws IOException {
|
||||
//when
|
||||
final ClassPath classPath = new BuilderConfiguration().classPath();
|
||||
final BuilderConfiguration builderConfiguration = new BuilderConfiguration();
|
||||
final ClassPath classPath = builderConfiguration.classPath(builderConfiguration.getClass().getClassLoader());
|
||||
//then
|
||||
assertThat(classPath).isNotNull();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue