0

I have a multi module spring boot project. Each module has its own controller with N endpoints. I would like to be able to create jar with different endpoints based on the profile used during the build, perhaps with Maven profiles. Whereas I don't want to exclude a whole controller but only some controller endpoints.

I know that maybe this thing can be done using the spring profile. But with using spring profiles, it means that the jar would always have all the endpoints. I want to remove them completely and not "hide" them. Once the jar is created with a certain profile, the endpoints ignored by that profile must not be accessible.

Is there a possibility to do this or do I have to create separate branches?

Thank you

Lako12
  • 154
  • 1
  • 10
  • So if I understand it correctly, you want to remove some methods (= endpoints) of a Java class (= controller) during compilation? That sounds a lot like conditional compilation and I don't know if that's possible in Java. – g00glen00b Aug 30 '23 at 10:21
  • Exact. I want to have the ability to create jars with different endpoints using the same project. Without having to create different branches – Lako12 Aug 30 '23 at 10:32
  • Might be a duplicate of this then: [Java conditional compilation: how to prevent code chunks from being compiled?](https://stackoverflow.com/q/4526113/1915448) – g00glen00b Aug 30 '23 at 11:26

0 Answers0