小编pee*_*kay的帖子

spring boot external config

我正在尝试将外部属性文件加载到我的spring启动应用程序中.最初我在配置类中使用了@PropertySource.但现在我想删除这个注释,所以类不依赖于位置.所以我试着用:

java -jar my-boot-ws.war --SPRING_CONFIG_NAME=file:///Users/TMP/resources/
Run Code Online (Sandbox Code Playgroud)

基于此http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html文档但我收到以下错误:

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder
Run Code Online (Sandbox Code Playgroud)

使用注释工作正常,但我真的想摆脱它.对此的任何帮助都会很棒

谢谢

******更正*******

抱歉复制粘贴错误上面的命令应该是:

java -jar my-boot-ws.war --spring.config.location=file:///Users/TMP/resources/
Run Code Online (Sandbox Code Playgroud)

我不是试图更改配置文件的名称只是添加一个额外的位置.如下所述:

如果spring.config.location包含目录(而不是文件),则它们应该以/结尾(并且在加载之前将附加从spring.config.name生成的名称).

我将此解释为说文件$ {spring.application.name} .properties将从命令行传入的--spring.config.location加载

java spring spring-boot

12
推荐指数
2
解决办法
5万
查看次数

Spring启动配置服务器

我一直试图抓住位于以下位置的spring boot配置服务器:https://github.com/spring-cloud/spring-cloud-config并且在更详尽地阅读文档后我能够完成大部分工作我的问题 但是我必须为基于文件的PropertySourceLocator编写一个额外的类

/*
 * Copyright 2013-2014 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");


* you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT …
Run Code Online (Sandbox Code Playgroud)

spring spring-boot spring-cloud

8
推荐指数
2
解决办法
2万
查看次数

Maven资源插件排除不起作用

下面是我在maven构建中实现的资源插件.根据http://maven.apache.org/plugins/maven-resources-plugin/index.html这个配置应该是好的,但似乎忽略了排除节.我只希望复制属性文件,而不是其他任何东西,但是当我运行构建时,我得到资源目录中的所有xml,xsl和任何其他文件.我在这里遗漏了什么,或者这是资源插件的错误.

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<configuration> 
    <outputDirectory>${user.home}/cms/conf</outputDirectory>
    <resources>
        <resource>
        <directory>${basedir}/src/main/resources</directory>
        <includes>
            <include>**/*.properties</include>
        </includes>
        <excludes>
            <exclude>**/*.*</exclude>
        </excludes>
        <filtering>true</filtering>
        </resource>
    </resources>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)

maven

5
推荐指数
1
解决办法
3922
查看次数

Spring集成动态收件人输出通道

谁能告诉我下面的代码段是否可行?我希望能够在不知道特定输出渠道的情况下路由到任意数量的收件人。其他人会定义它,而我的流程只需要路由到它。

<recipient-list-router id="componentRouter" input-channel="routingChannel" 
        default-output-channel="router-out-channel-1" 
        resolution-required="false">
    <recipient channel="router-out-channel-${the selector expression}" selector-expression="payload.getChannel().contains('2')" />
</recipient-list-router>
Run Code Online (Sandbox Code Playgroud)

我知道我可以使用标头值路由器并让消息始发者填充它,但是我更希望自己找到它。我想在很多地方使用表达式来定义out通道,但是在大多数情况下这似乎是不可能的。我能够执行类似操作的一个示例是使用“目标表达式”属性使用jms通道适配器,并且我也想在路由器上应用相同类型的过程。

spring-integration

0
推荐指数
1
解决办法
1073
查看次数