package com.qmth.exam.reserve.config;

import com.qmth.boot.core.fss.config.FileStoreProperty;
import com.qmth.boot.core.fss.service.FileService;
import com.qmth.boot.core.fss.service.impl.DefaultFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.Map;


@Configuration
public class FileStoreConfig {

    @Autowired
    private SysProperty sysProperty;

    @Bean("fileService")
    public FileService fileService() {
        FileStoreProperty property = new FileStoreProperty();
        property.setConfig(sysProperty.getConfig());
        property.setServer(sysProperty.getServer());
        Map<String,FileStoreProperty> map = new HashMap<>();
        map.put("com.qmth.fss", property);
        return new DefaultFileService(map);
    }
}
