Mapstruct generated class not being injected by Spring in JHipster web app

For IntelliJ (Gradle) users,

Settings -> Build, Execution, Deployment -> Compiler -> Annotation Processors -> Enable annotation processing

Make sure to assemble gradle after.

For maven User,

Build tools -> Maven -> Importing -> Generated Sources folder


You should make sure that "target/generated-sources" is linked as a source folder in Eclipse.


From the JHipster documentation page for setting up Eclipse:

Add apt generated source folder to build path

When using buildship gradles default outputfolder is filtered and not visible in your workspace. Therefore you need to remove it from eclipse’s resource filter setting.

  • Right click on your project and select Properties
  • Select Resources
  • Remove the entry build
  • Select Java Build Path
  • Click Add Folder...
  • Check the path build/generated/source/apt/main

Make sure the new source folder contains the correctly generated mapper implementations when running JHipster via eclipse.