1616package org .springframework .data .cassandra .repository .aot ;
1717
1818import java .lang .annotation .Annotation ;
19- import java .util .Collection ;
20- import java .util .List ;
2119import java .util .Set ;
22- import java .util .function .Consumer ;
2320
2421import org .jspecify .annotations .Nullable ;
2522
26- import org .springframework .beans .factory .config . ConfigurableListableBeanFactory ;
23+ import org .springframework .beans .factory .BeanFactory ;
2724import org .springframework .core .annotation .MergedAnnotation ;
28- import org .springframework .core .env .Environment ;
29- import org .springframework .core .env .StandardEnvironment ;
30- import org .springframework .data .aot .AotTypeConfiguration ;
25+ import org .springframework .data .aot .AotContext ;
3126import org .springframework .data .cassandra .core .Person ;
3227import org .springframework .data .cassandra .core .mapping .Table ;
3328import org .springframework .data .cassandra .repository .support .SimpleCassandraRepository ;
3429import org .springframework .data .repository .config .AotRepositoryContext ;
30+ import org .springframework .data .repository .config .AotRepositoryContextSupport ;
3531import org .springframework .data .repository .config .AotRepositoryInformation ;
3632import org .springframework .data .repository .config .RepositoryConfigurationSource ;
3733import org .springframework .data .repository .core .RepositoryInformation ;
4440 *
4541 * @author Mark Paluch
4642 */
47- public class TestCassandraAotRepositoryContext <T > implements AotRepositoryContext {
43+ public class TestCassandraAotRepositoryContext <T > extends AotRepositoryContextSupport {
4844
4945 private final AotRepositoryInformation repositoryInformation ;
5046 private final Class <T > repositoryInterface ;
5147 private final RepositoryConfigurationSource configurationSource ;
52- private @ Nullable ConfigurableListableBeanFactory beanFactory ;
5348
54- public TestCassandraAotRepositoryContext (Class <T > repositoryInterface , @ Nullable RepositoryComposition composition ,
49+ public TestCassandraAotRepositoryContext (BeanFactory beanFactory , Class <T > repositoryInterface ,
50+ @ Nullable RepositoryComposition composition ,
5551 RepositoryConfigurationSource configurationSource ) {
52+ super (AotContext .from (beanFactory ));
5653 this .repositoryInterface = repositoryInterface ;
5754 this .configurationSource = configurationSource ;
5855
@@ -68,31 +65,6 @@ public Class<T> getRepositoryInterface() {
6865 return repositoryInterface ;
6966 }
7067
71- @ Override
72- public ConfigurableListableBeanFactory getBeanFactory () {
73- return beanFactory ;
74- }
75-
76- @ Override
77- public Environment getEnvironment () {
78- return new StandardEnvironment ();
79- }
80-
81- @ Override
82- public TypeIntrospector introspectType (String typeName ) {
83- return null ;
84- }
85-
86- @ Override
87- public IntrospectedBeanDefinition introspectBeanDefinition (String beanName ) {
88- return null ;
89- }
90-
91- @ Override
92- public String getBeanName () {
93- return "dummyRepository" ;
94- }
95-
9668 @ Override
9769 public String getModuleName () {
9870 return "Cassandra" ;
@@ -128,22 +100,4 @@ public Set<Class<?>> getResolvedTypes() {
128100 return Set .of (Person .class );
129101 }
130102
131- @ Override
132- public Set <Class <?>> getUserDomainTypes () {
133- return Set .of ();
134- }
135-
136- @ Override
137- public void typeConfiguration (Class <?> type , Consumer <AotTypeConfiguration > configurationConsumer ) {
138-
139- }
140-
141- @ Override
142- public Collection <AotTypeConfiguration > typeConfigurations () {
143- return List .of ();
144- }
145-
146- public void setBeanFactory (ConfigurableListableBeanFactory beanFactory ) {
147- this .beanFactory = beanFactory ;
148- }
149103}
0 commit comments