Skip to content
Sharp

Spring Security · interview question

Which approach should be used to mitigate SQL injection vulnerabilities in Java applications?

Multiple choiceHardchapter-17-curatedpremiumspring-securityspring-security-filter-chain
Choose one answer
Answer and explanation

Correct answer

B. Using prepared statements

Why

Prepared statements are a robust way to prevent SQL injection attacks as they separate SQL logic from data, ensuring that user inputs cannot unintentionally alter query structure. This prevents attackers from injecting malicious SQL code.

Test yourself on Spring Security

A free test with instant, explained results. No account needed.

Start free test
All Spring Security questions →