Interview practice

Java Backend Developer

2–5 years · Mid — Java · Spring Boot · REST APIs · JPA / Hibernate · SQL · Microservices

0–2 years 2–5 years 5–8 years 8+ years
technical Spring internals 1 of 6
A microservice that relies on Spring Boot has a startup time of over 30 seconds, and you notice that bean initialisation is taking a long time. How do you approach diagnosing the issue, and what do you look for first?
What a strong answer covers

Enables debug logging to track bean creation; checks for circular dependencies between beans; looks for @PostConstruct methods that may be blocking; examines autowiring and the number of beans being created; considers the use of application context initialisation order.

The follow-up you would get

You find a circular dependency. How would you resolve it?

Could you have answered that?
scenario Database optimization 2 of 6
You receive reports of slow response times from users querying a newly implemented feature that heavily interacts with the database. What steps would you take in the first instance to identify the root cause?
What a strong answer covers

Profiles the SQL queries executed during the feature usage; checks for missing indexes or inefficient joins; reviews execution plans for optimizations; monitors database resource usage; considers caching strategies for frequent queries.

The follow-up you would get

If you find that the database is under heavy load, what actions would you take to scale it effectively?

Could you have answered that?
technical Database access patterns 3 of 6
You observe that a JPA query retrieving user data takes significantly longer when the user count increases, and the application exhibits N+1 query problems. How do you diagnose and improve this situation?
What a strong answer covers

Enables Hibernate SQL logging to identify N+1 queries; reviews the fetching strategy and considers using fetch joins; assesses the lazy versus eager loading configuration; applies batch fetching for collections; profiles the SQL generated to identify inefficiencies.

The follow-up you would get

You implement fetch joins, but performance still lags. What next?

Could you have answered that?
technical Transaction boundaries 4 of 6
A transaction in your Spring application is expected to commit in under 5 seconds, but it occasionally takes over 30 seconds. How do you troubleshoot this issue, and what metrics would you collect?
What a strong answer covers

Enables transaction logging to identify long-running transactions; checks for database locks or long-running queries during the transaction; evaluates the number of entities being processed in the transaction; assesses the transaction isolation level; considers the impact of cascading operations.

The follow-up you would get

You identify a long-running query within the transaction. What actions do you take?

Could you have answered that?
scenario API versioning 5 of 6
You are asked to support a new feature in your REST API that requires breaking changes to the existing endpoints. How do you approach this while ensuring backward compatibility?
What a strong answer covers

Identifies the need for versioning strategy; discusses using URL path versioning or header-based versioning; considers impact on clients and documentation; plans for deprecation schedule for old versions; ensures thorough testing for both old and new versions.

The follow-up you would get

How do you communicate these changes to the stakeholders and clients affected by the breaking changes?

Could you have answered that?
ownership A disagreement with a team member 6 of 6
Can you recount a time when you disagreed with a team member about a technical choice? What was the outcome?
What a strong answer covers

Describes the context of the disagreement and the specific choice in question; explains the rationale behind their position and the opposing view; discusses how the discussion was approached and resolved; reflects on the final decision and its impact on the project; avoids personal criticism.

The follow-up you would get

What did you learn from this experience?

Could you have answered that?
That is this set.

Load six more — you will get questions you have not seen first.

Give me six more →

Say your answer out loud before revealing. Reading the answer first feels like learning and is not.