Wednesday, June 2, 2010

Ahhh convenience...

Ok this may seem a bit mundane, but I have used Spring for a couple years now.. and only today by the chance discovered:
and thanks to MyEclipse 8.5 / Maven integration that automatically downloads Java docs and source code on Ctrl + click.

and yes it has been there since 2.0 ...

"This is a convenience method to load class path resources relative to a
given Class." - Spring Java Docs

public ClassPathXmlApplicationContext(String path, Class clazz) throws BeansException {
  this(new String[] {path}, clazz);

I can't say how many times I have typed out something like:
new ClassPathXmlApplicationContext("com/some/really/long/config/package/config.xml");

but that now just becomes:
new ClassPathXmlApplicationContext("config.xml", TheClassIamIn.class);

1 comment:

Popular Posts