16
16
package org .springframework .data .jdbc .repository .aot ;
17
17
18
18
import java .lang .annotation .Annotation ;
19
- import java .util .Collection ;
20
- import java .util .List ;
21
19
import java .util .Set ;
22
- import java .util .function .Consumer ;
23
20
24
21
import org .jspecify .annotations .Nullable ;
25
22
26
- import org .springframework .beans .factory .config . ConfigurableListableBeanFactory ;
23
+ import org .springframework .beans .factory .BeanFactory ;
27
24
import 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 ;
31
26
import org .springframework .data .jdbc .repository .support .SimpleJdbcRepository ;
32
27
import org .springframework .data .relational .core .mapping .Table ;
33
28
import org .springframework .data .repository .config .AotRepositoryContext ;
29
+ import org .springframework .data .repository .config .AotRepositoryContextSupport ;
34
30
import org .springframework .data .repository .config .AotRepositoryInformation ;
35
31
import org .springframework .data .repository .config .RepositoryConfigurationSource ;
36
32
import org .springframework .data .repository .core .RepositoryInformation ;
43
39
*
44
40
* @author Mark Paluch
45
41
*/
46
- public class TestJdbcAotRepositoryContext <T > implements AotRepositoryContext {
42
+ public class TestJdbcAotRepositoryContext <T > extends AotRepositoryContextSupport {
47
43
48
44
private final AotRepositoryInformation repositoryInformation ;
49
- private final Class <T > repositoryInterface ;
50
45
private final RepositoryConfigurationSource configurationSource ;
51
- private @ Nullable ConfigurableListableBeanFactory beanFactory ;
52
46
53
- public TestJdbcAotRepositoryContext (Class <T > repositoryInterface , @ Nullable RepositoryComposition composition ,
47
+ public TestJdbcAotRepositoryContext (BeanFactory beanFactory , Class <T > repositoryInterface ,
48
+ @ Nullable RepositoryComposition composition ,
54
49
RepositoryConfigurationSource configurationSource ) {
55
- this . repositoryInterface = repositoryInterface ;
50
+ super ( AotContext . from ( beanFactory )) ;
56
51
this .configurationSource = configurationSource ;
57
52
58
53
RepositoryMetadata metadata = AnnotationRepositoryMetadata .getMetadata (repositoryInterface );
@@ -63,35 +58,6 @@ public TestJdbcAotRepositoryContext(Class<T> repositoryInterface, @Nullable Repo
63
58
composition .append (fragments ).getFragments ().stream ().toList ());
64
59
}
65
60
66
- public Class <T > getRepositoryInterface () {
67
- return repositoryInterface ;
68
- }
69
-
70
- @ Override
71
- public ConfigurableListableBeanFactory getBeanFactory () {
72
- return beanFactory ;
73
- }
74
-
75
- @ Override
76
- public Environment getEnvironment () {
77
- return new StandardEnvironment ();
78
- }
79
-
80
- @ Override
81
- public TypeIntrospector introspectType (String typeName ) {
82
- return null ;
83
- }
84
-
85
- @ Override
86
- public IntrospectedBeanDefinition introspectBeanDefinition (String beanName ) {
87
- return null ;
88
- }
89
-
90
- @ Override
91
- public String getBeanName () {
92
- return "dummyRepository" ;
93
- }
94
-
95
61
@ Override
96
62
public String getModuleName () {
97
63
return "JDBC" ;
@@ -102,11 +68,6 @@ public RepositoryConfigurationSource getConfigurationSource() {
102
68
return configurationSource ;
103
69
}
104
70
105
- @ Override
106
- public Set <String > getBasePackages () {
107
- return Set .of ("org.springframework.data.dummy.repository.aot" );
108
- }
109
-
110
71
@ Override
111
72
public Set <Class <? extends Annotation >> getIdentifyingAnnotations () {
112
73
return Set .of (Table .class );
@@ -127,22 +88,4 @@ public Set<Class<?>> getResolvedTypes() {
127
88
return Set .of (User .class );
128
89
}
129
90
130
- @ Override
131
- public Set <Class <?>> getUserDomainTypes () {
132
- return Set .of ();
133
- }
134
-
135
- @ Override
136
- public void typeConfiguration (Class <?> type , Consumer <AotTypeConfiguration > configurationConsumer ) {
137
-
138
- }
139
-
140
- @ Override
141
- public Collection <AotTypeConfiguration > typeConfigurations () {
142
- return List .of ();
143
- }
144
-
145
- public void setBeanFactory (ConfigurableListableBeanFactory beanFactory ) {
146
- this .beanFactory = beanFactory ;
147
- }
148
91
}
0 commit comments