Skip to main content

2.1.4 InjectMembers Mode

tip

Once a bean implements net.hasor.core.spi.InjectMembers, all other injection methods become invalid.

The complete injection process is delegated to the InjectMembers interface.

Example
public class OrderManager implements InjectMembers {
@Inject // <- Because InjectMembers is implemented, the @Inject annotation is ignored.
public StockManager stockBeanTest;
public StockManager stockBean;

public void doInject(AppContext appContext) throws Throwable {
assert this.stockBeanTest == null;
}
}

To customize injection for individual fields, use custom annotation injection instead of taking over all member injection.