Spring / Spring Boot 4 Basics Interview Questions
What is the Spring Boot starter parent (POM) and how do you set up a Spring Boot 4 project?
The spring-boot-starter-parent POM sets sensible defaults for Maven builds: Java version, encoding, plugin versions, and dependency management via the Spring Boot BOM. It is the recommended way to start a Spring Boot project.
<!-- Maven: spring-boot-starter-parent --> <project> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>4.1.0</version> <!-- Spring Boot 4.1 (current) --> <relativePath/> </parent> <groupId>com.example</groupId> <artifactId>order-service</artifactId> <version>1.0.0-SNAPSHOT</version> <packaging>jar</packaging> <properties> <java.version>17</java.version> <!-- minimum for Boot 4 --> </properties> <dependencies> <!-- Spring Boot 4 modular starters --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-webmvc</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-validation</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> <!-- includes JUnit 5 (Jupiter only in Boot 4) --> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <!-- builds executable JAR with embedded Tomcat --> </plugin> </plugins> </build> </project>
More Related questions...