Is there a good security API (all in one) for Java to prevent things like SQL injections, Cross site scripting and those owasp top 10 vulnerabilities?
Prevention of Cross Site Scripting, SQL Injections and the like are implementation details. They depend on the care and expertise that the developers put into the code, and no library can solve this for you. There is a broad spectrum of utility libraries available that can help you with this task. Trying to create a comprehensive list would be beyond this answer.
Trusting automatic mechanism, especially a single library to blanket-solve mentioned security issues, is a breeding ground for security vulnerabilities. There is no way around the fact that securing a system costs time, energy and resources. A better understanding of the nature of these vulnerabilities might be the first thing necessary to prevent the same.