springboot项目在普通类中调用maper或者service接口

package com.zch.tools;

import com.zch.bean.TableBean;
import com.zch.bean.TranslateBean;
import com.zch.mapper.FillerMapper;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.usermodel.*;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFTable;
import org.apache.poi.xwpf.usermodel.XWPFTableCell;
import org.apache.poi.xwpf.usermodel.XWPFTableRow;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * @Author:zhaochunhui;
 * @Description:
 * @Date:Create in 10:24 2019/12/29
 */
//1
@Component
public class Judge {

    //2
    @Autowired
    private FillerMapper fillerMapper;

    public static Judge judge;

    //3
    @PostConstruct
    public void init(){
        judge = this ;
        //4
        judge.fillerMapper = this.fillerMapper;
    }

    //你要封装的方法
    public  void judgeProductStatus(){
        //5
        judge.fillerMapper.getEngCharByChainChar();
    }


}

你可能感兴趣的:(springboot项目在普通类中调用maper或者service接口)