Conversation
anupaprabhasara
commented
Mar 28, 2026
There was a problem hiding this comment.
Pull request overview
Introduces a new Spring Boot microservice module (appointment-service) to manage appointments within the Healio multi-service Maven build.
Changes:
- Adds
appointment-serviceas a new Maven module with Spring Boot + JPA, controller/service/repository layers, and DTO/request models. - Adds centralized exception handling and basic request validation for appointment creation.
- Adds Maven wrapper artifacts under the service module and wires in Spring Cloud Config import.
Reviewed changes
Copilot reviewed 19 out of 21 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| services/appointment-service/src/test/java/com/healio/appointmentservice/AppointmentServiceApplicationTests.java | Adds basic Spring context-load test for the new service module. |
| services/appointment-service/src/main/resources/application.properties | Defines service name/port and Spring Cloud Config import. |
| services/appointment-service/src/main/java/com/healio/appointmentservice/service/AppointmentService.java | Implements appointment creation + retrieval and DTO mapping. |
| services/appointment-service/src/main/java/com/healio/appointmentservice/request/AppointmentCreateRequest.java | Adds validated request model for creating appointments. |
| services/appointment-service/src/main/java/com/healio/appointmentservice/repository/AppointmentRepository.java | Introduces JPA repository for Appointment. |
| services/appointment-service/src/main/java/com/healio/appointmentservice/model/BaseEntity.java | Adds shared JPA base entity with UUID id + timestamps. |
| services/appointment-service/src/main/java/com/healio/appointmentservice/model/Appointment.java | Adds Appointment JPA entity. |
| services/appointment-service/src/main/java/com/healio/appointmentservice/exc/NotFoundException.java | Adds a 404 exception type. |
| services/appointment-service/src/main/java/com/healio/appointmentservice/exc/GenericErrorResponse.java | Adds reusable exception carrying HttpStatus. |
| services/appointment-service/src/main/java/com/healio/appointmentservice/exc/GeneralExceptionHandler.java | Adds REST exception handling for validation and common exceptions. |
| services/appointment-service/src/main/java/com/healio/appointmentservice/enums/AppointmentStatus.java | Adds appointment status enum. |
| services/appointment-service/src/main/java/com/healio/appointmentservice/dto/AppointmentDto.java | Adds DTO returned by API/service layer. |
| services/appointment-service/src/main/java/com/healio/appointmentservice/controller/AppointmentController.java | Adds REST endpoints to create + list appointments. |
| services/appointment-service/src/main/java/com/healio/appointmentservice/AppointmentServiceApplication.java | Adds Spring Boot application entrypoint. |
| services/appointment-service/pom.xml | Adds the new module’s Maven config and dependencies. |
| services/appointment-service/mvnw.cmd | Adds Windows Maven wrapper script (module-local). |
| services/appointment-service/mvnw | Adds Unix Maven wrapper script (module-local). |
| services/appointment-service/.mvn/wrapper/maven-wrapper.properties | Adds Maven wrapper configuration for the module. |
| services/appointment-service/.mvn/wrapper/maven-wrapper.jar | Adds Maven wrapper JAR (binary) under the module. |
| services/appointment-service/.gitkeep | Adds a placeholder file under the module directory. |
| pom.xml | Registers services/appointment-service in the root multi-module build. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Map<String, String> errors = new HashMap<>(); | ||
| ex.getBindingResult().getAllErrors() | ||
| .forEach(x -> errors.put(((FieldError) x).getField(), x.getDefaultMessage())); | ||
| return ResponseEntity.badRequest().body(errors); |
There was a problem hiding this comment.
handleMethodArgumentNotValid iterates over getAllErrors() and unconditionally casts each error to FieldError. getAllErrors() can include ObjectError instances (global errors), which will cause a ClassCastException at runtime. Use getFieldErrors() (and optionally handle global errors separately) instead of casting.
| # ---------------------------------------------------------------------------- | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
| # ---------------------------------------------------------------------------- | ||
|
|
||
| # ---------------------------------------------------------------------------- | ||
| # Maven Start Up Batch script | ||
| # | ||
| # Required ENV vars: | ||
| # ------------------ | ||
| # JAVA_HOME - location of a JDK home dir | ||
| # | ||
| # Optional ENV vars | ||
| # ----------------- | ||
| # M2_HOME - location of maven2's installed home dir | ||
| # MAVEN_OPTS - parameters passed to the Java VM when running Maven | ||
| # e.g. to debug Maven itself, use | ||
| # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 | ||
| # MAVEN_SKIP_RC - flag to disable loading of mavenrc files | ||
| # ---------------------------------------------------------------------------- | ||
|
|
||
| if [ -z "$MAVEN_SKIP_RC" ] ; then | ||
|
|
||
| if [ -f /usr/local/etc/mavenrc ] ; then | ||
| . /usr/local/etc/mavenrc | ||
| fi | ||
|
|
||
| if [ -f /etc/mavenrc ] ; then | ||
| . /etc/mavenrc | ||
| fi | ||
|
|
||
| if [ -f "$HOME/.mavenrc" ] ; then | ||
| . "$HOME/.mavenrc" | ||
| fi | ||
|
|
||
| fi | ||
|
|
||
| # OS specific support. $var _must_ be set to either true or false. |
There was a problem hiding this comment.
The Maven wrapper (mvnw/.mvn/) is added only under services/appointment-service. In a multi-module Maven build, the wrapper is typically placed at the repository root so contributors can run a consistent Maven version from the top-level project. Consider moving the wrapper to the repo root (or removing it from this module if it’s not intended to be used standalone).
| # ---------------------------------------------------------------------------- | |
| # Licensed to the Apache Software Foundation (ASF) under one | |
| # or more contributor license agreements. See the NOTICE file | |
| # distributed with this work for additional information | |
| # regarding copyright ownership. The ASF licenses this file | |
| # to you under the Apache License, Version 2.0 (the | |
| # "License"); you may not use this file except in compliance | |
| # with the License. You may obtain a copy of the License at | |
| # | |
| # https://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, | |
| # software distributed under the License is distributed on an | |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
| # KIND, either express or implied. See the License for the | |
| # specific language governing permissions and limitations | |
| # under the License. | |
| # ---------------------------------------------------------------------------- | |
| # ---------------------------------------------------------------------------- | |
| # Maven Start Up Batch script | |
| # | |
| # Required ENV vars: | |
| # ------------------ | |
| # JAVA_HOME - location of a JDK home dir | |
| # | |
| # Optional ENV vars | |
| # ----------------- | |
| # M2_HOME - location of maven2's installed home dir | |
| # MAVEN_OPTS - parameters passed to the Java VM when running Maven | |
| # e.g. to debug Maven itself, use | |
| # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 | |
| # MAVEN_SKIP_RC - flag to disable loading of mavenrc files | |
| # ---------------------------------------------------------------------------- | |
| if [ -z "$MAVEN_SKIP_RC" ] ; then | |
| if [ -f /usr/local/etc/mavenrc ] ; then | |
| . /usr/local/etc/mavenrc | |
| fi | |
| if [ -f /etc/mavenrc ] ; then | |
| . /etc/mavenrc | |
| fi | |
| if [ -f "$HOME/.mavenrc" ] ; then | |
| . "$HOME/.mavenrc" | |
| fi | |
| fi | |
| # OS specific support. $var _must_ be set to either true or false. | |
| # | |
| # Delegating Maven wrapper for the appointment-service module. | |
| # This project is expected to use the Maven wrapper located at the | |
| # repository root. This script forwards all invocations to that | |
| # root-level mvnw if it exists. | |
| # | |
| # Resolve the directory of this script | |
| SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" | |
| # Infer the repository root by removing the module path suffix | |
| REPO_ROOT="${SCRIPT_DIR%/services/appointment-service}" | |
| if [ -x "$REPO_ROOT/mvnw" ]; then | |
| # Delegate to the repository root Maven wrapper | |
| exec "$REPO_ROOT/mvnw" "$@" | |
| fi | |
| echo "Error: Maven wrapper for this project is located at the repository root." 1>&2 | |
| echo "Please run Maven from the repository root, for example:" 1>&2 | |
| echo " ./mvnw <goals>" 1>&2 | |
| exit 1 |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
will merge tomorrow. need to review. |