Chaturmind
LearnDSASystem DesignInterview PrepDevOpsEngineering GrowthBlog
Start learning
Chaturmind

Structured learning paths for engineers who want to go deep. Written by practitioners.

Learn

  • Java
  • DSA
  • System Design
  • Spring Boot
  • AI / ML
  • DevOps
  • Engineering Growth
  • Java Interview Prep

Company

  • Blog
  • Contact

Legal

  • Privacy Policy
  • Terms of Service

© 2026 Chaturmind. All rights reserved.

Built for engineers who want to go deep.


← Java Interview Prep: Fresher to 2 Years

Java Basics, JVM & Memory

  • JDK, JRE, JVM & the main Method — Interview Questions
  • JVM Memory & Garbage Collection — Interview Questions
  • Data Types, Wrapper Classes & Equality — Interview Questions

Object-Oriented Programming

  • Classes, Objects, Packages & Access Modifiers — Interview Questions
  • Inheritance, Composition, this & super — Interview Questions
  • Polymorphism, Overloading & Overriding — Interview Questions
  • Abstraction, Interfaces & Encapsulation — Interview Questions
  • Constructors, Singleton, Anonymous Classes & Immutability — Interview Questions
  • Design Patterns & SOLID Basics — Interview Questions

Strings, Keywords, Exceptions & Serialization

  • Strings, String Pool, StringBuilder & StringBuffer — Interview Questions
  • static & final Keywords — Interview Questions
  • Exceptions, Generics, Enums & Reflection — Interview Questions
  • Serialization & transient — Interview Questions

Collections Framework

  • Collections Framework Basics — Interview Questions
  • HashMap, HashSet & TreeMap Internals — Interview Questions

Multithreading Basics

  • Threads, Synchronization & volatile Basics — Interview Questions

Java 8+ & Stream API

  • Java 8 to Java 21 Features — Interview Questions
  • Stream API Coding Questions (Part 1) — Interview Questions
  • Stream API Coding Questions (Part 2) — Interview Questions

Coding Round Programs

  • Classic Number & String Programs — Interview Questions
  • String & Collection Programs — Interview Questions
  • Array & String Problem Solving — Interview Questions

Spring Framework Core

  • Spring IoC, Dependency Injection & Beans — Interview Questions
  • Spring Injection Types, Scopes, Profiles & WebFlux — Interview Questions

Spring Boot Essentials

  • Spring Boot Fundamentals — Interview Questions
  • Spring Boot Runners, Servers & Configuration — Interview Questions
  • Spring Boot Controllers, Profiles, Actuator & DevTools — Interview Questions
  • Spring Boot Testing, Exceptions & Auto-Configuration — Interview Questions
  • REST APIs, Swagger, Embedded Servers & Key Annotations — Interview Questions

Spring MVC

  • Spring MVC Architecture & DispatcherServlet — Interview Questions
  • Spring MVC Request Mapping & Controllers — Interview Questions
  • Spring MVC Forms, Views & Interceptors — Interview Questions
  • Spring MVC Exceptions, Security & Dependency Injection — Interview Questions
  • Spring MVC Data Binding, Static Resources & Path Variables — Interview Questions
  • Spring MVC i18n, Testing, File Uploads & Scaling — Interview Questions

Hibernate & Spring Data JPA

  • Hibernate & JPA Core Concepts — Interview Questions
  • Hibernate Performance, Mapping & Scenarios — Interview Questions

SQL

  • SQL Basics, Keys, Normalization & Transactions — Interview Questions
  • SQL Joins, Triggers, Procedures, Functions & Indexes — Interview Questions
  • SQL "Difference Between" Questions — Interview Questions
  • SQL Query Writing (Part 1) — Interview Questions
  • SQL Query Writing (Part 2) — Interview Questions

Microservices Basics

  • Microservices, API Gateway & Communication — Interview Questions
  • Service Discovery, Data Consistency & Deployment — Interview Questions
  • Microservices Monitoring, Security & Resilience — Interview Questions

Maven & Git

  • Maven — Interview Questions
  • Git — Interview Questions
Chaturmind
← Java Interview Prep: Fresher to 2 Years

Java Basics, JVM & Memory

  • JDK, JRE, JVM & the main Method — Interview Questions
  • JVM Memory & Garbage Collection — Interview Questions
  • Data Types, Wrapper Classes & Equality — Interview Questions

Object-Oriented Programming

  • Classes, Objects, Packages & Access Modifiers — Interview Questions
  • Inheritance, Composition, this & super — Interview Questions
  • Polymorphism, Overloading & Overriding — Interview Questions
  • Abstraction, Interfaces & Encapsulation — Interview Questions
  • Constructors, Singleton, Anonymous Classes & Immutability — Interview Questions
  • Design Patterns & SOLID Basics — Interview Questions

Strings, Keywords, Exceptions & Serialization

  • Strings, String Pool, StringBuilder & StringBuffer — Interview Questions
  • static & final Keywords — Interview Questions
  • Exceptions, Generics, Enums & Reflection — Interview Questions
  • Serialization & transient — Interview Questions

Collections Framework

  • Collections Framework Basics — Interview Questions
  • HashMap, HashSet & TreeMap Internals — Interview Questions

Multithreading Basics

  • Threads, Synchronization & volatile Basics — Interview Questions

Java 8+ & Stream API

  • Java 8 to Java 21 Features — Interview Questions
  • Stream API Coding Questions (Part 1) — Interview Questions
  • Stream API Coding Questions (Part 2) — Interview Questions

Coding Round Programs

  • Classic Number & String Programs — Interview Questions
  • String & Collection Programs — Interview Questions
  • Array & String Problem Solving — Interview Questions

Spring Framework Core

  • Spring IoC, Dependency Injection & Beans — Interview Questions
  • Spring Injection Types, Scopes, Profiles & WebFlux — Interview Questions

Spring Boot Essentials

  • Spring Boot Fundamentals — Interview Questions
  • Spring Boot Runners, Servers & Configuration — Interview Questions
  • Spring Boot Controllers, Profiles, Actuator & DevTools — Interview Questions
  • Spring Boot Testing, Exceptions & Auto-Configuration — Interview Questions
  • REST APIs, Swagger, Embedded Servers & Key Annotations — Interview Questions

Spring MVC

  • Spring MVC Architecture & DispatcherServlet — Interview Questions
  • Spring MVC Request Mapping & Controllers — Interview Questions
  • Spring MVC Forms, Views & Interceptors — Interview Questions
  • Spring MVC Exceptions, Security & Dependency Injection — Interview Questions
  • Spring MVC Data Binding, Static Resources & Path Variables — Interview Questions
  • Spring MVC i18n, Testing, File Uploads & Scaling — Interview Questions

Hibernate & Spring Data JPA

  • Hibernate & JPA Core Concepts — Interview Questions
  • Hibernate Performance, Mapping & Scenarios — Interview Questions

SQL

  • SQL Basics, Keys, Normalization & Transactions — Interview Questions
  • SQL Joins, Triggers, Procedures, Functions & Indexes — Interview Questions
  • SQL "Difference Between" Questions — Interview Questions
  • SQL Query Writing (Part 1) — Interview Questions
  • SQL Query Writing (Part 2) — Interview Questions

Microservices Basics

  • Microservices, API Gateway & Communication — Interview Questions
  • Service Discovery, Data Consistency & Deployment — Interview Questions
  • Microservices Monitoring, Security & Resilience — Interview Questions

Maven & Git

  • Maven — Interview Questions
  • Git — Interview Questions
HomeLearnJava Interview PrepJava Interview Prep: Fresher to 2 YearsSpring Boot Essentials
✓ FreeBeginner· 7 min read

Spring Boot Controllers, Profiles, Actuator & DevTools — Interview Questions

@RestController vs @Controller, @RequestMapping vs @GetMapping, @SpringBootApplication vs @EnableAutoConfiguration, active profiles, WAR vs embedded containers, Actuator, listing beans, reading environment properties, debug logging and DevTools.

Published September 25, 2026


How to use this lesson

These questions mix web basics with operational tooling. For Actuator in particular, interviewers want to hear that you know which endpoints are exposed by default, and how to secure them.

Q1. What does @RestController do?

Short answer: It marks a class as a web controller whose methods' return values are written directly to the HTTP response body, serialised to JSON by Jackson, instead of being resolved as view names. It's @Controller + @ResponseBody in one annotation.

@RestController
@RequestMapping("/api/orders")
class OrderController {
    private final OrderService service;
    OrderController(OrderService service) { this.service = service; }

    @GetMapping("/{id}")
    OrderDto get(@PathVariable long id) { return service.find(id); }     // → JSON
}

Learn it in depth → REST Controllers

Q2. What's the difference between @Controller and @RestController?

Short answer: A @Controller method's return value is treated as a view name (Thymeleaf, JSP), unless the method is also annotated with @ResponseBody. In a @RestController, every method behaves as if it had @ResponseBody, so it returns data (JSON or XML).

Key points to cover:

  • Use @Controller for server-rendered HTML pages, and @RestController for APIs. One application can contain both.

Q3. What's the difference between @RequestMapping and @GetMapping?

Short answer: @RequestMapping is the general mapping annotation. It can match any HTTP method (set it with method = RequestMethod.GET), and it's commonly used at class level for a base path. @GetMapping is a composed shortcut for @RequestMapping(method = GET). Its siblings are @PostMapping, @PutMapping, @PatchMapping and @DeleteMapping.

Key points to cover:

  • @RequestMapping without method matches all HTTP methods. That's usually unintended on a handler method.

Q4. What's the difference between @SpringBootApplication and @EnableAutoConfiguration?

Short answer: @EnableAutoConfiguration does one thing: it turns on Boot's conditional auto-configuration. @SpringBootApplication includes it, together with @SpringBootConfiguration (a @Configuration) and @ComponentScan. You normally use only @SpringBootApplication, on the main class.

Q5. How do you find the active profiles programmatically?

Short answer: Inject the Environment, and call getActiveProfiles(). Use acceptsProfiles(Profiles.of("prod")) to check a condition.

@Component
class StartupInfo implements ApplicationRunner {
    private final Environment env;
    StartupInfo(Environment env) { this.env = env; }

    public void run(ApplicationArguments args) {
        log.info("Active profiles: {}", Arrays.toString(env.getActiveProfiles()));
        if (env.acceptsProfiles(Profiles.of("prod"))) { /* prod-only checks */ }
    }
}

Key points to cover:

  • If no profile is active, getActiveProfiles() returns an empty array, and the default profile applies. getDefaultProfiles() returns ["default"].
  • Prefer @Profile on beans to scattering if (profile == …) checks through the code.

Q6. What's the difference between WAR deployment and embedded containers?

Short answer: A WAR is deployed into an externally installed servlet container (Tomcat, JBoss/WildFly), which hosts one or more applications. With an embedded container, the server is a library inside your app, packaged as a single executable JAR. The app owns its server, and runs anywhere Java runs.

WAR on an external serverEmbedded (executable JAR)
Server install and configManaged separately by operationsPart of the app, configured with server.* properties
DeploymentCopy the WAR into the serverjava -jar, or a container image
VersioningServer version shared by all apps on itEach app pins its own server version
FitLegacy and shared app serversMicroservices, containers, cloud

Key points to cover:

  • Spring Boot can still build a WAR: set <packaging>war</packaging> and extend SpringBootServletInitializer.

Q7. What is Spring Boot Actuator?

Short answer: Actuator adds production-ready operational endpoints under /actuator:

  • health, with liveness and readiness groups for Kubernetes.
  • info.
  • metrics, through Micrometer, exportable to Prometheus and others.
  • env, configprops, beans, mappings, loggers (change log levels at runtime), threaddump and heapdump.

Key points to cover:

  • Over HTTP, only health is exposed by default. Expose more deliberately, with management.endpoints.web.exposure.include=health,info,prometheus.
  • Secure the sensitive endpoints. env, heapdump and configprops can leak secrets. Put management on a separate port, or behind Spring Security.

Learn it in depth → Health Checks

Q8. How do you enable Actuator?

Short answer: Add spring-boot-starter-actuator, then configure which endpoints are exposed, and how they're secured:

management:
  endpoints:
    web:
      exposure:
        include: health,info,metrics,prometheus
  endpoint:
    health:
      show-details: when-authorized
      probes:
        enabled: true            # /actuator/health/liveness and /readiness

Q9. How do you list all the beans in the application?

Short answer: Inject the ApplicationContext, and call getBeanDefinitionNames(). Or expose the /actuator/beans endpoint, which also shows each bean's type, scope and dependencies.

@Bean
CommandLineRunner listBeans(ApplicationContext ctx) {
    return args -> Arrays.stream(ctx.getBeanDefinitionNames()).sorted().forEach(System.out::println);
}

Q10. Can you check environment properties in a Spring Boot application? How?

Short answer: Yes:

  • Inject the Environment, and call getProperty("key"), with an optional default and target type.
  • Inject single values with @Value("${key}").
  • Bind groups of settings to a @ConfigurationProperties class, which is the preferred, type-safe option.
  • At runtime, the /actuator/env endpoint shows every property source and its values (with sensitive values masked).
@ConfigurationProperties(prefix = "payments")
record PaymentProperties(String baseUrl, Duration timeout, int maxRetries) { }
// enable it with @EnableConfigurationProperties(PaymentProperties.class) or @ConfigurationPropertiesScan

Common trap: injecting Environment everywhere, and reading raw strings. Typed configuration properties are validated at startup, can carry @Validated constraints, and show up in IDE auto-completion.

Q11. How do you enable debug logging?

Short answer: Set the log level of the loggers you care about:

logging:
  level:
    com.shop: DEBUG                          # your code
    org.springframework.web: DEBUG           # request mapping details
    org.hibernate.SQL: DEBUG                 # SQL statements

Key points to cover:

  • Running with --debug enables debug output for core loggers, and prints the auto-configuration report, without turning on debug for everything.
  • logging.level.root=DEBUG works, but floods the logs.
  • Change levels at runtime, without a restart, through /actuator/loggers/{name}.

Q12. Why use the spring-boot-devtools dependency?

Short answer: To speed up the development loop:

  • Automatic restart when classes change. It's fast because only your code's class loader is reloaded.
  • LiveReload for browser refresh.
  • Development-friendly defaults, such as template caching turned off.
  • Global settings through ~/.config/spring-boot/.

Key points to cover:

  • DevTools is disabled automatically in a packaged production JAR. Still, declare it as optional (Maven) or developmentOnly (Gradle), so it never ships.

Follow-up questions this topic invites — and their answers

Q: What does /actuator/health check? A: It aggregates HealthIndicators: disk space, the database (a validation query), Redis, Kafka, mail and so on. You can add your own by implementing HealthIndicator. Kubernetes probes should use the liveness and readiness groups, so that a slow database doesn't make the pod restart in a loop.

Q: How do you add custom information to /actuator/info? A: Set info.* properties, enable the build and git info contributors (management.info.build.enabled, plus the build-info goal of the Maven plugin), or implement InfoContributor.

Q: How do you publish a custom metric? A: Inject MeterRegistry, and use registry.counter("orders.placed", "channel", "web").increment(), or Timers and Gauges. Micrometer exports them to Prometheus, Datadog and other backends.

Q: @RequestParam vs @PathVariable? A: @PathVariable binds part of the URL path (/orders/{id}), and identifies a resource. @RequestParam binds query-string or form parameters (/orders?status=PAID), and is typically used for filtering, sorting and pagination.

Previous

Spring Boot Runners, Servers & Configuration — Interview Questions

Next

Spring Boot Testing, Exceptions & Auto-Configuration — Interview Questions

AI Tutor

Lesson: Spring Boot Controllers, Profiles, Actuator & DevTools — Interview Questions

Quick actions

AI responses can be inaccurate. Verify critical information.