Neo4jConfig, no default constructor found. Spring REST Hateoas problems -
been fighting while, cannot past exception no matter combination of spring/neo versions use.
any appreciated.
full stacktrace: http://pastebin.com/sdm7fsba
org.springframework.beans.factory.beancreationexception: error creating bean name 'organizationrepository': cannot resolve reference bean 'neo4jtemplate' while setting bean property 'neo4jtemplate'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'io.trips.rest.webappinitializer$neo4jconfig': instantiation of bean failed; nested exception org.springframework.beans.beaninstantiationexception: not instantiate bean class [io.trips.rest.webappinitializer$neo4jconfig$$enhancerbycglib$$d147012]: no default constructor found; nested exception java.lang.nosuchmethodexception: io.trips.rest.webappinitializer$neo4jconfig$$enhancerbycglib$$d147012.<init>()
webappinitializer.java:
//@import({jpaconfig.class, mongoconfig.class}) //@importresource("classpath:meta-inf/spring/security-config.xml") @configuration @import({neo4jconfig.class}) public static class appconfig { @bean(initmethod = "loaddata") public neo4jloader dataloader() { return new neo4jloader(); } } //public class neo4jrepositoryconfig extends neo4jconfiguration { @enabletransactionmanagement @enableneo4jrepositories(basepackages = "io.trips.rest.neo4j") @configuration public class neo4jconfig extends neo4jconfiguration { static final string db_path = "target/neo4j-test-db"; @bean //(destroymethod = "shutdown") public embeddedgraphdatabase graphdatabaseservice() throws ioexception { fileutils.deleterecursively(new file(db_path)); return new embeddedgraphdatabase(db_path); } @bean public neo4jtemplate neo4jtemplate() throws ioexception { return new neo4jtemplate(graphdatabaseservice()); } @bean public neo4jmappingcontext neo4jmappingcontext() { return new neo4jmappingcontext(); } @bean public jtatransactionmanagerfactorybean transactionmanager() throws exception { return new jtatransactionmanagerfactorybean(graphdatabaseservice()); } @bean public neo4jexceptiontranslator exceptiontranslator() { return new neo4jexceptiontranslator(); } /** @bean(initmethod = "loaddata") public neo4jloader neo4jloader() { return new neo4jloader(); } */ }}
organization.java (a node)
@nodeentity public class organization { @graphid private long id; //@indexed(unique = true, indexname = "geo") string name; }
organization.repository
package io.trips.rest.neo4j; import org.springframework.data.neo4j.repository.graphrepository; public interface organizationrepository extends graphrepository<organization> { }
pom.xml:
<properties> <project.build.sourceencoding>utf-8</project.build.sourceencoding> <spring.version>3.2.2.release</spring.version> <spring.security.version>3.2.0.m1</spring.security.version> <springdata-jpa.version>1.3.1.release</springdata-jpa.version> <springdata-neo4j.version>2.2.0.release</springdata-neo4j.version> <springdata-rest-webmvc.version>1.1.0.m1</springdata-rest-webmvc.version> <jackson.version>2.1.2</jackson.version> <slf4j.version>1.7.2</slf4j.version> </properties>
here full stacktrace:
the solution move class neo4jconfig out of webappinitializer class.
Comments
Post a Comment