Finally a working solution with spring