Using spring framework to instantiate Triangle object