Class EnvironmentPostProcessor
-
- All Implemented Interfaces:
-
org.springframework.boot.env.EnvironmentPostProcessor,org.springframework.core.Ordered
public class EnvironmentPostProcessor implements EnvironmentPostProcessor, OrderedEnvironment post-processor that activates Spring profiles and sets properties used to bootstrap framework components based on Embabel Agent annotations.
This processor runs very early in the Spring Boot startup sequence and examines the application's main class for agent-related annotations. It then activates corresponding Spring profiles to enable platform-specific configurations.
- Logging Theme - From
@EnableAgents(loggingTheme="...")
Profiles are activated through two mechanisms:
- System property:
spring.profiles.active- for compatibility - Environment API:
environment.addActiveProfile()- for direct activation
- Runs with HIGHEST_PRECEDENCE to ensure early execution
- Preserves existing profiles if already set
- Handles multiple application sources (though typically there's only one)
- Uses both annotation utils for proper meta-annotation support
- Since:
1.0
Embabel Team
-
-
Field Summary
Fields Modifier and Type Field Description public final static StringLOGGING_THEME_PROPERTYpublic final static intHIGHEST_PRECEDENCEpublic final static intLOWEST_PRECEDENCE
-
Constructor Summary
Constructors Constructor Description EnvironmentPostProcessor()
-
Method Summary
Modifier and Type Method Description voidpostProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application)Post-processes the environment to activate profiles based on agent annotations. intgetOrder()Returns the order of this post-processor. -
-
Method Detail
-
postProcessEnvironment
void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application)
Post-processes the environment to activate profiles based on agent annotations.
- Parameters:
environment- the environment to post-processapplication- the Spring application
-
getOrder
int getOrder()
Returns the order of this post-processor.
- Returns:
HIGHEST_PRECEDENCE to ensure early execution
-
-
-
-