STRUCTURE OF SPRING BOOT (Maven)

 my-springboot-app/

├── src/
│   └── main/
│       ├── java/
│       │   └── com/
│       │       └── example/
│       │           └── myapp/
│       │               ├── MySpringBootApplication.java  <-- Main class
│       │               ├── controller/
│       │               │   └── UserController.java       <-- REST controller
│       │               ├── service/
│       │               │   └── UserService.java          <-- Business logic
│       │               ├── repository/
│       │               │   └── UserRepository.java       <-- Data access layer
│       │               └── model/
│       │                   └── User.java                 <-- Entity class
│       └── resources/
│           ├── application.properties                   <-- App configuration
│           └── static/                                  <-- Static files (HTML, CSS, JS)
│           └── templates/                               <-- Thymeleaf templates (if used)
│           └── messages.properties                      <-- i18n (optional)

├── src/
│   └── test/
│       └── java/
│           └── com/
│               └── example/
│                   └── myapp/
│                       └── MySpringBootApplicationTests.java

├── pom.xml                                              <-- Maven build file
└── README.md



MySpringBootApplication.java:

 main entry point with @SpringBootApplicaion  annotation.

controller/

    handle HTTP request(e.g., GET,POST) via @RestController

service/

    contain business logic

repository/

    handle database access using spring Data jpa (jpaRepository)

application.properties

    configuration file( server port, db setting )

model/

    java classes represention database tables  

template/

    HTML templates for view rendering (thymeleaf,etc.)

static/

    static web content(js,css,images)  

pom.xml -> file is the heart of any maven based spring boot applicaion

PROJECT OBJECT MODEL

it defines project configuration,including

  * project metadata(name, version,etc)

    * dependencies(like spring web , jpa , mysql)

    * build plugins (eg. spring boot plugin)

    * repository sources 

 

IOC - Inversion Of Control 

    inversion of control is design principle where the control the object creation and dependency management from application to spring container

instead of writing code to create object and wire dependency manually, you let spring do it for you

 ioc in spring is implement using dependency injection,where

    $ spring create objects.

    $ spring injects their dependencies.

    $ you just use them without worrying about setup

 

spring bean

 

fd

 

 the spring boot application does the 3 things:

                @configuration 

                @enable auto configuraion

                @conponent scanning 

 

 

 

 

 


 

Comments

Popular posts from this blog

INTRO OF SPRING BOOT

JAVA-INTO