DATAGRAPH-500 - Polishing of the CDI extension.

Removed the default constructor in DelegatingGraphDatabase as its presences causes the type to become a managed bean. As the integration tests create a dedicated instance of GraphDatabase via a @Producer method we now fail to resolve a unique instance.

Made all repositories eager CDI beans as the lazy instantiation might break the transaction during query lookups.

Original pull request: #198.
This commit is contained in:
Oliver Gierke
2014-08-12 16:54:24 +02:00
parent 8a9b3d6471
commit 7573cb1e38
6 changed files with 12 additions and 21 deletions

View File

@@ -63,10 +63,6 @@ public class DelegatingGraphDatabase implements GraphDatabase {
private ResultConverter resultConverter;
private volatile CypherQueryEngineImpl cypherQueryEngine;
// just for CDI
public DelegatingGraphDatabase() {
}
public DelegatingGraphDatabase(final GraphDatabaseService delegate) {
this(delegate,null);
}

View File

@@ -35,7 +35,6 @@ import org.springframework.data.neo4j.model.Person;
* @author Nicki Watt
* @author Oliver Gierke
*/
@Ignore("Bad transaction handling")
public class CdiExtensionIntegrationTests {
static CdiTestContainer container;
@@ -52,7 +51,6 @@ public class CdiExtensionIntegrationTests {
}
@Test
@SuppressWarnings("null")
public void testRepositoryStyle1IsCreatedCorrectly() {
GraphDatabase database = container.getInstance(GraphDatabase.class);
@@ -82,7 +80,6 @@ public class CdiExtensionIntegrationTests {
}
@Test
@SuppressWarnings("null")
public void testRepositoryStyle2IsCreatedCorrectly() {
GraphDatabase database = container.getInstance(GraphDatabase.class);
@@ -112,7 +109,6 @@ public class CdiExtensionIntegrationTests {
}
@Test
@SuppressWarnings("null")
public void neo4jCrudRepositorySubTypeWorks() {
GraphDatabase database = container.getInstance(GraphDatabase.class);

View File

@@ -17,7 +17,9 @@ package org.springframework.data.neo4j.repository.cdi;
import org.springframework.data.neo4j.model.Person;
import org.springframework.data.repository.Repository;
import org.springframework.data.repository.cdi.Eager;
@Eager
public interface CdiPersonRepository extends Repository<Person, Long> {
void deleteAll();

View File

@@ -17,8 +17,7 @@ package org.springframework.data.neo4j.repository.cdi;
import org.springframework.data.neo4j.model.Person;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.cdi.Eager;
public interface CdiPersonRepository2 extends CrudRepository<Person, Long> {
}
@Eager
public interface CdiPersonRepository2 extends CrudRepository<Person, Long> {}

View File

@@ -17,9 +17,7 @@ package org.springframework.data.neo4j.repository.cdi;
import org.springframework.data.neo4j.model.Person;
import org.springframework.data.neo4j.repository.CRUDRepository;
import org.springframework.data.repository.cdi.Eager;
public interface CdiPersonRepository3 extends CRUDRepository<Person> {
}
@Eager
public interface CdiPersonRepository3 extends CRUDRepository<Person> {}

View File

@@ -17,11 +17,11 @@ package org.springframework.data.neo4j.repository.cdi;
import org.springframework.data.neo4j.model.Person;
import org.springframework.data.repository.Repository;
import org.springframework.data.repository.cdi.Eager;
/**
* @author Mark Paluch
* @see DATAGRAPH-500
* @author Mark Paluch
*/
public interface SamplePersonRepository extends Repository<Person, Long>, SamplePersonRepositoryCustom {
}
@Eager
public interface SamplePersonRepository extends Repository<Person, Long>, SamplePersonRepositoryCustom {}