Self-correction: Used mono { ... } builder from kotlinx-coroutines-reactor to bridge suspend functions (userRepository.findById) into the reactive chain. Defined a custom AuthenticatedUserPrincipal data class to hold user ID and username, making it cleaner to access later. Added UserRepository check. Mapped errors to AuthException. Added ROLE_USER default authority.
Milestone:
- A runnable Spring Boot application structure exists.
- Dependencies for WebFlux, R2DBC, Postgres, Redis, Security, Flyway are included.
- Core Kotlin data classes representing our domain models are defined.
- Spring Data R2DBC repository interfaces are defined for data access.
application.propertiesis configured to connect to Postgres and Redis.- An initial Flyway migration script (
V1__Initial_schema.sql) defines the database tables. - The project is structured to support future features like JWT authentication, job scheduling, and more.
Try running the Spring Boot application (./gradlew bootRun or via your IDE). It should:
- Connect to PostgreSQL.
- Run the Flyway migration, creating the tables.
- Connect to Redis.
Why always me?