You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.1 KiB
Java
32 lines
1.1 KiB
Java
package com.supervision.config;
|
|
|
|
import org.neo4j.driver.AuthTokens;
|
|
import org.neo4j.driver.Config;
|
|
import org.neo4j.driver.Driver;
|
|
import org.neo4j.driver.GraphDatabase;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
@Configuration
|
|
public class Neo4jConfig {
|
|
|
|
@Value("${spring.neo4j.uri}")
|
|
private String URI;
|
|
@Value("${spring.neo4j.authentication.username}")
|
|
private String USER;
|
|
@Value("${spring.neo4j.authentication.password}")
|
|
private String PASSWORD;
|
|
|
|
@Bean
|
|
public Driver neo4jDriver() {
|
|
// 这里可以添加额外的配置,比如加密、连接池设置等
|
|
Config config = Config.builder()
|
|
// 示例:关闭加密(注意:在生产环境中应该启用加密)
|
|
// .withoutEncryption()
|
|
// 你可以在这里添加更多的配置选项
|
|
.build();
|
|
|
|
return GraphDatabase.driver(URI, AuthTokens.basic(USER, PASSWORD), config);
|
|
}
|
|
} |