Goal:
I am trying to create a UML class diagram for a java spring application. Spring uses a lot of annotations and I couldn't find any resources online on how to properly model them in UML.
I know that there is this question and it gives a good answer on how to model class annotations but it does not talk about method or variable annotations.
Examples:
Example class with annotations:
@RestController
@RequestMapping("/someRoute")
public class BaseController {
@Autowired
protected BaseService service;
@GetMapping(BaseEntity.ID_MAPPING)
public ResponseEntity<BaseEntity> findById(
@PathVariable(value = BaseEntity.ID) long id
) throws ResourceNotFoundException {
BaseEntity entity = service.findById(id);
return ResponseEntity.ok().body(entity);
}
}
For the class annotations I would use this:
For method and attribute annotations I tried using this:
But as you can see this gets very long and complicated to read very fast. This also would not work if something had multiple tagged annotations.
Question:
So I would like to know if there is a correct or better way to show annotations in an UML class diagram? Or if java annotations should even be in an UML diagram at all?