diff --git a/src/docbkx/jpa.xml b/src/docbkx/jpa.xml
index 555a5a64a..9b56842bd 100644
--- a/src/docbkx/jpa.xml
+++ b/src/docbkx/jpa.xml
@@ -1156,13 +1156,13 @@ public interface UserRepository extends JpaRepository<User, Long> {
<jpa:auditing auditor-aware-ref="yourAuditorAwareBean" />
+ As of Spring Data JPA 1.5, auditing can be enabled by annotating a
+ configuration class with the @EnableJpaAuditing
+ annotation.
+
Activating auditing via Java configuration
- As of Spring Data JPA 1.5, auditing can be enabled by annotating
- a configuration class with the
- EnableJpaAuditing annotation.
-
@Configuration
@EnableJpaAuditing
class Config {
@@ -1172,17 +1172,17 @@ class Config {
return new AuditorAwareImpl();
}
}
-
- If you expose a bean of type
- AuditorAware to the
- ApplicationContext, the auditing
- infrastructure will pick it up automatically and use it to determine
- the current user to be set on domain types. If you have multiple
- implementations registered in the
- ApplicationContext, you can select the
- one to be used by explicitly setting the auditorAwareRef attribute of
- @EnableJpaAuditing.
+
+ If you expose a bean of type
+ AuditorAware to the
+ ApplicationContext, the auditing
+ infrastructure will pick it up automatically and use it to determine the
+ current user to be set on domain types. If you have multiple
+ implementations registered in the
+ ApplicationContext, you can select the
+ one to be used by explicitly setting the auditorAwareRef
+ attribute of @EnableJpaAuditing.
diff --git a/src/main/java/org/springframework/data/jpa/repository/config/EnableJpaAuditing.java b/src/main/java/org/springframework/data/jpa/repository/config/EnableJpaAuditing.java
index 91727a3ac..b52888045 100644
--- a/src/main/java/org/springframework/data/jpa/repository/config/EnableJpaAuditing.java
+++ b/src/main/java/org/springframework/data/jpa/repository/config/EnableJpaAuditing.java
@@ -22,7 +22,6 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import org.joda.time.DateTime;
import org.springframework.context.annotation.Import;
import org.springframework.data.auditing.DateTimeProvider;
import org.springframework.data.domain.AuditorAware;
@@ -62,8 +61,8 @@ public @interface EnableJpaAuditing {
boolean modifyOnCreate() default true;
/**
- * Configures a {@link DateTimeProvider} bean name that allows customizing the {@link DateTime} to be used for setting
- * creation and modification dates.
+ * Configures a {@link DateTimeProvider} bean name that allows customizing the {@link org.joda.time.DateTime} to be
+ * used for setting creation and modification dates.
*
* @return
*/
diff --git a/src/main/java/org/springframework/data/jpa/repository/config/JpaAuditingRegistrar.java b/src/main/java/org/springframework/data/jpa/repository/config/JpaAuditingRegistrar.java
index 796b8eb84..13c985d07 100644
--- a/src/main/java/org/springframework/data/jpa/repository/config/JpaAuditingRegistrar.java
+++ b/src/main/java/org/springframework/data/jpa/repository/config/JpaAuditingRegistrar.java
@@ -59,8 +59,8 @@ class JpaAuditingRegistrar extends AuditingBeanDefinitionRegistrarSupport {
@Override
public void registerBeanDefinitions(AnnotationMetadata annotationMetadata, BeanDefinitionRegistry registry) {
- Assert.notNull(annotationMetadata, "annotationMetadata must not be null!");
- Assert.notNull(annotationMetadata, "registry must not be null!");
+ Assert.notNull(annotationMetadata, "AnnotationMetadata must not be null!");
+ Assert.notNull(registry, "BeanDefinitionRegistry must not be null!");
registerBeanConfigurerAspectIfNecessary(registry);
super.registerBeanDefinitions(annotationMetadata, registry);
diff --git a/src/test/java/org/springframework/data/jpa/repository/config/JpaAuditingRegistrarUnitTests.java b/src/test/java/org/springframework/data/jpa/repository/config/JpaAuditingRegistrarUnitTests.java
new file mode 100644
index 000000000..37b9f45f5
--- /dev/null
+++ b/src/test/java/org/springframework/data/jpa/repository/config/JpaAuditingRegistrarUnitTests.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2013 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 org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+import org.springframework.core.type.AnnotationMetadata;
+
+/**
+ * Unit tests for {@link JpaAuditingRegistrar}.
+ *
+ * @see DATAJPA-265
+ * @author Oliver Gierke
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class JpaAuditingRegistrarUnitTests {
+
+ JpaAuditingRegistrar registrar = new JpaAuditingRegistrar();
+
+ @Mock AnnotationMetadata metadata;
+ @Mock BeanDefinitionRegistry registry;
+
+ @Test(expected = IllegalArgumentException.class)
+ public void rejectsNullAnnotationMetadata() {
+ registrar.registerBeanDefinitions(null, registry);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void rejectsNullBeanDefinitionRegistry() {
+ registrar.registerBeanDefinitions(metadata, null);
+ }
+}