For one project, I was trying to test db connection at startup using some method like
ConnectionTest
{
public static void testConnection(DataSource ds){...}
..
}
which I happily configured in Spring using the factory-method attribute. To my surprise I got NullPointerException in populateMethod of Spring class AbstractAutowireCapableBeanFactory.
The reason for this was, Spring was expecting a object to be returned as it's a factory-method and fatory method will always return some object. Since my use case was to only test the connection and leave it I didnt return anything.
Hope this helps.
No comments:
Post a Comment
Please use proper blogging etiquette while posting comments.
Note: only a member of this blog may post a comment.