Default value from A class in B


I have a class A and class B. A’s steps is in many to one relation to B. And I want to shown by default B’s “The first step” value in A’s steps. I guess I should do it in B class’s getStep() function, or in A’s setStep() ?
I do not know how to reach that specified value from B.
Could you help me, please?


If you want to init an A instance’s field of type B with a default value use a configuration interface ( and a method annotated with @PostConstruct in A (

@Source(type = SourceType.DATABASE)
public interface MyConfig extends Config {
    Service getDefaultB();

protected void init() {

Oh… I hoped there is an easier way. Could you attach a sample project?

I am sorry, I haven’t to time to do it. But all code you need is here.

Okay, then I have some questions.

  • Where to create the configuration interface? Into core or global?
  • How can I get A instance's field's id? I guess in your code it is:


And I do not know, how to know it?

  • The second part of your code is in A's class?