# BeanInitializer

Import: `import com.install4j.api.beaninfo.BeanInitializer;`

```java
interface BeanInitializer
```

Interface for the [`Install4JBeanInfo.ATTRIBUTE_BEAN_INITIALIZER`](Install4JBeanInfo.md#attribute-bean-initializer) value of a bean descriptor.
With a bean initializer you can modify beans after they are instantiated.

This is useful if you have default property values that include compiler variables. Compiler variables in bean properties
are replaced directly in the XML representation of a bean. However, the JavaBean serialization mechanism
does not save default values for properties, so compiler variables in default values are not replaced at compile time.
If you set the default value from a bean initializer, the JavaBean serialization mechanism will recognize this
value as non-default and save it explicitly.

## Methods

| Signature | Returns | Description |
|---|---|---|
| [`initializeBean(Bean)`](#initializebean-bean) | `void` | Called after the unconfigured bean is instantiated the first time at design-time. |

### initializeBean(Bean)

```java
void initializeBean(Bean bean)
```

Called after the unconfigured bean is instantiated the first time at design-time.
For existing bean instances that are loaded from a project, this method is not called
after instantiation.


**Parameters:**

- `bean` — the bean that should be initialized

