【问题标题】:Spring netflix server config not returns key encriptedSpring netflix 服务器配置不返回加密的密钥
【发布时间】:2015-10-13 11:53:13
【问题描述】:

我正在使用 Spring Netflix 创建服务器配置。我已经配置了 POM.XML 并添加了安全依赖项。我还配置了 application.yml 和 bootstrap.yml 文件。当我使用 encrypt 命令调用服务器以返回加密的密钥时,服务器响应:

白标错误页面

这个应用程序没有明确的 /error 映射,所以你看到 这是一个后备。

Thu Jul 23 10:20:46 CEST 2015 出现意外错误(type=Not 找到,状态 = 404)。没有可用的消息

来电:

http://user:s3cret@localhost:8888/encrypt -d s3cret

Maven 控制台:

2015-07-23 11:02:05.217 信息 7948 --- [主要] s.b.c.e.t.TomcatEmbeddedServletContainer :Tomcat 在端口上启动: 8888 (http) 2015-07-23 11:02:05.218 信息 7948 --- [主要] nubbler.netflixserver.ConfigServerApp :在 5.106 秒(JVM 为 5.922 运行)2015-07-23 11:02:13.765 INFO 7948 --- [nio-8888-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : 初始化 Spring FrameworkServlet 'dispatcherServlet' 2015-07-23 11:02:13.766 信息 7948 --- [nio-8888-exec-1] os.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet':初始化开始于 2015-07-23 11:02:13.785 信息 7948 --- [nio-8888-exec-1] os.web.servlet.DispatcherServlet
: FrameworkServlet 'dispatcherServlet': 19 完成初始化 ms 2015-07-23 11:02:13.885 信息 7948 --- [nio-8888-exec-1] os.b.a.audit.listener.AuditListener : AuditEvent [timestamp=Thu 2015 年 7 月 23 日 11:02:13 CEST,委托人=用户, 类型=AUTHENTICATION_SUCCESS, 数据={详细信息=org.springframework.security.web.authentication.WebAuthenticationDetails@b364: 远程IP地址:0:0:0:0:0:0:0:1; SessionId: null}]

¿有什么想法吗?我已经在 jdk (jdk_1.8.0_40) 中安装了 JCE 扩展,并且我检查了应用程序和 maven 是否使用了这个 jdk。

application.yml:

server:
  port: 8888

spring:
   cloud:
      config:
         server:
            git:
               uri: https://github.com/xxxxx
               basedir: target/config
   security:
      user:
         password: s3cret

bootstrap.yml:

spring:
  encrypt:
   key: foobar

POM.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>nubbler</groupId>
    <artifactId>netflixserver</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.2.5.RELEASE</version>
    </parent>

    <name>netflixserver</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-netflix</artifactId>
                <version>1.0.3.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-config-server</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>

    </dependencies>
</project>

【问题讨论】:

    标签: java spring maven spring-mvc netflix


    【解决方案1】:

    我在通话中使用Curl 解决它。

    在我尝试使用浏览器 (Chrome) 和 SoapUI 之前,服务器都响应错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-26
      • 2019-01-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多