Lazy-init or "null" data source?

Rod Widdowson rdw at steadingsoftware.com
Sun Jun 8 08:31:32 EDT 2014


(Sorry for the lag, just catching up)

> I have a case or two where we want to define beans that rely on a
> DataSource but we won't have one by default.
> 
> Right now I handled it by marking the bean lazy-init so as long as nothing
> references it, it never notices the data source isn't set.
> 
> Is that ok, or should we define an actual Null data source as a backstop?

This seems OK to me, modulo debugging the config.  How broken a
configuration would this be (or how hard would the deployer need to work to
break a config), and when they hit this situation of summoning up a bean
with no data source what debugging would they get.  I'm guessing that the
doInitialize() call would have a log.error("No data source deployed") and
sure that’s enough?

R



More information about the dev mailing list