package com.wx.application.nebula.graph.factory;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 */
@Configuration
@EnableConfigurationProperties(NebulaSessionProperties.class)
public class SessionConfigure {
	
	private NebulaSessionProperties nebulaSessionProperties;

    @Autowired
    public void setFtpClientProperties(NebulaSessionProperties nebulaSessionProperties) {
        this.nebulaSessionProperties = nebulaSessionProperties;
    }
	
    @Bean
    public SessionFactory getSessionFactory() {
        return new SessionFactory(nebulaSessionProperties);
    }
    
    
    @Bean
	@PostConstruct
	public NebulaGraphClient nebulaGraphClient() {
		NebulaGraphClient nebulaGraphClient = new NebulaGraphClient(getSessionFactory());
		return nebulaGraphClient;
	}
}
