-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Labels
Description
Another one :-)
Suppose I have a mapper like this:
@Mapper // with proper configuration of componentModel, injectionStrategy = CONSTRUCTOR, etc.
public abstract class Mapper {
@Autowired
private SpringComponent component;
// mapping methods
}This works, however using the recommended constructor injection
@Mapper // with proper configuration of componentModel etc.
public abstract class Mapper {
private final SpringComponent component;
@Autowired
Mapper(SpringComponent component) {
this.component = component;
}
// mapping methods
}does not work, since the generated mapper always requires a default constructor to be present. I suggest that if a single @Autowired constructor (or equivalent for other component models) is found, it takes the arguments and adds it to the generated constructor (including @Qualifier annotations etc.)
This is sort of low priority because using field injection on the base mapper still works, but would be nice to have I think.
chriswill0w, fuesec, Chessray, xou816, nbrugger-tgm and 34 more