Arul,
@ExternalValue methods are not registered as beans, so they will not be resolved by trying to reference them with @ExternalBean.
I understand what you're trying to do here, but it's not supported. Feel free to add a request in JIRA so we can keep tabs on this.
In the meantime, one option would be to use a base class approach:
Code:
@Configuration
@EnvironmentVariableSource
public class BaseConfig {
protected @ExternalValue("database_type") String databaseType;
}
@Configuration
public class ConcreteConfig extends BaseConfig {
public @Bean Foo beanThatNeedsDatabaseType() {
return new Foo(this.databaseType);
}
}