File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed
src/main/java/org/springframework/data/elasticsearch/repository/query Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" encoding =" UTF-8" standalone =" no" ?>
2
2
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd" >
3
3
4
- <modelVersion >4.0.0</modelVersion >
4
+ <modelVersion >4.0.0</modelVersion >
5
5
6
6
<groupId >org.springframework.data</groupId >
7
7
<artifactId >spring-data-elasticsearch</artifactId >
144
144
<groupId >joda-time</groupId >
145
145
<artifactId >joda-time</artifactId >
146
146
<version >${jodatime} </version >
147
+ <optional >true</optional >
147
148
</dependency >
148
149
149
150
<!-- Elasticsearch -->
Original file line number Diff line number Diff line change 24
24
import org .springframework .data .elasticsearch .core .query .StringQuery ;
25
25
import org .springframework .data .repository .query .ParametersParameterAccessor ;
26
26
import org .springframework .util .Assert ;
27
+ import org .springframework .util .ClassUtils ;
27
28
import org .springframework .util .NumberUtils ;
28
29
29
30
/**
33
34
* @author Mohsin Husen
34
35
* @author Mark Paluch
35
36
* @author Taylor Ono
37
+ * @author Peter-Josef Meisch
36
38
*/
37
39
public class ElasticsearchStringQuery extends AbstractElasticsearchRepositoryQuery {
38
40
@@ -45,11 +47,13 @@ public class ElasticsearchStringQuery extends AbstractElasticsearchRepositoryQue
45
47
if (!conversionService .canConvert (java .util .Date .class , String .class )) {
46
48
conversionService .addConverter (DateTimeConverters .JavaDateConverter .INSTANCE );
47
49
}
48
- if (!conversionService .canConvert (org .joda .time .ReadableInstant .class , String .class )) {
49
- conversionService .addConverter (DateTimeConverters .JodaDateTimeConverter .INSTANCE );
50
- }
51
- if (!conversionService .canConvert (org .joda .time .LocalDateTime .class , String .class )) {
52
- conversionService .addConverter (DateTimeConverters .JodaLocalDateTimeConverter .INSTANCE );
50
+ if (ClassUtils .isPresent ("org.joda.time.DateTimeZone" , ElasticsearchStringQuery .class .getClassLoader ())) {
51
+ if (!conversionService .canConvert (org .joda .time .ReadableInstant .class , String .class )) {
52
+ conversionService .addConverter (DateTimeConverters .JodaDateTimeConverter .INSTANCE );
53
+ }
54
+ if (!conversionService .canConvert (org .joda .time .LocalDateTime .class , String .class )) {
55
+ conversionService .addConverter (DateTimeConverters .JodaLocalDateTimeConverter .INSTANCE );
56
+ }
53
57
}
54
58
}
55
59
You can’t perform that action at this time.
0 commit comments