diff --git a/src/main/java/org/springframework/data/jpa/repository/config/AuditingBeanDefinitionParser.java b/src/main/java/org/springframework/data/jpa/repository/config/AuditingBeanDefinitionParser.java
index e08f4cd8b..304d3fa14 100644
--- a/src/main/java/org/springframework/data/jpa/repository/config/AuditingBeanDefinitionParser.java
+++ b/src/main/java/org/springframework/data/jpa/repository/config/AuditingBeanDefinitionParser.java
@@ -38,7 +38,7 @@ import org.w3c.dom.Element;
*/
public class AuditingBeanDefinitionParser implements BeanDefinitionParser {
- private static final String AUDITING_ENTITY_LISTENER_CLASS_NAME =
+ static final String AUDITING_ENTITY_LISTENER_CLASS_NAME =
"org.springframework.data.jpa.domain.support.AuditingEntityListener";
private static final String AUDITING_BFPP_CLASS_NAME =
"org.springframework.data.jpa.domain.support.AuditingBeanFactoryPostProcessor";
@@ -66,6 +66,9 @@ public class AuditingBeanDefinitionParser implements BeanDefinitionParser {
createLazyInitTargetSourceBeanDefinition(auditorAwareRef));
}
+ builder.addPropertyValue("dateTimeForNow",
+ element.getAttribute("set-dates"));
+
registerInfrastructureBeanWithId(builder.getRawBeanDefinition(),
AUDITING_ENTITY_LISTENER_CLASS_NAME, parser, element);
diff --git a/src/main/resources/org/springframework/data/jpa/repository/config/spring-jpa-1.0.xsd b/src/main/resources/org/springframework/data/jpa/repository/config/spring-jpa-1.0.xsd
index 945869226..75341c3fc 100644
--- a/src/main/resources/org/springframework/data/jpa/repository/config/spring-jpa-1.0.xsd
+++ b/src/main/resources/org/springframework/data/jpa/repository/config/spring-jpa-1.0.xsd
@@ -35,11 +35,6 @@
-
-
-
-
-
@@ -53,6 +48,7 @@
+
diff --git a/src/test/java/org/springframework/data/jpa/repository/config/AuditingBeanDefinitionParserTests.java b/src/test/java/org/springframework/data/jpa/repository/config/AuditingBeanDefinitionParserTests.java
new file mode 100644
index 000000000..6cb1598fe
--- /dev/null
+++ b/src/test/java/org/springframework/data/jpa/repository/config/AuditingBeanDefinitionParserTests.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2008-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.jpa.repository.config;
+
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.springframework.beans.PropertyValue;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.xml.XmlBeanFactory;
+import org.springframework.core.io.ClassPathResource;
+
+
+/**
+ * Integration tests for {@link AuditingBeanDefinitionParser}.
+ *
+ * @author Oliver Gierke
+ */
+public class AuditingBeanDefinitionParserTests {
+
+ @Test
+ public void settingDatesIsConfigured() throws Exception {
+
+ assertSetDatesIsSetTo("auditing/auditing-namespace-context.xml", "true");
+ }
+
+
+ @Test
+ public void notSettingDatesIsConfigured() throws Exception {
+
+ assertSetDatesIsSetTo("auditing/auditing-namespace-context2.xml",
+ "false");
+ }
+
+
+ private void assertSetDatesIsSetTo(String configFile, String value) {
+
+ XmlBeanFactory factory =
+ new XmlBeanFactory(new ClassPathResource(configFile));
+ BeanDefinition definition =
+ factory.getBeanDefinition(AuditingBeanDefinitionParser.AUDITING_ENTITY_LISTENER_CLASS_NAME);
+ PropertyValue propertyValue =
+ definition.getPropertyValues().getPropertyValue(
+ "dateTimeForNow");
+ assertThat(propertyValue, is(notNullValue()));
+ assertThat((String) propertyValue.getValue(), is(value));
+ }
+}
diff --git a/src/test/resources/auditing/auditing-namespace-context2.xml b/src/test/resources/auditing/auditing-namespace-context2.xml
new file mode 100644
index 000000000..5a4cfc244
--- /dev/null
+++ b/src/test/resources/auditing/auditing-namespace-context2.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
\ No newline at end of file