diff --git a/src/main/java/sg/com/smartinventory/controllers/CustomerController.java b/src/main/java/sg/com/smartinventory/controllers/CustomerController.java index 0981f70..517d314 100644 --- a/src/main/java/sg/com/smartinventory/controllers/CustomerController.java +++ b/src/main/java/sg/com/smartinventory/controllers/CustomerController.java @@ -29,8 +29,9 @@ @RestController @RequestMapping("/customers") // @CrossOrigin(origins = "http://localhost:5173") -@CrossOrigin(origins = "${server.address}") +@CrossOrigin(origins = "${frontend.server.address}") public class CustomerController { + private CustomerService customerService; // @Autowired diff --git a/src/main/java/sg/com/smartinventory/controllers/ProductController.java b/src/main/java/sg/com/smartinventory/controllers/ProductController.java index ee15f6a..a2d8e88 100644 --- a/src/main/java/sg/com/smartinventory/controllers/ProductController.java +++ b/src/main/java/sg/com/smartinventory/controllers/ProductController.java @@ -22,7 +22,7 @@ @RestController @RequestMapping("/products") // @CrossOrigin(origins = "http://localhost:5173") -@CrossOrigin(origins = "${server.address}") +@CrossOrigin(origins = "${frontend.server.address}") public class ProductController { private ProductService productService; diff --git a/src/main/java/sg/com/smartinventory/controllers/ReviewController.java b/src/main/java/sg/com/smartinventory/controllers/ReviewController.java index 23038c5..3bbee4a 100644 --- a/src/main/java/sg/com/smartinventory/controllers/ReviewController.java +++ b/src/main/java/sg/com/smartinventory/controllers/ReviewController.java @@ -21,7 +21,7 @@ @RestController @RequestMapping("/reviews") // @CrossOrigin(origins = "http://localhost:5173") -@CrossOrigin(origins = "${server.address}") +@CrossOrigin(origins = "${frontend.server.address}") public class ReviewController { private ReviewService reviewService; diff --git a/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..1d1e1af --- /dev/null +++ b/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,9 @@ +{ + "properties": [ + { + "name": "frontend.server.address", + "type": "java.lang.String", + "description": "The frontend server address. " + } + ] +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index f485269..71565fb 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,7 +1,7 @@ spring.application.name=smart-inventory # Server CORS Configuration. -server.address=${ADDRESS:http://localhost:5173} +frontend.server.address=${ADDRESS:http://localhost:5173} # Server Port Configuration. # The default server port is 8080.