看起来我在Spring 4.1.1中使用Spring Boot 1.2.6.RELEASE做的事情根本不起作用.我只是想访问应用程序属性并在必要时使用测试覆盖它们(不使用hack手动注入PropertySource)
这不起作用..
@TestPropertySource(properties = {"elastic.index=test_index"})
Run Code Online (Sandbox Code Playgroud)
这也不是..
@TestPropertySource(locations = "/classpath:document.properties")
Run Code Online (Sandbox Code Playgroud)
也不是..
@PropertySource("classpath:/document.properties")
Run Code Online (Sandbox Code Playgroud)
完整测试案例..
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(loader = AnnotationConfigContextLoader.class)
@TestPropertySource(properties = {"elastic.index=test_index"})
public class PropertyTests {
@Value("${elastic.index}")
String index;
@Configuration
@TestPropertySource(properties = {"elastic.index=test_index"})
static class ContextConfiguration {
}
@Test
public void wtf() {
assertEquals("test_index", index);
}
}
Run Code Online (Sandbox Code Playgroud)
导致
org.junit.ComparisonFailure:
Expected :test_index
Actual :${elastic.index}
Run Code Online (Sandbox Code Playgroud)
似乎3.x和4.x之间存在很多相互矛盾的信息,我找不到任何可行的信息.
任何见解将不胜感激.干杯!
在我们的Eclipse插件应用程序中,Eclipse启动时需要很长时间,用户在应用程序的左下角看到"Initialize Java tooling"消息.因为我们的用户与java没有任何关系,我想知道是否可以禁用Initialize Java工具.
另一个问题:什么是Initialize Java工具?
我想在"常规"Maven 3版本(例如JAR或WAR包装)中使用来自远程Eclipse p2存储库的依赖项 - 所有这些都没有将p2 repo转换为本地Maven repo(这是osgi-to-maven2和m4e似乎做).
理想情况下,我只使用http://maven.eclipse.org/nexus/,但这不包含(但是?)包含许多包.
使用Maven的systemPath不算数!
我知道在版本控制中至少有10种不同的方法来构建项目.我很好奇使用的方法是什么,哪些方法适合你.我曾与SVN,TFS以及目前/不幸的VSS合作过.我已经看到版本控制实现得非常糟糕而且很好,但从来都不是很好.
为了让球滚动,这里是对我所看到的事情的回顾.
此示例基于SVN,但适用于大多数VCS(与分布式版本控制无关).
分支作为site/division/web/projectName/vb/src/[trunk | branches | tags]一部分的各个项目
分支整个站点,在我看到的情况下,整个站点除了核心组件是分支的./部门/ [车厢|分支机构|标签] /网站/项目名称/ VB/src目录/
使用main-line作为默认值,仅在必要时进行分支以进行大量更改.
你如何处理Jenkins作业到你的构建过程的映射,你是否能够在继承中构建级联配置?
对于任何给定的构建,我将至少有三个作业(标准的持续集成/夜间,安全扫描,覆盖),然后是一些下游集成测试作业.配置切片器插件处理交叉作业的某些方面,但每个作业仍然是它自己的单独实体,与其组中的其他作业无关.
我最近看到了QuickBuild并且它具有作业继承,其中父作业可以定义一组标准步骤,其子代可以覆盖和专门化.有詹金斯,我有工作的副本,这是好的,直到我需要改变一些东西.使用QuickBuild,作业之间的关系可以让我轻松地传播我的更改.
我一直试图弄清楚如何在詹金斯处理这个问题.我可以使用参数化构建触发器插件来允许作业调用其他人并覆盖方面.然后,我将从被叫作业中的数据收集到其调用者.我怀疑我会遇到一系列问题,其中有些方面我无法覆盖,这将迫使我在我自己的脚本中实现Jenkins功能,从而使Jenkins不那么有用.
你如何处理詹金斯的构建工作的复杂性?您是否听说过QuickBuild存在任何严重问题?
String url = "http://maps.googleapis.com/maps/api/distancematrix/xml?origins="+origin+"&destinations="+destination+"&mode=driving&sensor=false&language=en-EN&units=imperial";
url = url.replaceAll(" ", "%20");
Run Code Online (Sandbox Code Playgroud)
输出:
http://maps.googleapis.com/maps/api/distancematrix/xml?origins=150%20Sutter%20St%20San%20Francisco,%20CA,%20United%20States&destinations=1%20Palmer%20Sq%20E
Princeton,%20NJ%2008542&mode=driving&sensor=false&language=en-EN&units=imperial
Run Code Online (Sandbox Code Playgroud)
但我收到一个错误说:
java.net.MalformedURLException: Illegal character in URL
Run Code Online (Sandbox Code Playgroud)
有人可以帮我吗 ..
我有一个这样的模型:
private String message;
private Integer errorCode;
private String data;
Run Code Online (Sandbox Code Playgroud)
我从远程和消息中获取JSON字符串,errorCode变量获取正确的值.但是我不想反序列化到我的数据变量.我希望它是一个json字符串,如:
{"data": {"cat": "1.2.3.4", "ner": "80", "name": "pinta" }, "message" : "m", "errorCode" : 12}
Run Code Online (Sandbox Code Playgroud)
之后,我将反序列化它以反对自己.我怎样才能做到这一点?
PS:澄清问题:
我得到一个类似的Json字符串:
{"data":{"cat":"1.2.3.4","ner":"80","name":"pinta"},"message":"m","errorCode":12}
反序列化后,我的变量应具有以下值:
{"cat": "1.2.3.4", "ner": "80", "name": "pinta" }
Run Code Online (Sandbox Code Playgroud) 由于不清楚的原因,Eclipse最近每次调试项目时都会启动两个控制台.一个控制台显示典型的控制台信息(stdout,stderr等),另一个不显示任何内容.标题是相同的,除了空控制台的前缀是"[Debug Console]".空的也出现在顶部,这非常不方便.
我没有在Eclipse的首选项或Google上找到任何有用的东西.有没有人知道为什么会发生这种情况以及如何阻止它?
我想使用eclipse-plugin
打包在Maven中构建一个项目,但是我的POM出现以下错误:
[ERROR] Unknown packaging: eclipse-plugin @ line 15, column 13 .
Run Code Online (Sandbox Code Playgroud)
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>
<parent>
<relativePath>../releng/pom.xml</relativePath>
<groupId>net.sf.logsaw</groupId>
<artifactId>parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>net.sf.logsaw.core</artifactId>
<version>1.0.4-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>LogSaw Core Plugin</name>
</project>
Run Code Online (Sandbox Code Playgroud) 当我使用"cat test.file"时,它会显示
printf "This is a test log %d \n, testid";
1
2
Run Code Online (Sandbox Code Playgroud)
当我使用bash文件时
IFS=""
while read data
do
echo "$data"
done << test.file
Run Code Online (Sandbox Code Playgroud)
它会显示出来
printf "This is a test log %d n, testid";
1
2
Run Code Online (Sandbox Code Playgroud)
"\"消失了.
有什么方法可以同时保留"\"和空格吗?
java ×5
eclipse ×3
maven ×2
bash ×1
branch ×1
build ×1
eclipse-pde ×1
eclipse-rcp ×1
jackson ×1
jenkins ×1
json ×1
junit ×1
maven-3 ×1
quickbuild ×1
spring ×1
spring-boot ×1
svn ×1
tfs ×1
tycho ×1
url ×1