Maven依赖项中有一个与Java 8不兼容的类。
您如何正确解决该问题?
现在,我正在执行以下操作:
问题是该类包含对受限类的API调用,尽管我更改了Eclipse编译器设置(窗口->首选项-> Java->编译器->错误/警告->不建议使用和受限的API->禁止引用(访问规则) :错误->警告)以允许访问项目,有时只会编译。如果无法编译,则会出现“找不到符号”错误。
编辑:
这是您要求的详细信息:
相关性:http : //mvnrepository.com/artifact/com.sun.xml.wss/xws-security/3.0
类:EncryptionProcessor
必要更改:
// Change line 1053 FROM:
// _dataEncryptor = XMLCipher.getInstance(dataEncAlgo, _dataCipher);
// TO:
_dataEncryptor = XMLCipher.getInstance(dataEncAlgo);
Run Code Online (Sandbox Code Playgroud)编辑2:
Maven构建错误:
[ERROR] symbol: class XMLCipher
[ERROR] location: class com.sun.xml.wss.impl.apachecrypto.EncryptionProcessor
[ERROR] /C:/Users/{name}/development/eclipse_workspace/git/xws-security/src/main/java/com/sun/xml/wss/impl/apachecrypto/EncryptionProcessor.java:[1482,98] cannot find symbol
Run Code Online (Sandbox Code Playgroud) 我尝试使用本指南使用OAuth实现RESTFul Web服务:https://spring.io/guides/tutorials/bookmarks
我可以成功检索一个令牌:
curl -v -u android-bookmarks:123456 -X POST http://localhost:8080/oauth/token -H "Accept: application/json" -d "password=password&username=User1&grant_type=password&scope=write&client_secret=12345&client_id=android-bookmarks"
Run Code Online (Sandbox Code Playgroud)
响应:
{"access_token":"cdafc45f-924a-4f87-8bd0-e3e2bdffa540","token_type":"bearer","refresh_token":"609efba8-edd3-4ea3-be7b-78e449cec0ef","expires_in":43199,"scope":"write"}* Connection #0 to host localhost left intact
Run Code Online (Sandbox Code Playgroud)
当我尝试访问资源时:
curl -G http://localhost:8080/bookmarks -H "Authorization: Bearer cdafc45f-924a-4f87-8bd0-e3e2bdffa540"
Run Code Online (Sandbox Code Playgroud)
我收到以下回复:
{"error":"access_denied","error_description":"Invalid token does not contain resource id (oauth2-resource)"}
Run Code Online (Sandbox Code Playgroud)
设置资源ID的Java类:
@Configuration
@EnableResourceServer
@EnableAuthorizationServer
public class OAuth2Configuration extends AuthorizationServerConfigurerAdapter {
public static final String RESOURCE_ID = "bookmarks";
@Autowired
AuthenticationManagerBuilder authenticationManager;
@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints)
throws Exception {
endpoints.authenticationManager(new AuthenticationManager() {
@Override
public Authentication authenticate(Authentication authentication)
throws …Run Code Online (Sandbox Code Playgroud)