File tree Expand file tree Collapse file tree
src/main/java/de/odrotbohm/restbucks/dashboard Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
2020 <datasource-micrometer .version>2.1.1</datasource-micrometer .version>
2121 <java .version>25</java .version>
2222 <jmolecules .version>2025.0.2</jmolecules .version>
23+ <spring-data-bom .version>2026.0.0-SNAPSHOT</spring-data-bom .version>
2324 <spring-modulith .version>2.1.0-SNAPSHOT</spring-modulith .version>
2425
2526 <!-- Enable full annotation processing on Java 23+ -->
Original file line number Diff line number Diff line change 2727
2828import org .javamoney .moneta .Money ;
2929import org .springframework .data .rest .webmvc .RepositoryLinksResource ;
30+ import org .springframework .data .rest .webmvc .support .ETag ;
3031import org .springframework .hateoas .server .RepresentationModelProcessor ;
32+ import org .springframework .http .HttpStatus ;
3133import org .springframework .modulith .events .ApplicationModuleListener ;
34+ import org .springframework .web .ErrorResponse ;
35+ import org .springframework .web .bind .annotation .ExceptionHandler ;
3236import org .springframework .web .bind .annotation .GetMapping ;
3337import org .springframework .web .bind .annotation .RestController ;
3438
@@ -58,6 +62,16 @@ void on(OrderPaid event) {
5862 this .revenue = revenue .add (event .total ());
5963 }
6064
65+ @ GetMapping ("/exception" )
66+ void exception () {
67+ throw new IllegalArgumentException ();
68+ }
69+
70+ @ ExceptionHandler
71+ ErrorResponse handle (IllegalArgumentException exception , ETag etag ) {
72+ return ErrorResponse .builder (exception , HttpStatus .NOT_ACCEPTABLE , "Boo!" ).build ();
73+ }
74+
6175 /*
6276 * (non-Javadoc)
6377 * @see org.springframework.hateoas.server.RepresentationModelProcessor#process(org.springframework.hateoas.RepresentationModel)
You can’t perform that action at this time.
0 commit comments