Spring Data Couchbase and Spring Data MongoDB at the same time use -


i want use spring data couchbase , spring data mongodb @ same time. has error happen, both hava bean customconversions defined. so, how deal it?

this stacktrace

caused by: java.lang.classcastexception: org.springframework.data.mongodb.core.convert.customconversions cannot cast org.springframework.data.couchbase.core.convert.customconversions     @ com.*.*.config.dev.developmentcouchbaseconfig$$enhancerbyspringcglib$$64a18d5.customconversions(<generated>)     @ org.springframework.data.couchbase.config.abstractcouchbaseconfiguration.couchbasemappingcontext(abstractcouchbaseconfiguration.java:157)     @ com.*.*.config.dev.developmentcouchbaseconfig$$enhancerbyspringcglib$$64a18d5.cglib$couchbasemappingcontext$13(<generated>)     @ com.*.*.config.dev.developmentcouchbaseconfig$$enhancerbyspringcglib$$64a18d5$$fastclassbyspringcglib$$7675b050.invoke(<generated>)     @ org.springframework.cglib.proxy.methodproxy.invokesuper(methodproxy.java:228)     @ org.springframework.context.annotation.configurationclassenhancer$beanmethodinterceptor.intercept(configurationclassenhancer.java:309)     @ com.*.*.config.dev.developmentcouchbaseconfig$$enhancerbyspringcglib$$64a18d5.couchbasemappingcontext(<generated>)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:497)     @ org.springframework.beans.factory.support.simpleinstantiationstrategy.instantiate(simpleinstantiationstrategy.java:162)     ... 65 more 

i find way:

just override , rename bean.

this couchbase config:

public class couchbaseconfig extends abstractcouchbaseconfiguration {     @override     @bean(name = "couchbaseconversions")     public customconversions customconversions() {         return new customconversions(collections.emptylist());     } } 

and mongodb config:

public class mongodbconfig extends abstractmongoconfiguration {     @override     @bean(name = "mongodbconversions")     public customconversions customconversions() {         return new customconversions(collections.emptylist());     } } 

thanks.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -