The errors that you posted mention a failure to inject. You dont want spring to inject beans so thats probably your real problem. It can't inject the beans because it cant get the web context but you don't want it to inject the beans in the first place.
You want to learn sorting algorithms? Also it seems kind of funny you are trying to get a job using a skill you plan learning a few days before the interview. Even if for whatever reason you pass what are you gonna do when they expect you to write code for them.
So you catch the exception and then it doesn't come back as the right type of exception or what? I don't think the Constraint violation is thrown inside the method which is why you aren't catching it. Maybe I don't understand what your problem is.