在别的类上注入Mapper(Netty的Handler上)

在别的类上注入Mapper(Netty的Handler上)

@Component
public class ServerHandler extends SimpleChannelInboundHandler {
@Autowired
private MacCheckMachineMapper macCheckMachineMapper;
@Autowired
private MacMonitorOnOffRecordMapper macMonitorOnOffRecordMapper;
public static ServerHandler serverHandler;
@PostConstruct
public void init() {
serverHandler = this;
}

使用的时候可以用:serverHandler.macCheckMachineMapper.xxx()

你可能感兴趣的:(问题解决)