Static 工具类 注入 service
文章目录
import javax.annotation.PostConstruct;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Component;import com.svc.XXSvc;
@Componentpublic class XXUtil {
@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);
}
}

评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论