Reputation: 420
Currently, there are certain private API's in my controller class which I need to ignore them in my production environment, whereas needed in the QA and Dev environments.
I'm using @ApiIgnore annotation from spring fox to achieve this on a global level. Is there a way where I can execute this annotation based on spring boot environment variable?
Or any other solution to tackle this problem ?
Upvotes: 3
Views: 2694
Reputation: 1201
You can use
@Autowired private Environment environment;
....
this.environment.getActiveProfiles();
to get the current profile and then create Docket
objects in your swagger configuration class based on the active profile.
Upvotes: 2