36 lines
984 B
Java
36 lines
984 B
Java
package com.stktrk.app.integration.flyway;
|
|
|
|
import com.arcadedb.gremlin.ArcadeGraph;
|
|
import com.arcadedb.gremlin.ArcadeGraphFactory;
|
|
import com.stktrk.app.integration.configuration.types.GraphDbConfig;
|
|
import jakarta.annotation.Nonnull;
|
|
import jakarta.annotation.Nullable;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
|
@Component
|
|
public class ConnectionPool {
|
|
@Nullable
|
|
static ArcadeGraphFactory pool;
|
|
|
|
@Autowired
|
|
@Nullable
|
|
GraphDbConfig graphDbConfig;
|
|
|
|
@PostConstruct
|
|
void init() {
|
|
pool = ArcadeGraphFactory.withRemote(graphDbConfig.getHost(),
|
|
graphDbConfig.getHttpPort(),
|
|
graphDbConfig.getGraphName(),
|
|
graphDbConfig.getUser(),
|
|
graphDbConfig.getPassword());
|
|
}
|
|
|
|
@Nonnull
|
|
public static ArcadeGraph getGraph() {
|
|
return pool.get();
|
|
}
|
|
}
|