title: Using @Configurable domain object properties to assign a specific behaviour based on data
body: <p>I have a domain object which looks like this.
  i need to use the data fetched from the database ("type" in this example) to fetch and inject the correct type of service.</p>
  
  <p>I get this output which means that the DB data are not set during the call :</p>
  
  <pre><code>entity is a bean postconstruct: PocProduct [id=null, type=null, productName=null].. attching behavior!
  </code></pre>
  
  <p>I get the same resilt when I try with the initializing Bean.
  What is the correct way to configure this?</p>
  
  <pre><code>@Entity
  @Table(name = "AAA_POC_PROD")
  @Configurable(dependencyCheck = true)
  @Scope("prototype")
  public class PocProduct implements Serializable, InitializingBean {
      /**
       *
       */
      private static final long serialVersionUID = 1136936011238094989L;
  
      @Id
      private String id;
      private String type;
      private String productName;
  
      @Transient
      private Behaviour behaviour;
  
      @Transient
      @Autowired
      private BehaviourFactory behaviourFactory;
      //getters and setters
  
      @PostConstruct
      public void attachBehavior() {
          System.out.println("entity is a bean postconstruct: " + this + ".. attching behavior!");
          //Need to call this : depends on type which is fetched from DB
         // this.behaviour = behaviourFactory.getTypeBasedBehaviour(type);
      }
  
  
  }
  </code></pre>