Hello everyone,
While working with Spring Boot + MapStruct, I noticed one recurring pain:
- Repeatedly writing @
Mapper(componentModel = "spring")
in every mapper - Manual configuration boilerplate just to get things wired up
It may look like a small at the first… but across multiple projects and dozens of mappers, this repetitive setup becomes a bigger productivity drag and an easy source of mistakes.
So, I created a MapStruct Spring Boot Starter.
What it does:
- Auto-detects and registers MapStruct mappers in your Spring Boot app
- No need to specify
componentModel = "spring"
everywhere in the mappers - Simple
dependency
+ optionalapplication.yml
config → ready to go
Installation:
1) Dependency:
Maven:
<dependency> <groupId>com.codestackfoundry.starters</groupId> <artifactId>mapstruct-spring-boot-starter</artifactId> <version>1.0.1</version> </dependency>
Gradle:
dependencies { implementation 'com.codestackfoundry.starters:mapstruct-spring-boot-starter:1.0.1' }
Configuration(Optional):
mapstruct: base-packages: - com.example.demo.mapper - com.shared.mappers fail-if-no-mappers: true
🔗 GitHub: https://github.com/codestackfoundry/spring-boot-starters
📄 Docs: https://codestackfoundry.com/docs/mapstruct-spring-boot-starter.html
I’d love to hear your feedback.
submitted by /u/effortlesscodeLearn
[link] [comments]