Skip to content

Introduce Environment.matchesProfiles() for profile expressions #30206

Closed
@garretwilson

Description

@garretwilson

I noticed that you've deprecated Environment.acceptsProfiles(String... profiles) in favor of a method that takes a Profile instance.

I can guess at the motivations behind this, but you might not have considered that this will cause problems in environments where it's easier to work with strings. (After all, profiles start out identified by strings.) For example, in Thymeleaf I might want to only include something if the active profile is production, as explained on Stack Overflow:

<div th:if="${#arrays.contains(@environment.getActiveProfiles(),'production')}">
     This is the production profile
</div>

If you eventually remove Environment.acceptsProfiles(String... profiles), this sort of thing will become more difficult.

Can you suggest an alternative in Thymeleaf?

Otherwise, you might want to reconsider deprecating this method.

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: backportedAn issue that has been backported to maintenance branchestype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions