2424import  java .util .function .Consumer ;
2525
2626import  org .jspecify .annotations .Nullable ;
27+ 
28+ import  org .springframework .aot .generate .GenerationContext ;
2729import  org .springframework .beans .factory .BeanFactory ;
2830import  org .springframework .beans .factory .NoSuchBeanDefinitionException ;
2931import  org .springframework .beans .factory .config .BeanDefinition ;
4042
4143/** 
4244 * The context in which the AOT processing happens. Grants access to the {@link ConfigurableListableBeanFactory 
43-  * beanFactory} and {@link ClassLoader}. Holds a few convenience methods to check if a type 
44-  * {@link TypeIntrospector#isTypePresent() is present} and allows resolution of them through {@link TypeIntrospector} 
45-  * and {@link IntrospectedBeanDefinition}. 
45+  * beanFactory} and {@link ClassLoader}. 
4646 * <p> 
4747 * Mainly for internal use within the framework. 
4848 * 
@@ -99,7 +99,7 @@ static AotContext from(BeanFactory beanFactory, Environment environment) {
9999	 * @param moduleName name of the module. Can be {@literal null} or {@literal empty}, in which case it will only check 
100100	 *          the general {@link #GENERATED_REPOSITORIES_ENABLED} flag. 
101101	 * @return indicator if repository code generation is enabled. 
102- 	 * @since 5 .0 
102+ 	 * @since 4 .0 
103103	 */ 
104104	default  boolean  isGeneratedRepositoriesEnabled (@ Nullable  String  moduleName ) {
105105
@@ -119,13 +119,13 @@ default boolean isGeneratedRepositoriesEnabled(@Nullable String moduleName) {
119119	}
120120
121121	/** 
122- 	 * Checks if repository metadata file writing is enabled by checking environment variables for general 
123- 	 * enablement  ({@link #GENERATED_REPOSITORIES_JSON_ENABLED}) 
122+ 	 * Checks if repository metadata file writing is enabled by checking environment variables for general enablement  
123+ 	 * ({@link #GENERATED_REPOSITORIES_JSON_ENABLED}) 
124124	 * <p> 
125125	 * Unset properties are considered being {@literal true}. 
126126	 * 
127127	 * @return indicator if repository metadata should be written 
128- 	 * @since 5 .0 
128+ 	 * @since 4 .0 
129129	 */ 
130130	default  boolean  isGeneratedRepositoriesMetadataEnabled () {
131131		return  getEnvironment ().getProperty (GENERATED_REPOSITORIES_JSON_ENABLED , Boolean .class , true );
@@ -177,8 +177,12 @@ default ClassLoader getRequiredClassLoader() {
177177	 * 
178178	 * @param typeName {@link String name} of the {@link Class type} to evaluate; must not be {@literal null}. 
179179	 * @return the type introspector for further type-based introspection. 
180+ 	 * @deprecated since 4.0 as this isn't widely used and can be easily implemented within user code. 
180181	 */ 
181- 	TypeIntrospector  introspectType (String  typeName );
182+ 	@ Deprecated (since  = "4.0" , forRemoval  = true )
183+ 	default  TypeIntrospector  introspectType (String  typeName ) {
184+ 		throw  new  UnsupportedOperationException (); // preparation for implementation removal. 
185+ 	}
182186
183187	/** 
184188	 * Returns a new {@link TypeScanner} used to scan for {@link Class types} that will be contributed to the AOT 
@@ -201,7 +205,9 @@ default TypeScanner getTypeScanner() {
201205	 * @param packageNames {@link Collection} of {@link String package names} to scan. 
202206	 * @return a {@link Set} of {@link Class types} found during the scan. 
203207	 * @see #getTypeScanner() 
208+ 	 * @deprecated since 4.0, use {@link #getTypeScanner()} directly 
204209	 */ 
210+ 	@ Deprecated (since  = "4.0" , forRemoval  = true )
205211	default  Set <Class <?>> scanPackageForTypes (Collection <Class <? extends  Annotation >> identifyingAnnotations ,
206212			Collection <String > packageNames ) {
207213
@@ -214,7 +220,9 @@ default Set<Class<?>> scanPackageForTypes(Collection<Class<? extends Annotation>
214220	 * 
215221	 * @param reference {@link BeanReference} to the managed bean. 
216222	 * @return the introspected bean definition. 
223+ 	 * @deprecated since 4.0, use {@link #getBeanFactory()} and interact with the bean factory directly. 
217224	 */ 
225+ 	@ Deprecated (since  = "4.0" , forRemoval  = true )
218226	default  IntrospectedBeanDefinition  introspectBeanDefinition (BeanReference  reference ) {
219227		return  introspectBeanDefinition (reference .getBeanName ());
220228	}
@@ -225,40 +233,50 @@ default IntrospectedBeanDefinition introspectBeanDefinition(BeanReference refere
225233	 * 
226234	 * @param beanName {@link String} containing the {@literal name} of the bean to evaluate; must not be {@literal null}. 
227235	 * @return the introspected bean definition. 
236+ 	 * @deprecated since 4.0, use {@link #getBeanFactory()} and interact with the bean factory directly. 
228237	 */ 
229- 	IntrospectedBeanDefinition  introspectBeanDefinition (String  beanName );
238+ 	@ Deprecated (since  = "4.0" , forRemoval  = true )
239+ 	default  IntrospectedBeanDefinition  introspectBeanDefinition (String  beanName ) {
240+ 		throw  new  UnsupportedOperationException (); // preparation for implementation removal. 
241+ 	}
230242
231243	/** 
232244	 * Obtain a {@link AotTypeConfiguration} for the given {@link ResolvableType} to customize the AOT processing for the 
233- 	 * given type. 
245+ 	 * given type. Repeated calls to the same type will result in merging the configuration.  
234246	 * 
235247	 * @param resolvableType the resolvable type to configure. 
236248	 * @param configurationConsumer configuration consumer function. 
249+ 	 * @since 4.0 
237250	 */ 
238251	default  void  typeConfiguration (ResolvableType  resolvableType , Consumer <AotTypeConfiguration > configurationConsumer ) {
239252		typeConfiguration (resolvableType .toClass (), configurationConsumer );
240253	}
241254
242255	/** 
243256	 * Obtain a {@link AotTypeConfiguration} for the given {@link ResolvableType} to customize the AOT processing for the 
244- 	 * given type. 
257+ 	 * given type. Repeated calls to the same type will result in merging the configuration.  
245258	 * 
246259	 * @param type the type to configure. 
247260	 * @param configurationConsumer configuration consumer function. 
261+ 	 * @since 4.0 
248262	 */ 
249263	void  typeConfiguration (Class <?> type , Consumer <AotTypeConfiguration > configurationConsumer );
250264
251265	/** 
252- 	 * Return all type configurations registered with this {@link AotContext}. 
266+ 	 * Contribute type configurations to the given {@link GenerationContext}. This method is called once per 
267+ 	 * {@link GenerationContext} after all type configurations have been registered. 
253268	 * 
254- 	 * @return all type configurations registered with this {@link AotContext} . 
269+ 	 * @param generationContext the context to contribute the type configurations to . 
255270	 */ 
256- 	Collection < AotTypeConfiguration >  typeConfigurations ( );
271+ 	void   contributeTypeConfigurations ( GenerationContext   generationContext );
257272
258273	/** 
259274	 * Type-based introspector to resolve {@link Class} from a type name and to introspect the bean factory for presence 
260275	 * of beans. 
276+ 	 * 
277+ 	 * @deprecated since 4.0 as this isn't widely used and can be easily implemented within user code. 
261278	 */ 
279+ 	@ Deprecated (since  = "4.0" , forRemoval  = true )
262280	interface  TypeIntrospector  {
263281
264282		/** 
@@ -318,7 +336,10 @@ default void ifTypePresent(Consumer<Class<?>> action) {
318336
319337	/** 
320338	 * Interface defining introspection methods for bean definitions. 
339+ 	 * 
340+ 	 * @deprecated since 4.0 as this isn't widely used and can be easily implemented within user code. 
321341	 */ 
342+ 	@ Deprecated (since  = "4.0" , forRemoval  = true )
322343	interface  IntrospectedBeanDefinition  {
323344
324345		/** 
0 commit comments