refactor(geoip): replace ObjectMapper instantiation with JsonMapper (Jackson 2 -> Jackson 3)#139
Conversation
…or improved configuration
📝 WalkthroughWalkthroughThe GeoIpService's Jackson dependency imports were updated from the default Jackson namespace to a tools.jackson variant, with the ObjectMapper instantiation method changed from direct instantiation to using JsonMapper's builder pattern. This affects JSON response parsing in country code resolution. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
booklore-api/src/main/java/org/booklore/service/audit/GeoIpService.java (1)
28-28: Prefer using the Spring-managed mapper instead of a local instance.Line 28 creates a mapper with
JsonMapper.builder().build(), which can drift from global JSON config used elsewhere. Injecting the configured mapper keeps behavior consistent.Proposed refactor
-import tools.jackson.databind.json.JsonMapper; @@ - private final ObjectMapper objectMapper = JsonMapper.builder().build(); + private final ObjectMapper objectMapper;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@booklore-api/src/main/java/org/booklore/service/audit/GeoIpService.java` at line 28, Replace the locally constructed ObjectMapper in GeoIpService (the field named objectMapper built with JsonMapper.builder().build()) with the Spring-managed mapper: remove the direct instantiation and accept/inject the application ObjectMapper bean (e.g., via constructor parameter or `@Autowired` field) so GeoIpService uses the globally configured mapper instance instead of a private JsonMapper-built one.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@booklore-api/src/main/java/org/booklore/service/audit/GeoIpService.java`:
- Line 28: Replace the locally constructed ObjectMapper in GeoIpService (the
field named objectMapper built with JsonMapper.builder().build()) with the
Spring-managed mapper: remove the direct instantiation and accept/inject the
application ObjectMapper bean (e.g., via constructor parameter or `@Autowired`
field) so GeoIpService uses the globally configured mapper instance instead of a
private JsonMapper-built one.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 852c2d6b-2134-4c9a-9213-8dc228de4987
📒 Files selected for processing (1)
booklore-api/src/main/java/org/booklore/service/audit/GeoIpService.java
…or improved configuration (grimmory-tools#139)
…or improved configuration (grimmory-tools#139)
…or improved configuration (#139)
…or improved configuration (#139)
Description
Linked Issue: Fixes #
Changes
Summary by CodeRabbit