Hello,
Is it also right practice with CUBA to use the @Bean
annotation for managed beans? Particularly I am using it to create a singleton bean from an environment variable I read from app.properties
. Something like:
@Component(MyConfiguration.NAME)
public class MyConfiguration {
...
@Bean
public Credentials owner() {
String privateKey = getOwnerPrivateKey();
Credentials owner = Credentials.create(privateKey);
return owner;
}
...
public String getOwnerPrivateKey() {
return AppContext.getProperty("owner.privateKey");
}
}
Thank you.