Spring Google App Engine 中的 OAuth 失败

Spring OAuth in Google App Engine fails

我正在尝试使用 spring 安全性来实现 OAuth1.0,如下所示:

@Bean
@Scope(value = "request", proxyMode = ScopedProxyMode.INTERFACES)
public RestOperations twitterOAuthRestTemplate() {
    return new OAuthRestTemplate(twitterOAuthDetails());
}

但是它在运行时失败了:

jjava.lang.NoClassDefFoundError: java.net.ProxySelector is a restricted class. Please see the Google  App Engine developer's guide for more details.
at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51)
at org.springframework.security.oauth.consumer.client.CoreOAuthConsumerSupport.<init>(CoreOAuthConsumerSupport.java:64)
at org.springframework.security.oauth.consumer.client.OAuthRestTemplate.<init>(OAuthRestTemplate.java:17)
at org.springframework.security.oauth.consumer.client.OAuthRestTemplate.<init>(OAuthRestTemplate.java:20)

有人知道怎么解决吗?

我没有找到比创建自己的 Spring 类(OAuthRestTemplate、CoreOAuthConsumerSupport)副本并摆脱 ProxySelector 更好的方法。