Java Backend Developer
Client Interview Preparation Guide
Scrum • DevOps • Java 8/11+ • JPA/Hibernate • REST • WildFly • Tomcat • Oracle/SQL Server •
SonarQube • GitLab CI/CD • Log4j • JUnit 5 • Mockito
Section 1: Methodologies
Scrum & DevOps – how teams work and ship software
1.1 Scrum
Scrum is an agile framework for managing complex software delivery through iterative, incremental
work cycles called Sprints. It provides structure via defined roles, ceremonies, and artifacts.
Core Roles
• Product Owner: Owns the product backlog, prioritizes features, defines acceptance criteria.
• Scrum Master: Coaches the team, removes impediments, facilitates Scrum ceremonies.
• Development Team: Self-organizing group (usually 5–9 people) that designs, develops, and
tests.
Key Ceremonies
• Sprint Planning – Team selects backlog items and commits to a Sprint Goal (1–4 weeks).
• Daily Standup – 15-minute sync: What did I do? What will I do? Any blockers?
• Sprint Review – Demo completed work to stakeholders for feedback.
• Sprint Retrospective – Inspect team process; identify improvements for next sprint.
• Backlog Refinement – Estimate, clarify, and split upcoming stories.
Key Artifacts
• Product Backlog – Prioritized list of all desired features/fixes.
• Sprint Backlog – Items committed for the current sprint.
• Increment – Working software produced each sprint.
Interview Answer Example
Q: How have you used Scrum in your project?
In our payments platform we ran 2-week sprints. The Product Owner maintained a
prioritized backlog of payment features (NEFT, RTGS, UPI). During Sprint Planning, the
team pulled stories based on velocity (~40 points). I participated in daily standups, raised
blockers around Kafka consumer lag, and worked with the Scrum Master to remove
infrastructure impediments. Each sprint ended with a demo to the bank's business
stakeholders.
Java Backend Developer Interview Prep | Page
1.2 DevOps
DevOps is a culture and practice that unifies software development (Dev) and IT operations (Ops) to
shorten the delivery lifecycle while maintaining quality. Key pillars: CI/CD, Infrastructure as Code,
monitoring, and collaboration.
DevOps Lifecycle Stages
• Plan – Story creation, backlog management (Jira/GitLab Issues).
• Code – Feature branching, merge requests, code reviews.
• Build – Automated compile/package via Maven, triggered by GitLab CI.
• Test – JUnit, Mockito, SonarQube quality gates run automatically in pipeline.
• Release/Deploy – Artifactory stores artifacts; deploy to WildFly/Tomcat.
• Operate – App servers monitored; alerts on downtime or errors.
• Monitor – Log4j logs, metrics dashboards, alerting.
Key Practices
• Continuous Integration (CI) – Every commit triggers build + test automatically.
• Continuous Delivery (CD) – Every passing build can be deployed with one click.
• Shift-Left Testing – Test early in the pipeline, not just at the end.
• Infrastructure as Code – Version-controlled scripts for environment setup.
Java Backend Developer Interview Prep | Page
Section 2: Backend Technologies
Java 8, Java 11+, JPA & Hibernate
2.1 Java 8 Key Features
Lambda Expressions
Lambdas enable functional-style coding by treating behaviour as a method argument.
// Sort list using lambda
List<String> names = [Link]("Alice", "Charlie", "Bob");
[Link]((a, b) -> [Link](b));
// Runnable as lambda
Runnable r = () -> [Link]("Running in thread");
new Thread(r).start();
Stream API
Streams allow declarative, pipeline-based data processing over collections.
List<Transaction> txns = getTransactions();
// Filter + map + collect
List<String> highValueIds = [Link]()
.filter(t -> [Link]() > 10000)
.map(Transaction::getId)
.collect([Link]());
// Sum of amounts
double total = [Link]()
.mapToDouble(Transaction::getAmount)
.sum();
Optional
Avoids NullPointerException by wrapping a potentially-absent value.
Optional<User> user = [Link](id);
String name = [Link](User::getName).orElse("Unknown");
Default & Static Interface Methods
interface PaymentProcessor {
void process(Payment p);
default void logProcessed(Payment p) {
[Link]("Processed: " + [Link]());
}
}
2.2 Java 11+ Additions
• String API – isBlank(), strip(), lines(), repeat(n).
• var keyword (Java 10) – local type inference: var list = new ArrayList<String>().
• HttpClient API (Java 11) – built-in async HTTP client.
• Records (Java 16) – Immutable data carriers with auto-generated equals/hashCode/toString.
• Sealed Classes (Java 17) – Restrict which classes can extend a class.
• Text Blocks (Java 15) – Multi-line string literals with .
// Record example
record Money(BigDecimal amount, String currency) {}
// Text block
String json = """
{"status": "SUCCESS", "txnId": "TXN001"}
""";
Java Backend Developer Interview Prep | Page
2.3 JPA & Hibernate
JPA (Java Persistence API) is the specification; Hibernate is the most popular implementation. They
map Java objects to relational database tables (ORM – Object Relational Mapping).
Core Annotations
@Entity
@Table(name = "transactions")
public class Transaction {
@Id
@GeneratedValue(strategy = [Link],
generator = "txn_seq")
@SequenceGenerator(name="txn_seq", sequenceName="TXN_SEQ")
private Long id;
@Column(name="amount", nullable=false, precision=19, scale=4)
private BigDecimal amount;
@ManyToOne(fetch = [Link])
@JoinColumn(name="account_id")
private Account account;
@Enumerated([Link])
private TransactionStatus status;
@CreationTimestamp
private LocalDateTime createdAt;
}
Fetch Types – N+1 Problem
LAZY loading defers loading related entities until accessed. EAGER loads them immediately. The N+1
problem occurs when a query for N parent records fires N additional queries for children.
// N+1 problem example
List<Account> accounts = [Link](
"SELECT a FROM Account a", [Link]).getResultList();
// Each call to [Link]() fires a separate SQL query!
// Fix: use JOIN FETCH
List<Account> accounts = [Link](
"SELECT a FROM Account a JOIN FETCH [Link]",
[Link]).getResultList();
Transaction Management
@Service
public class PaymentService {
@Transactional(isolation = Isolation.READ_COMMITTED,
propagation = [Link],
rollbackFor = [Link])
public void processPayment(PaymentRequest req) {
// All DB operations here are in one transaction
[Link]([Link](), [Link]());
[Link]([Link](), [Link]());
[Link](req);
}
}
JPQL vs Native Query
// JPQL (entity-based)
@Query("SELECT t FROM Transaction t WHERE [Link] = :status AND [Link] > :min")
List<Transaction> findByStatusAndMinAmount(
@Param("status") TransactionStatus status,
Java Backend Developer Interview Prep | Page
@Param("min") BigDecimal min);
// Native SQL (database-specific, faster for complex queries)
@Query(value = "SELECT * FROM transactions WHERE ROWNUM <= 100",
nativeQuery = true)
List<Transaction> findTop100Native();
Java Backend Developer Interview Prep | Page
Section 3: Web Services & API
REST API Design & Best Practices
3.1 REST Principles
• Stateless – Each request contains all information needed; no server-side session.
• Uniform Interface – Consistent URL structure, HTTP verbs, and response formats.
• Resource-based – URLs represent nouns (resources), not actions.
• HTTP Methods – GET (read), POST (create), PUT (full update), PATCH (partial update),
DELETE.
• Representation – Resources are returned as JSON or XML.
3.2 Spring Boot REST Example
@RestController
@RequestMapping("/api/v1/payments")
@Validated
public class PaymentController {
@Autowired
private PaymentService paymentService;
// GET /api/v1/payments/{id}
@GetMapping("/{id}")
public ResponseEntity<PaymentResponse> getPayment(@PathVariable Long id) {
return [Link](id)
.map(p -> [Link](p))
.orElse([Link]().build());
}
// POST /api/v1/payments
@PostMapping
public ResponseEntity<PaymentResponse> createPayment(
@Valid @RequestBody PaymentRequest req,
UriComponentsBuilder ucb) {
PaymentResponse resp = [Link](req);
URI location = [Link]("/api/v1/payments/{id}")
.buildAndExpand([Link]()).toUri();
return [Link](location).body(resp);
}
// PATCH /api/v1/payments/{id}/status
@PatchMapping("/{id}/status")
public ResponseEntity<Void> updateStatus(
@PathVariable Long id,
@RequestParam PaymentStatus status) {
[Link](id, status);
return [Link]().build();
}
}
3.3 HTTP Status Codes
• 200 OK – Successful GET/PUT.
• 201 Created – Successful POST (include Location header).
• 204 No Content – Successful DELETE or PATCH with no response body.
• 400 Bad Request – Invalid input/validation failure.
• 401 Unauthorized – Missing or invalid authentication.
• 403 Forbidden – Authenticated but not authorized.
• 404 Not Found – Resource does not exist.
Java Backend Developer Interview Prep | Page
• 409 Conflict – Duplicate resource or state conflict.
• 500 Internal Server Error – Unexpected server failure.
3.4 Global Exception Handling
@RestControllerAdvice
public class GlobalExceptionHandler {
@ExceptionHandler([Link])
public ResponseEntity<ErrorResponse> handleNotFound(ResourceNotFoundException ex)
{
return [Link](HttpStatus.NOT_FOUND)
.body(new ErrorResponse("NOT_FOUND", [Link]()));
}
@ExceptionHandler([Link])
public ResponseEntity<ErrorResponse> handleValidation(
MethodArgumentNotValidException ex) {
String msg = [Link]().getFieldErrors().stream()
.map(e -> [Link]() + ": " + [Link]())
.collect([Link](", "));
return [Link]()
.body(new ErrorResponse("VALIDATION_FAILED", msg));
}
}
Java Backend Developer Interview Prep | Page
Section 4: Application Servers
WildFly & Apache Tomcat 9
4.1 Apache Tomcat 9
Tomcat is a lightweight Java Servlet Container (not a full Java EE server). It supports Servlet, JSP, and
WebSocket. Ideal for Spring Boot applications.
Key Concepts
• Connector – Listens on a port (default 8080); Coyote connector handles HTTP.
• Engine – Catalina engine processes requests and routes to virtual hosts.
• Context – Individual web application deployed within Tomcat.
• [Link] – Main configuration: ports, connectors, thread pools.
• Deployment – Drop WAR file in webapps/ or configure Spring Boot embedded Tomcat.
Spring Boot with Embedded Tomcat
// [Link]
[Link]=8080
[Link]=200
[Link]-count=100
[Link]-timeout=20000
[Link]-connections=10000
// To deploy as WAR on external Tomcat:
@SpringBootApplication
public class PaymentApp extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(
SpringApplicationBuilder app) {
return [Link]([Link]);
}
}
4.2 WildFly
WildFly is a full Java EE (Jakarta EE) application server from Red Hat. It supports EJB, JMS, JTA, CDI,
JAX-RS, and more. Used in enterprise environments needing full Java EE compliance.
Key Differences vs Tomcat
• WildFly supports full Java EE: EJB, JTA, JMS, CDI out of the box.
• Tomcat is a servlet container only; needs additional libraries for full EE.
• WildFly uses modular classloading (JBoss Modules); Tomcat uses flat classloading.
• WildFly has a management console at [Link]
Deployment on WildFly
• Standalone mode – Single server instance ([Link] configuration).
• Domain mode – Centrally manage multiple server instances.
• Deploy via CLI, management console, or drop EAR/WAR in deployments/ folder.
Interview Tip
When asked which server you used: 'In our payments project we used WildFly in standalone
mode for the backend services, deploying EAR packages via the CLI. For newer Spring
Boot microservices we leveraged embedded Tomcat for simpler deployment.
Java Backend Developer Interview Prep | Page
Section 5: Database
Oracle & SQL Server
5.1 Oracle Database
Oracle is a leading enterprise RDBMS widely used in banking and financial systems for its robust ACID
compliance, advanced indexing, and partitioning features.
Key Oracle Features You Should Know
• Sequences – Generate unique IDs: CREATE SEQUENCE txn_seq START WITH 1
INCREMENT BY 1.
• Synonyms – Aliases for objects across schemas.
• ROWNUM / FETCH FIRST – Limit rows returned.
• Partitioning – Range/hash partitioning for large tables (e.g., transactions by month).
• Materialized Views – Pre-computed query results for performance.
• Explain Plan – Analyze query execution performance.
Oracle SQL Examples
-- Pagination
SELECT * FROM transactions
ORDER BY created_at DESC
FETCH FIRST 20 ROWS ONLY OFFSET 40 ROWS;
-- Window function for running total
SELECT txn_id, amount,
SUM(amount) OVER (PARTITION BY account_id
ORDER BY created_at) AS running_balance
FROM transactions;
-- Index for performance
CREATE INDEX idx_txn_account_date ON transactions(account_id, created_at);
-- Sequence usage
INSERT INTO transactions (id, amount, status)
VALUES (txn_seq.NEXTVAL, 5000, 'PENDING');
5.2 SQL Server
Microsoft SQL Server is common in enterprise Windows environments. Key differences from Oracle
include T-SQL syntax, IDENTITY columns instead of sequences (older versions), and different date
functions.
SQL Server vs Oracle Differences
• Identity vs Sequence – SQL Server: IDENTITY(1,1); Oracle: CREATE SEQUENCE.
• String concat – SQL Server: + operator; Oracle: || operator.
• Limit rows – SQL Server: TOP 10; Oracle: FETCH FIRST 10 ROWS ONLY.
• Date functions – SQL Server: GETDATE(); Oracle: SYSDATE.
• T-SQL – SQL Server uses T-SQL with BEGIN/COMMIT TRANSACTION syntax.
-- SQL Server pagination
SELECT * FROM Transactions
ORDER BY CreatedAt DESC
OFFSET 40 ROWS FETCH NEXT 20 ROWS ONLY;
-- SQL Server transaction
BEGIN TRANSACTION;
UPDATE Accounts SET Balance -= 5000 WHERE AccountId = 1;
Java Backend Developer Interview Prep | Page
UPDATE Accounts SET Balance += 5000 WHERE AccountId = 2;
IF @@ERROR <> 0 ROLLBACK; ELSE COMMIT;
Java Backend Developer Interview Prep | Page
Section 6: IDE
Eclipse
6.1 Eclipse IDE
Eclipse is an open-source Java IDE. It supports Java development, Maven/Gradle build tools, Git
integration, and has a large plugin ecosystem (Spring Tools Suite is built on Eclipse).
Important Features & Shortcuts
• Ctrl+Space – Content assist / code completion.
• Ctrl+Shift+O – Organize imports automatically.
• Ctrl+Shift+F – Format code.
• Ctrl+1 – Quick fix (add import, create method, etc.).
• F3 – Open declaration of class/method.
• Alt+Shift+R – Rename refactoring.
• Ctrl+Alt+H – Call hierarchy of a method.
• Run As → JUnit Test – Execute unit tests.
• Debug – Set breakpoints (double-click gutter), F6 to step over, F5 to step into.
Spring Tools Suite (STS)
STS is Eclipse with Spring-specific plugins: Spring Boot Dashboard, bean graph visualization,
[Link] editor with auto-complete, and live reload support.
Maven Integration (M2Eclipse)
<!-- [Link] basics Eclipse will recognize -->
<project>
<groupId>[Link]</groupId>
<artifactId>payment-service</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>[Link]</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
</project>
Java Backend Developer Interview Prep | Page
Section 7: Code Quality
SonarQube
7.1 SonarQube Overview
SonarQube is a static code analysis platform that continuously inspects code quality and security. It
integrates with CI pipelines to enforce quality gates before deployments.
What SonarQube Analyses
• Bugs – Code that is demonstrably wrong or likely to behave unexpectedly.
• Vulnerabilities – Security weaknesses (e.g., SQL injection, XXE, hardcoded passwords).
• Code Smells – Maintainability issues: long methods, duplicated code, complex conditions.
• Security Hotspots – Code requiring manual review for security implications.
• Coverage – % of code covered by unit tests.
• Duplications – % of duplicated lines.
Quality Gate
A quality gate is a set of conditions that must pass before code can be released. Example: Coverage >
80%, no new critical bugs, no new vulnerabilities.
GitLab CI Integration
# .[Link]
sonarqube-check:
stage: quality
script:
- mvn verify sonar:sonar
-[Link]=payment-service
-[Link]=$SONAR_HOST_URL
-[Link]=$SONAR_TOKEN
only:
- merge_requests
- main
Common Issues & Fixes
• Critical – SQL injection: use PreparedStatement, not string concatenation.
• Critical – Resource leak: use try-with-resources for streams/connections.
• Major – Cognitive complexity: break large methods into smaller ones.
• Minor – Unused imports: Ctrl+Shift+O in Eclipse to clean up.
Interview Answer
We integrated SonarQube into our GitLab pipeline. Every merge request triggered a Sonar
scan. We had a quality gate requiring 80% line coverage, zero critical bugs, and zero high-
severity vulnerabilities. Any failure blocked the merge, forcing developers to fix issues
before code reached main.
Java Backend Developer Interview Prep | Page
Section 8: CI/CD
Artifactory, GitLab & Maven
8.1 Maven
Maven is a Java build automation tool that manages dependencies, compiles, tests, packages, and
deploys Java applications using a [Link] file.
Maven Lifecycle Phases
• validate – Validates project structure.
• compile – Compiles source code.
• test – Runs unit tests (JUnit/Mockito).
• package – Creates JAR/WAR artifact.
• verify – Runs integration tests and checks.
• install – Copies artifact to local Maven repository (~/.m2).
• deploy – Publishes artifact to remote repository (Artifactory).
Common Maven Commands
mvn clean package # Clean + compile + test + package
mvn clean package -DskipTests # Skip tests (use sparingly)
mvn verify # Run all tests including integration
mvn dependency:tree # Show dependency hierarchy
mvn versions:display-dependency-updates # Check for newer versions
8.2 JFrog Artifactory
Artifactory is a universal artifact repository manager. It stores build artifacts (JARs, WARs), Docker
images, and npm packages. It acts as a proxy/cache for Maven Central.
Role in CI/CD Pipeline
• Stores versioned artifacts – Each build produces a versioned JAR uploaded to Artifactory.
• Acts as Maven repository – Teams pull dependencies from Artifactory (not directly from
internet).
• Promotion – Artifacts move from snapshot → release repo after passing QA.
• Retention policies – Automatic cleanup of old snapshot builds.
<!-- [Link] – Point Maven to Artifactory -->
<mirrors>
<mirror>
<id>artifactory</id>
<url>[Link]
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
8.3 GitLab CI/CD
GitLab CI/CD automates build, test, and deployment pipelines using .[Link] defined in the
repository.
Complete Pipeline Example
# .[Link] – Payment Service Pipeline
stages:
- build
- test
- quality
- deploy
Java Backend Developer Interview Prep | Page
variables:
MAVEN_OPTS: "-[Link]=.m2/repository"
build:
stage: build
script:
- mvn clean compile
artifacts:
paths: [target/]
unit-test:
stage: test
script:
- mvn test
artifacts:
reports:
junit: target/surefire-reports/*.xml
sonar:
stage: quality
script:
- mvn sonar:sonar -[Link]=$SONAR_TOKEN
deploy-staging:
stage: deploy
script:
- mvn deploy -DaltDeploymentRepository=artifactory::default::$ARTIFACTORY_URL
only: [main]
Java Backend Developer Interview Prep | Page
Section 9: Logging & Testing
Log4j, JUnit 5 & Mockito
9.1 Log4j 2
Log4j 2 is a fast, asynchronous logging framework. It defines log levels (TRACE < DEBUG < INFO <
WARN < ERROR < FATAL) and routes log messages to appenders (console, file, Kafka, etc.).
[Link] Configuration
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %-5level [%t] %logger{36} - %msg
%n"/>
</Console>
<RollingFile name="RollingFile"
fileName="logs/[Link]"
filePattern="logs/payment-%d{MM-dd-yyyy}-%[Link]">
<PatternLayout pattern="%d %-5level [%X{txnId}] %msg%n"/>
<Policies>
<SizeBasedTriggeringPolicy size="10MB"/>
<TimeBasedTriggeringPolicy/>
</Policies>
<DefaultRolloverStrategy max="30"/>
</RollingFile>
</Appenders>
<Loggers>
<Logger name="[Link]" level="DEBUG" additivity="false">
<AppenderRef ref="RollingFile"/>
</Logger>
<Root level="INFO"><AppenderRef ref="Console"/></Root>
</Loggers>
</Configuration>
Using Logger in Code
import [Link];
import [Link];
import [Link];
@Service
public class PaymentService {
private static final Logger log = [Link]([Link]);
public PaymentResponse process(PaymentRequest req) {
// Add correlation ID to MDC for all logs in this request
[Link]("txnId", [Link]());
[Link]("Processing payment: amount={}, from={}",
[Link](), [Link]());
try {
// ... business logic
[Link]("Payment validation passed");
return executePayment(req);
} catch (InsufficientFundsException e) {
[Link]("Insufficient funds for account {}", [Link]());
throw e;
} catch (Exception e) {
[Link]("Payment processing failed", e);
throw new PaymentException("Processing error", e);
} finally {
[Link]();
Java Backend Developer Interview Prep | Page
}
}
}
9.2 JUnit 5
JUnit 5 (Jupiter) is the modern Java unit testing framework. It uses annotations to define test lifecycle
and assertions to verify behaviour.
Key Annotations
• @Test – Marks a test method.
• @BeforeEach / @AfterEach – Setup/teardown before and after each test.
• @BeforeAll / @AfterAll – Run once for entire test class (static methods).
• @ParameterizedTest + @ValueSource – Run same test with multiple inputs.
• @DisplayName – Human-readable test name.
• @Nested – Group related tests in inner classes.
• @ExtendWith([Link]) – Enable Mockito integration.
JUnit 5 Test Examples
@ExtendWith([Link])
class PaymentServiceTest {
@Mock
private AccountRepository accountRepo;
@Mock
private LedgerRepository ledgerRepo;
@InjectMocks
private PaymentService paymentService;
@Test
@DisplayName("Should process payment when sufficient balance")
void shouldProcessPaymentSuccessfully() {
// Arrange
Account fromAccount = new Account("ACC001", new BigDecimal("50000"));
PaymentRequest req = new PaymentRequest("ACC001", "ACC002",
new BigDecimal("10000"));
when([Link]("ACC001")).thenReturn([Link](fromAccount));
// Act
PaymentResponse response = [Link](req);
// Assert
assertNotNull(response);
assertEquals([Link], [Link]());
verify(accountRepo, times(1)).debit("ACC001", new BigDecimal("10000"));
}
@Test
@DisplayName("Should throw exception when insufficient balance")
void shouldThrowWhenInsufficientBalance() {
Account fromAccount = new Account("ACC001", new BigDecimal("500"));
when([Link]("ACC001")).thenReturn([Link](fromAccount));
PaymentRequest req = new PaymentRequest("ACC001", "ACC002",
new BigDecimal("10000"));
assertThrows([Link],
() -> [Link](req));
}
@ParameterizedTest
Java Backend Developer Interview Prep | Page
@ValueSource(doubles = {0.0, -100.0, -0.01})
@DisplayName("Should reject invalid payment amounts")
void shouldRejectInvalidAmounts(double amount) {
PaymentRequest req = new PaymentRequest("ACC001", "ACC002",
[Link](amount));
assertThrows([Link],
() -> [Link](req));
}
}
9.3 Mockito
Mockito creates mock objects that simulate real dependencies, allowing unit tests to run in isolation
without databases, external services, or complex wiring.
Core Concepts
• @Mock – Create a mock instance of a class/interface.
• @InjectMocks – Create instance and inject @Mock fields into it.
• @Spy – Partial mock: real methods execute unless stubbed.
• @Captor – Capture arguments passed to mock methods for assertion.
Mockito Techniques
// Stubbing return values
when([Link]("ACC001")).thenReturn([Link](account));
when([Link](anyString())).thenThrow(new RuntimeException());
// Void method stubbing
doNothing().when(notificationService).sendSms(anyString());
doThrow(new NotificationException()).when(notificationService).sendEmail(any());
// Verify interactions
verify(accountRepo, times(1)).debit("ACC001", new BigDecimal("10000"));
verify(notificationService, never()).sendSms(any());
verifyNoMoreInteractions(ledgerRepo);
// Argument Captor
@Captor ArgumentCaptor<AuditEvent> auditCaptor;
verify(auditService).publish([Link]());
AuditEvent captured = [Link]();
assertEquals("PAYMENT_PROCESSED", [Link]());
// Spy – real object but intercept specific method
@Spy
private EmailTemplate emailTemplate = new EmailTemplate();
doReturn("TEST SUBJECT").when(emailTemplate).buildSubject(any());
Testing REST Controllers with MockMvc
@WebMvcTest([Link])
class PaymentControllerTest {
@Autowired
private MockMvc mockMvc;
@MockBean
private PaymentService paymentService;
@Test
void shouldReturn200WhenPaymentFound() throws Exception {
PaymentResponse resp = new PaymentResponse(1L, [Link]);
when([Link](1L)).thenReturn([Link](resp));
[Link](get("/api/v1/payments/1")
Java Backend Developer Interview Prep | Page
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(jsonPath("$.status").value("SUCCESS"));
}
@Test
void shouldReturn404WhenPaymentNotFound() throws Exception {
when([Link](99L)).thenReturn([Link]());
[Link](get("/api/v1/payments/99"))
.andExpect(status().isNotFound());
}
}
Java Backend Developer Interview Prep | Page
Section 10: Frontend & UI
CSS Fundamentals
10.1 CSS Essentials for Java Backend Developers
As a Java backend developer, your CSS knowledge is expected to be foundational rather than expert-
level. Focus on understanding the Box Model, Selectors, Flexbox, and how CSS integrates with
JSP/Thymeleaf templates.
Box Model
Every HTML element is a rectangular box: Content → Padding → Border → Margin.
/* Box model example */
.payment-card {
width: 300px; /* content width */
padding: 16px; /* inside border */
border: 1px solid #ccc;
margin: 10px auto; /* outside border, auto = center horizontally */
box-sizing: border-box; /* include padding+border in width */
}
Common Selectors
/* Element */ p { color: #333; }
/* Class */ .error-msg { color: red; }
/* ID */ #submit-btn { background: blue; }
/* Descendant */ .form input { border-radius: 4px; }
/* Pseudo */ button:hover { opacity: 0.8; }
/* Attribute */ input[type='text'] { width: 100%; }
Flexbox (common in modern UIs)
.payment-form {
display: flex;
flex-direction: column;
align-items: center;
gap: 12px;
}
.button-group {
display: flex;
justify-content: space-between;
}
CSS with Thymeleaf (Spring Boot)
<!-- Thymeleaf template using CSS class conditionally -->
<tr th:each="txn : ${transactions}"
th:class="${[Link] == 'FAILED'} ? 'row-error' : 'row-normal'">
<td th:text="${[Link]}">TXN001</td>
<td th:text="${[Link]}">1000.00</td>
</tr>
Java Backend Developer Interview Prep | Page
Quick-Reference Summary
Use this table to revise key talking points before your interview.
Topic Core Concept Your Experience Angle
Scrum 2-week sprints, PO, SM, retros BofA payments team, sprint velocity
tracking
DevOps CI/CD pipeline, shift-left testing GitLab pipeline: build → test → Sonar
→ deploy
Java 8 Lambdas, Streams, Optional Used streams for transaction
filtering/aggregation
Java 11+ var, Records, HttpClient Adopted in newer microservices
JPA/Hibernate ORM, @Entity, @Transactional Transaction entities, JOIN FETCH for
N+1 fix
REST HTTP verbs, status codes, HATEOAS @RestController, ResponseEntity,
@Valid
WildFly Full Java EE server, EJB, JTA Deployed EAR packages, standalone
mode
Tomcat 9 Servlet container, embedded Spring Embedded Tomcat for microservices
Boot
Oracle Sequences, partitioning, window fns Transaction table with monthly
partitions
SQL Server T-SQL, IDENTITY, GETDATE() Reporting queries, stored procedures
Eclipse/STS IDE, M2Eclipse, Spring Dashboard Used STS for Spring Boot dev
SonarQube Quality gate, coverage, vulnerabilities 80% coverage gate, zero critical bugs
Maven Lifecycle: mvn clean verify in pipeline
compile→test→package→deploy
Artifactory Artifact repo, Maven proxy Published versioned JARs post-build
GitLab CI .[Link], stages, runners 4-stage pipeline with merge-request
checks
Log4j 2 Levels, appenders, Correlation ID in ThreadContext for
MDC/ThreadContext tracing
JUnit 5 @Test, @BeforeEach, Wrote service and controller unit tests
@Parameterized
Mockito @Mock, @InjectMocks, verify() Mocked repos to test service layer in
isolation
Final Interview Tip
Lead every answer with your project context: 'In our BofA payments platform...' — this
grounds your answers in real experience and immediately signals seniority. For any
technology, be ready to explain what problem it solves, how you used it, and what you
would do differently.
Java Backend Developer Interview Prep | Page