SShortSingh.
Back to feed

Spring Boot build failure traced to JPA dependencies in a MongoDB project

0
·2 views

A developer reopened an old Spring Boot project and encountered 20 compilation errors caused by a mismatch between the code and the project's dependencies. The pom.xml was configured with the MongoDB starter, while the code used JPA annotations such as @Entity and JpaRepository, which belong to the SQL-based spring-boot-starter-data-jpa dependency. Fixing the annotations to their MongoDB equivalents and changing the user ID type from Long to String resolved the compilation errors. The app still failed to start due to a duplicate key error in MongoDB, caused by existing documents with null username fields conflicting with a new unique index. Switching to fresh collection names in the @Document annotations cleared the conflict and allowed the application to start successfully.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Microservices vs Monolith: Why Rate Limiting Comes Down to Shared State

A software engineering team facing API latency spikes during traffic surges began evaluating whether their rate limiter should live inside their existing monolith or be extracted into a microservice. In a monolith, rate-limiting state can be stored in memory since all requests run through the same process, making enforcement straightforward. However, in a microservices architecture, each independently scaled instance maintains its own in-memory counter, causing the effective rate limit to multiply with every additional instance. The recommended solution is to centralize the shared counter in a fast external datastore such as Redis, which all service instances consult before processing a request. This approach ensures exact limit enforcement regardless of scale, delivers sub-millisecond latency, and simplifies monitoring and tuning to a single location.

0
ProgrammingDEV Community ·

Developer builds open-source TypeScript library to model SCHD dividend growth

A software developer has released an open-source TypeScript library called dividend-math, designed to simulate dividend reinvestment growth over time. The library centers on a pure function called dripCalculator, which models year-by-year share accumulation, price appreciation, and dividend growth. It was built to illustrate how ETFs like SCHD, which have historically grown dividends at roughly 10–12% annually, can outperform higher but stagnant yields over long holding periods. The tool powers several calculators on dividendpayoutcalculator.com, including a dedicated SCHD calculator that accounts for quarterly dividend payments. The library is available on npm under an MIT license, with source code hosted on GitHub.

0
ProgrammingDEV Community ·

How ESP32's LEDC Module Uses PWM to Control LED Brightness

The ESP32 microcontroller includes a built-in peripheral called LEDC (LED PWM Controller) that dims LEDs using Pulse Width Modulation, a technique that switches LEDs on and off faster than the human eye can detect. The original ESP32's LEDC module contains 4 timers and 16 channels, all configured by writing to 32-bit peripheral registers. Dimming an LED requires three main steps: configuring a timer with the desired frequency and bit resolution, linking an LEDC channel to that timer, and writing a duty cycle value to set brightness. Once configured, the LED runs autonomously at the set brightness with no CPU involvement, and brightness can be updated at runtime by writing a new duty cycle value or triggering a hardware-managed smooth fade.

0
ProgrammingDEV Community ·

Distributed Storage Explained: How It Works and When It Makes Sense

Distributed storage spreads data across multiple nodes so that individual hardware failures do not cause outages or data loss, unlike single-node systems where one crash can mean total downtime. Around 68% of mid-size and larger organizations already run distributed storage, with high availability and failure tolerance cited as the primary driver by 74% of them. Core mechanisms include consistent hashing to distribute data across nodes, replication for hot data, and erasure coding for capacity-sensitive cold storage. Systems must also choose between strong consistency, which prevents data conflicts but may reduce availability during network splits, and eventual consistency, which prioritizes uptime at the risk of temporary staleness. Experts caution that distributing too early adds significant complexity, cost, and a steep learning curve, making single-node setups the practical choice for workloads under 10TB with no strict uptime requirements.