@Resource annotation is not supported on static fields

@Resource annotation is not supported on static fields  

问题解决


写set方法,在set方法上做注解

@Component
public final class OAuthUtil {

	private static OAuthService oauthService;

	@Resource(name = "woldoauthService")
	public void setOauthService(OAuthService oauthService) {
		OAuthUtil.oauthService = oauthService;
	}

}


你可能感兴趣的:(代码优化,代码编写,问题修复)