Browse Source

Polishing.

Fix nullability warnings and update copyright header.

Original Pull Request: #3282
pull/3304/head
Christoph Strobl 7 months ago committed by Mark Paluch
parent
commit
00325610e8
No known key found for this signature in database
GPG Key ID: 55BC6374BAA9D973
  1. 4
      src/main/java/org/springframework/data/repository/aot/generate/AotRepositoryMetadata.java
  2. 5
      src/main/java/org/springframework/data/repository/config/RepositoryBeanDefinitionReader.java
  3. 2
      src/test/java/org/springframework/data/repository/config/DummyRegistrarWithContributor.java
  4. 2
      src/test/java/org/springframework/data/repository/config/EnableRepositoriesWithContributor.java

4
src/main/java/org/springframework/data/repository/aot/generate/AotRepositoryMetadata.java

@ -17,13 +17,15 @@ package org.springframework.data.repository.aot.generate;
import java.util.List; import java.util.List;
import org.jspecify.annotations.Nullable;
/** /**
* Value object capturing metadata about a repository. * Value object capturing metadata about a repository.
* *
* @author Mark Paluch * @author Mark Paluch
* @since 4.0 * @since 4.0
*/ */
record AotRepositoryMetadata(String name, String module, record AotRepositoryMetadata(String name, @Nullable String module,
org.springframework.data.repository.aot.generate.AotRepositoryMetadata.RepositoryType type, org.springframework.data.repository.aot.generate.AotRepositoryMetadata.RepositoryType type,
List<AotRepositoryMethod> methods) { List<AotRepositoryMethod> methods) {

5
src/main/java/org/springframework/data/repository/config/RepositoryBeanDefinitionReader.java

@ -39,6 +39,7 @@ import org.springframework.data.repository.core.support.AbstractRepositoryMetada
import org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport; import org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport;
import org.springframework.data.repository.core.support.RepositoryFragment; import org.springframework.data.repository.core.support.RepositoryFragment;
import org.springframework.data.repository.core.support.RepositoryFragmentsContributor; import org.springframework.data.repository.core.support.RepositoryFragmentsContributor;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils; import org.springframework.util.ClassUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
@ -82,6 +83,8 @@ class RepositoryBeanDefinitionReader {
*/ */
public RepositoryInformation getRepositoryInformation() { public RepositoryInformation getRepositoryInformation() {
Assert.notNull(configuration, "Configuration must not be null");
RepositoryMetadata metadata = AbstractRepositoryMetadata RepositoryMetadata metadata = AbstractRepositoryMetadata
.getMetadata(forName(configuration.getRepositoryInterface())); .getMetadata(forName(configuration.getRepositoryInterface()));
Class<?> repositoryBaseClass = getRepositoryBaseClass(); Class<?> repositoryBaseClass = getRepositoryBaseClass();
@ -178,6 +181,8 @@ class RepositoryBeanDefinitionReader {
return (RepositoryFragmentsContributor) BeanUtils.instantiateClass(getClass(bd)); return (RepositoryFragmentsContributor) BeanUtils.instantiateClass(getClass(bd));
} }
Assert.state(beanDefinition.getBeanClassName() != null, "No Repository BeanFactory set");
Class<?> repositoryFactoryBean = forName(beanDefinition.getBeanClassName()); Class<?> repositoryFactoryBean = forName(beanDefinition.getBeanClassName());
Constructor<?> constructor = ClassUtils.getConstructorIfAvailable(repositoryFactoryBean, Class.class); Constructor<?> constructor = ClassUtils.getConstructorIfAvailable(repositoryFactoryBean, Class.class);

2
src/test/java/org/springframework/data/repository/config/DummyRegistrarWithContributor.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2022-2025 the original author or authors. * Copyright 2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
src/test/java/org/springframework/data/repository/config/EnableRepositoriesWithContributor.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2025 the original author or authors. * Copyright 2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

Loading…
Cancel
Save