Based on this post, I run my Spring Boot application with
./gradlew bootRun -Dspring-boot.run.profiles=foo
A component with the profile doesn't run. And I try to verify the active profile with the following code in the root Application class
  @Autowired
  private Environment environment;
  @PostConstruct
  void postConstruct(){
    String[] activeProfiles = environment.getActiveProfiles();
    log.info("active profiles: {}", 
    Arrays.toString(activeProfiles));
  }
The log message output is blank.
What is missing?
 
    