Package org.springframework.beans.factory.aot

# Interface BeanRegistrationAotContribution

Functional Interface:
  This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface BeanRegistrationAotContribution
AOT contribution from a `BeanRegistrationAotProcessor` used to register a single bean definition.

Since:
  6.0
Author:
  Phillip Webb, Stephane Nicoll
See Also:
  - `BeanRegistrationAotProcessor`

## Method Summary

Modifier and Type
Method
Description
`void`
`applyTo(org.springframework.aot.generate.GenerationContext generationContext, BeanRegistrationCode beanRegistrationCode)`
Apply this contribution to the given `BeanRegistrationCode`.
`static BeanRegistrationAotContribution`
`concat(BeanRegistrationAotContribution a, BeanRegistrationAotContribution b)`
Create a contribution that applies the contribution of the first contribution followed by the second contribution.
`default BeanRegistrationCodeFragments`
`customizeBeanRegistrationCodeFragments(org.springframework.aot.generate.GenerationContext generationContext, BeanRegistrationCodeFragments codeFragments)`
Customize the `BeanRegistrationCodeFragments` that will be used to generate the bean registration code.
`static BeanRegistrationAotContribution`
`withCustomCodeFragments(UnaryOperator<BeanRegistrationCodeFragments> defaultCodeFragments)`
Create a `BeanRegistrationAotContribution` that customizes the `BeanRegistrationCodeFragments`.

## Method Details

### customizeBeanRegistrationCodeFragments

default BeanRegistrationCodeFragments customizeBeanRegistrationCodeFragments(org.springframework.aot.generate.GenerationContext generationContext, BeanRegistrationCodeFragments codeFragments)
Customize the `BeanRegistrationCodeFragments` that will be used to generate the bean registration code. Custom code fragments can be used if default code generation isn't suitable.

Parameters:
  `generationContext` - the generation context
  `codeFragments` - the existing code fragments
Returns:
  the code fragments to use, may be the original instance or a wrapper

### applyTo

void applyTo(org.springframework.aot.generate.GenerationContext generationContext, BeanRegistrationCode beanRegistrationCode)
Apply this contribution to the given `BeanRegistrationCode`.

Parameters:
  `generationContext` - the generation context
  `beanRegistrationCode` - the generated registration

### withCustomCodeFragments

static BeanRegistrationAotContribution withCustomCodeFragments(UnaryOperator<BeanRegistrationCodeFragments> defaultCodeFragments)
Create a `BeanRegistrationAotContribution` that customizes the `BeanRegistrationCodeFragments`. Typically used in conjunction with an extension of `BeanRegistrationCodeFragmentsDecorator` that overrides a specific callback.

Parameters:
  `defaultCodeFragments` - the default code fragments
Returns:
  a new `BeanRegistrationAotContribution` instance
See Also:
  - `BeanRegistrationCodeFragmentsDecorator`

### concat

@Nullable static BeanRegistrationAotContribution concat(@Nullable BeanRegistrationAotContribution a, @Nullable BeanRegistrationAotContribution b)
Create a contribution that applies the contribution of the first contribution followed by the second contribution. Any contribution can be `null` to be ignored and the concatenated contribution is `null` if both inputs are `null`.

Parameters:
  `a` - the first contribution
  `b` - the second contribution
Returns:
  the concatenation of the two contributions, or `null` if they are both `null`.
Since:
  6.1