Task | Spring Boot | FastAPI |
---|---|---|
Generate project structure | https://start.spring.io/ | https://fastapi.tiangolo.com/project-generation/ |
Define API routes | @RequestMapping | APIRouter |
Deal with database (ORM & Querying) | Hibernate | SQLAlchemy |
Entity to Data Transfer Object (DTO) | ModelMapper | Pydantic.BaseModel (with orm_mode = True ) |
Database Migration | Liquibase, Flyway | Alembic |
Dependency Management | Maven / Graddle | Pip |
HTTP Request Interceptor | AspectJ, ServletFilter | Depends, Middleware |
Built-in Authentication | Spring Security | FastAPI.security |
Read Environment file | @Value(“${key}”) Files .properties | Pydantic.BaseSetting File .env |
OpenAPI | springdoc-openapi | It has a built-in module. Access at localhost:8000/docs |