I wonder when environment method is being taken into account.
Considering following code:
bean { Bar(ref()) } // requires bean of type Foo
environment(
    { !activeProfiles.contains("local") },
    { ProdFoo() }))
environment(
    { activeProfiles.contains("local") },
    { bean<LocalFoo>() })
Sometimes I observed errors related with no bean of type Foo. Does it mean that environment is not evaluated as one of the first expressions?
 
                        
The answer is plain simple - I've forgot to wrap
ProdFoo()intobean{ ... }