我有一个应用程序,为此我可以指定要运行它的配置文件。 但我也希望将这些配置文件分组到credentails,应用程序性能,内存打印,应用程序行为等内容。我可以运行下面的曲线弹簧配置文件组
-Dspring.profiles.active=production,cached-local,db-connection-pooled...
但我宁愿初始化它作为
-Dspring.profiles.active=production,super-fast
#the above activates method level caches, db connection pooling etc
#super-fast triggered activation of cached-local, db-connection-pooled profiles
或
-Dspring.profiles.active=dev,low-footprint
#the above dosent enable caching, or db connection pooling
可以这样无需编写像 How to set active spring 3.1 environment profile via a properites file and not via an env variable or system property任何自定义代码来实现的。 我很好,即使我可以从属性文件或spring-xml配置中加载这些文件。 我在Spring 3.1上只使用xml配置。
你有没有得到这个地方?我试图想出一个解决方案来做类似的事情。 –
抱歉延误。不,我没有找到解决方案。让我知道你是否做过。 – user918953