nijin39 / dddgen

20 stars 1 forks source link

Duplicated config problem #3

Open isheejong opened 3 years ago

isheejong commented 3 years ago

Hi,

I have executed the ddgen command below like:

dddgen -p com.lguplus.media.content -a album,superalbum,series
dddgen -p com.lguplus.media.product -a product

I wanted to create the bounded contexts for naming content, product. and, then, source codes was created successfully. but config class was duplicated per package. so, application starting was failed

public class ApiControllerAdvice {
    @ExceptionHandler(MethodArgumentNotValidException.class)
    public ResponseEntity<Map<String, String>> handleValidationExceptions(MethodArgumentNotValidException ex){
        Map<String, String> errors = new HashMap<>();
        ex.getBindingResult().getAllErrors()
            .forEach(c -> errors.put(((FieldError) c).getField(), c.getDefaultMessage()));
        return ResponseEntity.badRequest().body(errors);
    }
}
nijin39 commented 3 years ago

Currently, dddgen creates controller advice per package. I'll modify the program to choose whether to select controller advice using an option.