springboot component注入servecie
package com.infosec.sso.component.externalauthandsyn;
import java.util.Map;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.netauth.api.user.UserExtensionClient;
import com.netauth.utils.jsonresult.JsonResult;
@Component
public class AccountByExternalAuthAndSyn {
@Autowired
private UserExtensionClient userExtensionClient;
private static UserExtensionClient accSynMiddle;
public Map<String, Object> createAccountByExternalAuthAndSyn(String userId, String pwd) {
JsonResult res = accSynMiddle.createAccountByExternalAuthAndSyn(userId, pwd);
return (Map<String, Object>) res.getResult();
}
@PostConstruct
public void sessionUtilsInit() {
AccountByExternalAuthAndSyn.accSynMiddle = userExtensionClient;
}
}