KatInterview

Spring Core, Aspect-Oriented Programming, Data Access, and Security Assessment

System DesignModel answer
MediumModel answerSystem Designjavaspringspring-boot

Last updated

Evaluate key Spring concepts including ApplicationContext configuration, AOP advice selection, dependency injection, JdbcTemplate mapping, DataSource configuration, and Security authorization rules.

Answer the following questions covering Spring Framework fundamentals:

  1. How do you construct a single, application-wide Spring IoC container that aggregates multiple configuration sources?
  2. Which AOP advice type (@Before, @After, @Around, or @AfterReturning) is best suited for logging incoming method parameters for audit purposes? Explain why.
  3. How do you handle dependency injection when multiple bean definitions implement the same target interface?
  4. What is the idiomatic standard for injecting dependencies into a component in modern Spring applications?
  5. What is the simplest built-in class provided by Spring JDBC to map a database ResultSet row directly to a POJO/Java Bean?
  6. Which standard object type should be registered as a Spring bean to manage database connections for MySQL or PostgreSQL? Choose one: DataSource, SQLConnector, MySqlConnector, or MySQLJDBC.
  7. How can you retrieve the details of the logged-in user inside a Spring Web MVC controller method?
  8. Why might @PreAuthorize("hasRole('ROLE_ADMIN')") throw an access denied exception even if the user has administrative privileges, and how should it be written correctly?

Hints

Hint 1

For question 2, choose the advice type that runs prior to method execution and does not risk failing to execute if an exception occurs.

Hint 2

For question 5, think about the utility class that converts column names using snake_case to Java bean properties using camelCase.

Hint 3

For question 8, check whether the method implicitly prepends a specific prefix to authority names.