DEV Community

Anne Quinkenstein
Anne Quinkenstein

Posted on

Spring Boot

Spring Boot
...
Automatic Controller Mappings for MVC based Applications
few annotations
Auto Config

  • application Context (inversion of Control container (bean factory) ) -> opinionated configarations

start Project with spring initializer
start.spring.io
-maven oder gradle
java (kotlin, groovy)
package as jar
java 17? welche version?
add dependencies ...
spring web ...
(ID-Plugin possible)
copy files in personal directory (-rekursivly)

main Method -> @SpringBootApplication / use that as base for component scanning & auto-config
ressources -> static/ template ( because of webpackage)
application.properties -> control context

libary-> configured, embedded tomcat

Inversion of Control
Container -> Objects injected at runtime/ starttime (added to BeanFactory)
IoC & Dependency Injection -> objects dont create dependend objects, but container manages them and injects them as needed

IoC Container -> triggered from main class
IoC Container build Objects wich are referenced in Main, pointers in classes,
pointers in classes & IoC Container injects them + manage LifeCycle

Spring IoC -Bean Factory is IoC Container
Hooks //

Application Context to interact <- Spring Boot application, that conext is started for us, and autoconfig
Application Context is wrapper around bean factory

Spring Beans
Spring-> handles Object initilazation, instatiation
Beanfacotry -> beans instatioated in right order

annotations
metadata for code - often use for compiler or runtime instruction (@test)

spring benutzt sie als hebelpunkte für code. add functionality, with proxies

beans in beanfactory are proxied, annotations drive proxies

annotations drive behavior and component scanning as part of the application context
-> scope for calling methods -> calling order matters

Spring Data
provides a commen set of interfaces based on JPA
interface for JDBC, easier
repository pattern nativly
key benefits of key data
swap datasources is easy
SPring data repository provides the methods needed to access the data
interface leverage proxies that builds the actual CRUD methods
Entity Objects
Data Sourced autoconfigured by Spring Boot

embedded Database

tomcat on 8080

Top comments (0)