我正在尝试从 URL 生成 WSDL,但它/我无法做到。我的 POM.xml 文件配置如下:
<?xml version="1.0" encoding="UTF-8"?>
<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>org.springframework</groupId>
<artifactId>gs-consuming-web-service</artifactId>
<version>0.1.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.2.RELEASE</version>
</parent>
<properties>
<!-- use UTF-8 for everything -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-xjc</artifactId>
<version>2.2.5</version>
</dependency>
<dependency>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.12.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- tag::wsdl[] -->
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.12.3</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaLanguage>WSDL</schemaLanguage>
<generatePackage>hello.wsdl</generatePackage>
<schemas>
<schema>
<url>http://wsf.cdyne.com/WeatherWS/Weather.asmx?wsdl</url>
</schema> …Run Code Online (Sandbox Code Playgroud) 在我的应用程序中,我有多个带有多个键的可缓存方法:
@Cacheable(cacheNames = "valueCodes", key = "{#value, #fieldId, #projectId}")
@Cacheable(cacheNames = "fieldNames", key = "{#field, #value, #projectId}")
@Cacheable(cacheNames = "qi", key = "{#langCode, #question, #projectId}")
@Cacheable(cacheNames = "fieldCodes", key = "{#name, #projectId}")
Run Code Online (Sandbox Code Playgroud)
现在我想要一个 cachevict 方法来清除所有缓存,其中只有#projectId 键(UUID)匹配:
@CacheEvict(value = {"valueCodes", "fieldCodes", "qi"; "fieldCodes"}, key = "#projectId")
Run Code Online (Sandbox Code Playgroud)
我在这篇文章中读到这是不可能的,而且
只有 evict 注释的键正则表达式匹配每个 cacheNames 中的多个元素
我不太确定他们的意思,但我想这与在SpEL 中使用正则表达式有关。
所以我开始考虑将我的密钥合并为一个密钥:
@Cacheable(cacheNames="cahceName", key="concat(#projectId).concat(#otherKey)")
Run Code Online (Sandbox Code Playgroud)
并使用正则表达式将所有键与 projectId 后跟通配符匹配。但我真的找不到办法做到这一点。
我正在努力实现的可能吗?如果是这样,我该怎么做?
在ES 5.1中索引我的数据时遇到的第一个错误是我的完成建议映射,其中包含一个输出字段.
message [MapperParsingException[failed to parse]; nested: IllegalArgumentException[unknown field name [output], must be one of [input, weight, contexts]];]
所以我删除了它,但现在很多我的自动完成都不正确,因为它返回匹配的输入而不是单个输出字符串.
经过一些谷歌搜索我发现ES的这篇文章提到了以下内容:
由于建议是面向文档的,因此现在应将建议元数据(例如输出)指定为文档中的字段.删除索引建议条目时指定输出的支持.现在建议结果条目的文本始终是建议输入的未分析值(与在5.0之前的索引中索引建议时未指定输出相同).
我发现原始值是带有随建议返回的_source字段,但它对我来说并不是真正的解决方案,因为键和结构会根据它来自的原始对象而改变.
我可以在原始对象上添加一个额外的"输出"字段,但这对我来说也不是解决方案,因为在某些情况下我有这样的结构:
{
"id": "c2358e0c-7399-4665-ac2c-0bdd44597ac0",
"synonyms": ["All available colours", "Colors"],
"autoComplete": [{
"input": ["colours available all", "available colours all", "available all colours", "colours all available", "all available colours", "all colours available"]
}, {
"input": ["colors"]
}]
}
Run Code Online (Sandbox Code Playgroud)
在ES 2.4中,结构如下:
{
"id": "c2358e0c-7399-4665-ac2c-0bdd44597ac0",
"synonyms": ["All available colours", "Colors"],
"SmartSynonym": [{
"input": ["colours available all", "available colours all", "available …Run Code Online (Sandbox Code Playgroud) 在我的单元测试中,我想通过执行以下操作来模拟与elasticsearch的交互
when(cityDefinitionRepository.findCitiesNearby(geoPoint, SOURCE, 2)).thenReturn(cityDefinitionsArrival);
when(cityDefinitionRepository.findCitiesNearby(geoPoint2, SOURCE, 2)).thenReturn(cityDefinitionsDeparture);
SearchResult results = benerailService.doSearch(interpretation, 2, false);
Run Code Online (Sandbox Code Playgroud)
doSearch方法包含
departureCityDefinitions = cityDefinitionRepository.findCitiesNearby(geo, SOURCE, distance);
Run Code Online (Sandbox Code Playgroud)
当我调试我的代码时,我看到mockito在我的doSearch方法中被调用,但它没有返回cityDefinitionsArrival对象.这可能是因为geoPoint和geo是两个不同的对象.
geoPoint和geo对象都是包含相同纬度和经度的elasticsearch GeoPoints.
我设法通过这样做来实现这一点
when(cityDefinitionRepository.findCitiesNearby(any(geoPoint.getClass()), eq(SOURCE), eq(2))).thenReturn(cityDefinitionsArrival);
when(cityDefinitionRepository.findCitiesNearby(any(geoPoint2.getClass()), eq(SOURCE), eq(2))).thenReturn(cityDefinitionsDeparture);
Run Code Online (Sandbox Code Playgroud)
但现在它忽略了我的纬度和经度值并接受了GeoPoint类的任何对象.这是一个问题,因为在我的doSearch方法中,我有两个使用findCitiesNearby,每个都有不同的纬度和经度,我需要单独模拟它们.
这可能与Mockito一起吗?
cityDefinitionsArrival和cityDefinitionsDeparture都是ArrayLists,SOURCE是String值以及geo和geoPoint对象:
GeoPoint geoPoint = new GeoPoint(50.850449999999995, 4.34878);
GeoPoint geoPoint2 = new GeoPoint(48.861710, 2.348923);
double lat = 50.850449999999995;
double lon = 4.34878;
GeoPoint geo = new GeoPoint(lat, lon);
double lat2 = 48.861710;
double lon2 = 2.348923;
GeoPoint geo2 = new GeoPoint(lat2, lon2);
Run Code Online (Sandbox Code Playgroud) 我有一个位于Tomcat的属性文件和一个位于src/test/resources中的测试属性文件.
目前我有以下设置.我的属性文件加载到我的XML文件 config.xml中
<?xml version="1.0" encoding="UTF-8"?>
<!-- Repository and Service layers -->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd">
<!-- ========================= RESOURCE DEFINITIONS ========================= -->
<context:component-scan base-package="be.omniatravel.service" />
<context:property-placeholder
location="file:${catalina.base}/conf/omniatravel.properties"
ignore-unresolvable="true" />
<tx:annotation-driven />
</beans>
Run Code Online (Sandbox Code Playgroud)
测试-config.xml中
<?xml version="1.0" encoding="UTF-8"?>
<!-- Repository and Service layers -->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd">
<!-- ========================= RESOURCE DEFINITIONS ========================= -->
<context:component-scan base-package="be.omniatravel.service" /> …Run Code Online (Sandbox Code Playgroud) java ×4
spring ×3
autocomplete ×1
caching ×1
encryption ×1
evict ×1
matcher ×1
maven ×1
mockito ×1
spring-el ×1
stubbing ×1
unit-testing ×1
web-services ×1
wsdl ×1
xml ×1