Spring Data Couchbase - CustomConversions

时间:2018-02-20 10:59:56

标签: java spring spring-data couchbase spring-data-couchbase

如果使用 spring-data-couchbase 3.0.4 ,则会引发以下异常:

java.lang.NoClassDefFoundError: org/springframework/data/convert/CustomConversions
at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_25]
at java.lang.Class.privateGetDeclaredMethods(Class.java:2693) ~[na:1.8.0_25]
at java.lang.Class.getDeclaredMethods(Class.java:1967) ~[na:1.8.0_25]
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:613) ~[spring-core-4.3.14.RELEASE.jar:4.3.14.RELEASE]
...
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE]
at com.avaya.ept.couchbase.CouchbaseApplication.main(CouchbaseApplication.java:9) [main/:na]
Caused by: java.lang.ClassNotFoundException: org.springframework.data.convert.CustomConversions
at java.net.URLClassLoader$1.run(URLClassLoader.java:372) ~[na:1.8.0_25]
at java.net.URLClassLoader$1.run(URLClassLoader.java:361) ~[na:1.8.0_25]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_25]
at java.net.URLClassLoader.findClass(URLClassLoader.java:360) ~[na:1.8.0_25]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_25]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) ~[na:1.8.0_25]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_25]
... 31 common frames omitted

Couchbase配置为默认值:

@Configuration
@EnableCouchbaseRepositories(basePackages={"com.test.couchbase.repositories"})
public class CouchbaseConfig extends AbstractCouchbaseConfiguration {

public static final List<String> NODE_LIST = Arrays.asList("couchbase");
public static final String BUCKET_NAME = "test_name";
public static final String BUCKET_PASSWORD = "test_password";

@Override
protected List<String> getBootstrapHosts() {
    return NODE_LIST;
}

@Override
protected String getBucketName() {
    return BUCKET_NAME;
}

@Override
protected String getBucketPassword() {
    return BUCKET_PASSWORD;
}

如果使用spring-data-couchbase 2.2.10,则不会出现此类错误。

UPD:

我找到了一些细节。 spring-data-couchbase 3.0.4 使用类org.springframework.core.ReactiveTypeDescriptor和接口org.springframework.core.ErrorCoded。该类已在Spring 5.0.0发布中添加,该接口已从Spring 5.0.0发布中删除。 我需要使用什么Spring版本来使用 spring-data-couchbase 3.0.4

0 个答案:

没有答案