Aakash Kr
Aakash Kr

Reputation: 28

Enable/ Disable different sets of Controllers in based on mode specified at startup Spring MVC

While starting my Spring MVC war I need to specify the mode. Based on mode it should start different set of controllers. Is it possible to do the same by specifying mode/ applicable controllers while starting it?

A similar question Spring MVC web application - enabling / disabling controller from property only talks of test but I need to have various combinations and start all controllers as default.

Upvotes: 1

Views: 127

Answers (1)

Master Slave
Master Slave

Reputation: 28569

Spring in general has a profile mechanism that lets you register different beans in different environments

When you bootstrap it according to doc, distinguishing controllers is as simple as annotating them on a class level with e.g. @Profile("mode1") vs @Profile("mode2")

Upvotes: 3

Related Questions