File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed
src/main/java/org/springframework/data/elasticsearch/client Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change 17
17
18
18
import static org .elasticsearch .node .NodeBuilder .*;
19
19
20
- import java .io .IOException ;
21
- import java .nio .file .Paths ;
22
-
20
+ import java .io .InputStream ;
23
21
import org .apache .commons .lang .StringUtils ;
24
22
import org .elasticsearch .client .Client ;
25
23
import org .elasticsearch .client .node .NodeClient ;
29
27
import org .springframework .beans .factory .DisposableBean ;
30
28
import org .springframework .beans .factory .FactoryBean ;
31
29
import org .springframework .beans .factory .InitializingBean ;
32
- import org .springframework .core .io .ClassPathResource ;
33
30
34
31
/**
35
32
* NodeClientFactoryBean
@@ -83,11 +80,11 @@ public void afterPropertiesSet() throws Exception {
83
80
84
81
private Settings loadConfig () {
85
82
if (StringUtils .isNotBlank (pathConfiguration )) {
86
- try {
87
- return Settings .builder ().loadFromPath (Paths .get (new ClassPathResource (pathConfiguration ).getURI ())).build ();
88
- } catch (IOException e ) {
89
- logger .error (String .format ("Unable to read node configuration from file [%s]" , pathConfiguration ), e );
83
+ InputStream stream = getClass ().getClassLoader ().getResourceAsStream (pathConfiguration );
84
+ if (stream != null ) {
85
+ return Settings .builder ().loadFromStream (pathConfiguration , getClass ().getClassLoader ().getResourceAsStream (pathConfiguration )).build ();
90
86
}
87
+ logger .error (String .format ("Unable to read node configuration from file [%s]" , pathConfiguration ));
91
88
}
92
89
return Settings .builder ().build ();
93
90
}
You can’t perform that action at this time.
0 commit comments