diff --git a/spring-data-neo4j-examples/cineasts/src/main/webapp/WEB-INF/dispatcherServlet-servlet.xml b/spring-data-neo4j-examples/cineasts/src/main/webapp/WEB-INF/dispatcherServlet-servlet.xml
index fe4e70b5a..2f428fc98 100644
--- a/spring-data-neo4j-examples/cineasts/src/main/webapp/WEB-INF/dispatcherServlet-servlet.xml
+++ b/spring-data-neo4j-examples/cineasts/src/main/webapp/WEB-INF/dispatcherServlet-servlet.xml
@@ -23,6 +23,6 @@
-
+
\ No newline at end of file
diff --git a/spring-data-neo4j-examples/hello-worlds/src/main/resources/spring/helloWorldContext.xml b/spring-data-neo4j-examples/hello-worlds/src/main/resources/spring/helloWorldContext.xml
index 74b29e2b5..121a647c4 100644
--- a/spring-data-neo4j-examples/hello-worlds/src/main/resources/spring/helloWorldContext.xml
+++ b/spring-data-neo4j-examples/hello-worlds/src/main/resources/spring/helloWorldContext.xml
@@ -15,6 +15,6 @@
-
+
diff --git a/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/config/Neo4jConfiguration.java b/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/config/Neo4jConfiguration.java
index 242765d19..69e30dd02 100644
--- a/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/config/Neo4jConfiguration.java
+++ b/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/config/Neo4jConfiguration.java
@@ -23,10 +23,12 @@ import org.neo4j.kernel.AbstractGraphDatabase;
import org.neo4j.kernel.impl.transaction.SpringTransactionManager;
import org.neo4j.kernel.impl.transaction.UserTransactionImpl;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.convert.ConversionService;
import org.springframework.dao.support.PersistenceExceptionTranslator;
+import org.springframework.data.neo4j.core.GraphDatabase;
import org.springframework.data.neo4j.fieldaccess.DelegatingFieldAccessorFactory;
import org.springframework.data.neo4j.fieldaccess.Neo4jConversionServiceFactoryBean;
import org.springframework.data.neo4j.fieldaccess.NodeDelegatingFieldAccessorFactory;
@@ -34,6 +36,7 @@ import org.springframework.data.neo4j.fieldaccess.RelationshipDelegatingFieldAcc
import org.springframework.data.neo4j.mapping.Neo4jMappingContext;
import org.springframework.data.neo4j.mapping.Neo4jNodeConverterImpl;
import org.springframework.data.neo4j.repository.DirectGraphRepositoryFactory;
+import org.springframework.data.neo4j.support.DelegatingGraphDatabase;
import org.springframework.data.neo4j.support.EntityInstantiator;
import org.springframework.data.neo4j.support.EntityStateHandler;
import org.springframework.data.neo4j.support.GraphDatabaseContext;
@@ -162,8 +165,9 @@ public abstract class Neo4jConfiguration {
return new RelationshipDelegatingFieldAccessorFactory(graphDatabaseContext());
}
- @Bean
- public PlatformTransactionManager transactionManager() {
+ @Bean(name = {"neo4jTransactionManager","transactionManager"})
+ @Qualifier("neo4jTransactionManager")
+ public PlatformTransactionManager neo4jTransactionManager() {
return createJtaTransactionManager();
}
@@ -181,9 +185,14 @@ public abstract class Neo4jConfiguration {
return jtaTm;
}
+ @Bean
+ public GraphDatabase graphDatabase() {
+ return new DelegatingGraphDatabase(graphDatabaseService);
+ }
+
@Bean
public ConfigurationCheck configurationCheck() throws Exception {
- return new ConfigurationCheck(graphDatabaseContext(),transactionManager());
+ return new ConfigurationCheck(graphDatabaseContext(),neo4jTransactionManager());
}
@Bean
diff --git a/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/transaction/Neo4jTransactional.java b/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/transaction/Neo4jTransactional.java
new file mode 100644
index 000000000..997f95e4c
--- /dev/null
+++ b/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/transaction/Neo4jTransactional.java
@@ -0,0 +1,32 @@
+/**
+ * Copyright 2011 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.data.neo4j.transaction;
+
+import org.springframework.transaction.annotation.Transactional;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation to mark transaction boundaries that should explicitely use the Neo4j Transaction Manager
+ */
+@Transactional("neo4jTransactionManager")
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.METHOD,ElementType.TYPE})
+public @interface Neo4jTransactional {
+}
diff --git a/spring-data-neo4j/src/test/resources/org/springframework/data/neo4j/config/ConfigurationCofirmationTest-context.xml b/spring-data-neo4j/src/test/resources/org/springframework/data/neo4j/config/ConfigurationCofirmationTest-context.xml
index 4cd082ba3..6d8502d1b 100644
--- a/spring-data-neo4j/src/test/resources/org/springframework/data/neo4j/config/ConfigurationCofirmationTest-context.xml
+++ b/spring-data-neo4j/src/test/resources/org/springframework/data/neo4j/config/ConfigurationCofirmationTest-context.xml
@@ -11,7 +11,7 @@
-
+