chenjiahe
2024-09-23 826b66207dafbce24f441cb83fed1b241a6fba27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package com.hx.auto.manage.xml.scan;
 
import com.hx.auto.GeneratorUtil;
import com.hx.auto.manage.xml.scan.util.ConfigUtil;
import com.hx.auto.manage.xml.scan.util.CreateMapperUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import javax.annotation.PostConstruct;
import java.util.Set;
 
/**
 * 启动时进行处理的实现类
 * @author chenbin.sun
 *
 */
@SuppressWarnings("restriction")
@Service
public class StartScanXmlHandlerImpl implements StartScanXmlHandler {
    
    @Autowired
    private ConfigUtil configUtil;
 
    @PostConstruct
    public void startHandler() throws Exception {
        if(configUtil.getIsScan()){
            System.out.println("开始扫描更新xml文件");
            Set<Class<?>> classes = GeneratorUtil.classData(configUtil.getModelPack());
            for(Class<?> cl:classes) {
                CreateMapperUtil.generatorMapper(cl,configUtil);
            }
        }
    }
}