Ausgabe
Ich muss unterschiedliche Logik basierend auf unterschiedlichen aktuellen Umgebungsprofilen codieren.
Wie können Sie die derzeit aktiven und Standardprofile von Spring abrufen?
Lösung
Sie können die automatisch verdrahtenEnvironment
@Autowired
Environment env;
Environment
bietet an:
String[] getActiveProfiles()
,String[] getDefaultProfiles()
, undboolean acceptsProfiles(String... profiles)
Beantwortet von – aweigold
Antwort geprüft von – Senaida (FixError Volunteer)