【问题标题】:"apiKeyRequired" in google cloud endpoint not getting resolved (2nd)谷歌云端点中的“apiKeyRequired”未得到解决(第 2 次)
【发布时间】:2017-06-21 13:17:27
【问题描述】:

我的问题已经在这里得到解答: 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'
}
...

【问题讨论】:

    标签: java google-app-engine google-cloud-endpoints


    【解决方案1】:

    知道了!!在尝试解决问题数小时后!发布此问题后,解决方案直接出现。

    问题在于使用的依赖项。 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'
    }
    ...
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-06
      • 1970-01-01
      • 2015-10-27
      • 2014-07-05
      • 1970-01-01
      相关资源
      最近更新 更多