Make sure bean is registered only

A potential race can cause the bean to be registered more than
once. This commit uses the return value of putIfAbsent to short
ciruit the registration code.