Top Description Inners Fields Constructors Methods
org.springframework.beans.factory.aot

pack-priv Class BeanRegistrationsAotContribution

extends Object
implements BeanFactoryInitializationAotContribution
Class Inheritance
All Implemented Interfaces
org.springframework.beans.factory.aot.BeanFactoryInitializationAotContribution
Imports
java.util.Map, javax.lang.model.element.Modifier, org.springframework.aot.generate.GeneratedClass, .GeneratedMethod, .GeneratedMethods, .GenerationContext, .MethodReference, .MethodReference.ArgumentCodeGenerator, org.springframework.aot.hint.MemberCategory, .ReflectionHints, .RuntimeHints, org.springframework.beans.factory.support.DefaultListableBeanFactory, org.springframework.javapoet.ClassName, .CodeBlock, .MethodSpec, org.springframework.util.ClassUtils

AOT contribution from a BeanRegistrationsAotProcessor used to register bean definitions and aliases.
Authors
Phillip Webb, Sebastien Deleuze, Stephane Nicoll, Brian Clozel
Since
6.0
See Also
BeanRegistrationsAotProcessor

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static record
BeanRegistrationsAotContribution.Registration

Gather the necessary information to register a particular bean.

Field Summary

Modifier and TypeField and Description
private static final String
private final Map<BeanRegistrationKey, BeanRegistrationsAotContribution.Registration>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
applyTo(GenerationContext
the active generation context
generationContext
,
BeanFactoryInitializationCode
the bean factory initialization code
beanFactoryInitializationCode
)

Implements org.springframework.beans.factory.aot.BeanFactoryInitializationAotContribution.applyTo.

Apply this contribution to the given BeanFactoryInitializationCode.

private void
private void
private void
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BEAN_FACTORY_PARAMETER_NAMEback to summary
private static final String BEAN_FACTORY_PARAMETER_NAME
registrationsback to summary
private final Map<BeanRegistrationKey, BeanRegistrationsAotContribution.Registration> registrations

Constructor Detail

BeanRegistrationsAotContributionback to summary
pack-priv BeanRegistrationsAotContribution(Map<BeanRegistrationKey, BeanRegistrationsAotContribution.Registration> registrations)

Method Detail

applyToback to summary
public void applyTo(GenerationContext generationContext, BeanFactoryInitializationCode beanFactoryInitializationCode)

Implements org.springframework.beans.factory.aot.BeanFactoryInitializationAotContribution.applyTo.

Doc from org.springframework.beans.factory.aot.BeanFactoryInitializationAotContribution.applyTo.

Apply this contribution to the given BeanFactoryInitializationCode.

Parameters
generationContext:GenerationContext

the active generation context

beanFactoryInitializationCode:BeanFactoryInitializationCode

the bean factory initialization code

Annotations
@Override
generateRegisterAliasesMethodback to summary
private void generateRegisterAliasesMethod(MethodSpec.Builder method)
generateRegisterBeanDefinitionsMethodback to summary
private void generateRegisterBeanDefinitionsMethod(MethodSpec.Builder method, GenerationContext generationContext, BeanRegistrationsCode beanRegistrationsCode)
generateRegisterHintsback to summary
private void generateRegisterHints(RuntimeHints runtimeHints, Map<BeanRegistrationKey, BeanRegistrationsAotContribution.Registration> registrations)
introspectPublicMethodsOnAllInterfacesback to summary
private void introspectPublicMethodsOnAllInterfaces(ReflectionHints hints, Class<?> type)
org.springframework.beans.factory.aot back to summary

pack-priv Class BeanRegistrationsAotContribution.BeanRegistrationsCodeGenerator

extends Object
implements BeanRegistrationsCode
Class Inheritance
  • java.lang.Object
  • org.springframework.beans.factory.aot.BeanRegistrationsAotContribution.BeanRegistrationsCodeGenerator
All Implemented Interfaces
org.springframework.beans.factory.aot.BeanRegistrationsCode

BeanRegistrationsCode with generation support.

Field Summary

Modifier and TypeField and Description
private final GeneratedClass

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public ClassName
getClassName()

Implements org.springframework.beans.factory.aot.BeanRegistrationsCode.getClassName.

Return the name of the class being used for registrations.

public GeneratedMethods
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

generatedClassback to summary
private final GeneratedClass generatedClass

Constructor Detail

BeanRegistrationsCodeGeneratorback to summary
public BeanRegistrationsCodeGenerator(GeneratedClass generatedClass)

Method Detail

getClassNameback to summary
public ClassName getClassName()

Implements org.springframework.beans.factory.aot.BeanRegistrationsCode.getClassName.

Doc from org.springframework.beans.factory.aot.BeanRegistrationsCode.getClassName.

Return the name of the class being used for registrations.

Returns:ClassName

the generated class name.

Annotations
@Override
getMethodsback to summary
public GeneratedMethods getMethods()

Implements org.springframework.beans.factory.aot.BeanRegistrationsCode.getMethods.

Doc from org.springframework.beans.factory.aot.BeanRegistrationsCode.getMethods.

Return a GeneratedMethods being used by the registrations code.

Returns:GeneratedMethods

the method generator

Annotations
@Override
org.springframework.beans.factory.aot back to summary

pack-priv final Record BeanRegistrationsAotContribution.Registration

extends Record
Class Inheritance
Record Components
methodGenerator:BeanDefinitionMethodGenerator
the BeanDefinitionMethodGenerator to use
aliases:String[]
the bean aliases, if any

Gather the necessary information to register a particular bean.

Field Summary

Modifier and TypeField and Description
private final String[]
aliases

Record Component accessed by aliases().

the bean aliases, if any
private final BeanDefinitionMethodGenerator
methodGenerator

Record Component accessed by methodGenerator().

the BeanDefinitionMethodGenerator to use

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public String[]
aliases()

Record Component getter of aliases.

Record Component the bean aliases, if any

public final boolean
equals(Object
the reference object with which to compare.
o
)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public BeanDefinitionMethodGenerator
methodGenerator()

Record Component getter of methodGenerator.

Record Component the BeanDefinitionMethodGenerator to use

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

aliasesback to summary
private final String[] aliases

Record Component accessed by aliases().

the bean aliases, if any

methodGeneratorback to summary
private final BeanDefinitionMethodGenerator methodGenerator

Record Component accessed by methodGenerator().

the BeanDefinitionMethodGenerator to use

Constructor Detail

Registrationback to summary
pack-priv Registration(BeanDefinitionMethodGenerator methodGenerator, String[] aliases)

Method Detail

aliasesback to summary
public String[] aliases()

Record Component getter of aliases.

Record Component
the bean aliases, if any
equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this record is equal to the argument; false otherwise.

hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

Returns:int

a hash code value for this record.

methodGeneratorback to summary
public BeanDefinitionMethodGenerator methodGenerator()

Record Component getter of methodGenerator.

Record Component
the BeanDefinitionMethodGenerator to use
toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

Returns:String

a string representation of the object.