我的问题已在这里得到解答: apiKeyRequired in google cloud endpoint not getting resolved
但它对我没用。
我仍有问题,IDE无法解析 apiKeyRequired 属性。我正在使用端点框架2。+。
@Api(
name = "api",
version = "v1",
apiKeyRequired = AnnotationBoolean.TRUE,
namespace = @ApiNamespace(
ownerDomain = "backendDomain.myapplication.test.example.com",
ownerName = "backendName.myapplication.test.example.com",
packagePath = ""
)
)
public class MyEndpoint {
...
的build.gradle
...
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'appengine'
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
dependencies {
appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.54'
compile 'javax.servlet:servlet-api:2.5'
compile 'com.google.appengine:appengine-endpoints:1.9.54'
compile 'com.google.appengine:appengine-endpoints-deps:1.9.54'
compile 'com.google.endpoints:endpoints-framework:2.0.7'
}
...
答案 0 :(得分:0)
得到了!!试图解决问题几个小时后!在发布此问题后,解决方案就直接出现了。
问题是使用的依赖项。 build.gradle文件中的这两个依赖项导致了问题:
compile 'com.google.appengine:appengine-endpoints:1.9.54'
compile 'com.google.appengine:appengine-endpoints-deps:1.9.54'
我用这两个新的家属取而代之:
compile 'com.google.endpoints:endpoints-management-control-appengine:1.0.3'
compile 'com.google.endpoints:endpoints-framework-auth:1.0.3'
build.gradle(已更新):
...
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'appengine'
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
dependencies {
appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.54'
compile 'javax.servlet:servlet-api:2.5'
compile 'com.google.endpoints:endpoints-framework:2.0.7'
compile 'com.google.endpoints:endpoints-management-control-appengine:1.0.3'
compile 'com.google.endpoints:endpoints-framework-auth:1.0.3'
}
...