Spring Boot for Beginners

    Atul Kabra3 min readUpdated

    Spring Boot is a framework built on top of the Spring Framework that lets you create stand-alone, production-ready Java applications with almost no configuration. It does this through auto-configuration (sensible defaults wired up automatically based on what is on your classpath), starter dependencies (curated bundles of libraries), and an embedded web server (so you run a single command and your app is live — no separate Tomcat install). The result: you go from empty project to a working web app in minutes instead of hours.

    Why Spring Boot exists

    Traditional Spring required a lot of XML and manual setup before you could see anything run. Spring Boot's philosophy is "convention over configuration" — it assumes reasonable defaults and only asks you to override what is genuinely different about your app. You add a starter, and Spring Boot configures everything that starter needs.

    The three pillars

    • Starters — dependencies like spring-boot-starter-web pull in everything needed for web development (Spring MVC, JSON support, an embedded server) as one coordinated set, so you avoid version-mismatch headaches.
    • Auto-configuration — Boot inspects your classpath and beans, then configures things automatically. Have a database driver and a DataSource? Boot wires up a connection pool for you.
    • Embedded server — your app packages an embedded Tomcat (or Jetty/Undertow). You run a plain main() method and your web server starts inside the same process.

    Your first Spring Boot app

    A complete runnable application can be just a handful of lines:

    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    import org.springframework.web.bind.annotation.GetMapping;
    import org.springframework.web.bind.annotation.RestController;
    
    // @SpringBootApplication enables auto-configuration + component scanning
    @SpringBootApplication
    public class DemoApplication {
    
        public static void main(String[] args) {
            // Boots the whole app: starts the embedded server and the Spring container
            SpringApplication.run(DemoApplication.class, args);
        }
    }
    
    // A simple web endpoint to prove the app is running
    @RestController
    class HelloController {
    
        // Maps GET / to this method; the return value becomes the HTTP response body
        @GetMapping("/")
        public String hello() {
            return "Hello from Spring Boot!";
        }
    }
    

    Run main(), open http://localhost:8080/, and you see the message. There is no XML, no manual server install, and no boilerplate — Boot handled it all.

    Want to learn this properly?

    Join the waitlist for our courses — beginner-friendly, project-first classes in Jalgaon.

    Browse courses

    How @SpringBootApplication works

    That one annotation is shorthand for three:

    • @EnableAutoConfiguration — turns on auto-configuration.
    • @ComponentScan — finds your @Component/@Service/@RestController beans.
    • @Configuration — lets the class itself declare beans.

    This is why placing your main class at the root package matters: component scanning starts there and descends, so all your code should live in sub-packages beneath it.

    Configuration with application.properties

    You customise behaviour in a single application.properties (or application.yml) file:

    # Change the port the embedded server listens on
    server.port=8081
    
    # Point at a database (Boot auto-configures the pool from this)
    spring.datasource.url=jdbc:postgresql://localhost:5432/lms
    

    Boot reads these and adjusts the auto-configuration accordingly. You only specify what differs from the defaults.

    Common mistakes

    • Placing the main class in a sub-package below your code. Component scanning starts at the main class's package; code in a sibling or parent package will not be found.
    • Fighting auto-configuration manually. Before writing custom config, check whether a property already controls it — usually one exists.
    • Mixing incompatible dependency versions. Use the Spring Boot parent/BOM so starter versions stay aligned; do not pin library versions by hand.
    • Confusing @Controller and @RestController. @RestController returns data (JSON/text) directly; @Controller returns view names. Using the wrong one yields unexpected output.
    • Expecting Boot to replace understanding of Spring. Boot automates Spring; knowing dependency injection still matters.

    FAQ

    Is Spring Boot beginner-friendly? Yes — it is one of the fastest ways to get a Java web app running, which is why it is the standard starting point for backend Java today.

    Do I deploy the embedded server to production? You can. Boot produces a single executable JAR that runs anywhere Java is installed, which simplifies deployment significantly.

    Keep learning

    Spring Boot builds on the Spring Framework. Next, build a real REST API with Spring Boot or compare it in Spring vs Spring Boot. More in the Advanced Java hub.


    Ready to build real backends fast? Join the waitlist for the Advanced Java course at Infoplanet, Jalgaon.

    Want to learn this properly?

    Join the waitlist for our courses — beginner-friendly, project-first classes in Jalgaon.

    Browse courses
    Atul Kabra

    Founder, Infoplanet

    Atul Kabra founded Infoplanet in 2001 and has spent over two decades teaching programming — C, C++, Java, databases and more — to students across Maharashtra.

    Related guides