Static 工具類 注入 service

import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.svc.XXSvc;java

@Component
public class XXUtil {spring

@Autowired
XXSvc xXSvc;
private static XXUtil  xXUtil ;

@PostConstruct
public void init() {
    xXUtil = this;
    xXUtil.xXSvc = this.xXSvc;
}

public static Boolean xMethod(String name) {
    return xXUtil.xXSvc.XMethod(name);
}

}this

相關文章
相關標籤/搜索