title: How should I use @Configurable to automatically assemble beans into common objects in springboot
body: <p>What I need now is to have an ordinary abstract class and its subclasses. These beans need to be injected into the abstract class. They are just ordinary objects, but have some ioc-managed beans to perform operations. I need to serialize them into redis. Save it, and then take it out of redis to deserialize, but when taken out, these beans become null. I originally wanted to manually inject them one by one, but they may have nesting problems. I can’t do that. It is very troublesome to configure beans without recursively, so I looked for a lot of solutions, I found the <code>@Configurable</code> annotation, but when I want to use it, there is no complete document, very difficult, need to configure <code>aspectJ</code>, <code>LTW</code>, <code>aspectj-maven -plugin</code>, you also need to use <code>-javaagent:/path/to/spring-instrument.jar</code> when restarting, I am completely confused, I don’t know how to use it, it’s too much trouble, and I can’t find a complete one available The <code>@Configurable</code> use case, I don't want to use <code>-javaagent:/path/to/spring-instrument.jar</code> at all, I found many articles similar to these, and even mentioned <code>bytebuddy</code>. But they are not comprehensive and can’t be used, which makes me a headache</p>
  <ul>
  <li><a href="https://blog.csdn.net/crazypandariy/article/details/108172434#comments_15058136" rel="nofollow noreferrer">https://blog.csdn.net/crazypandariy/article/details/108172434#comments_15058136</a></li>
  <li><a href="https://stackoverflow.com/questions/35833052/spring-boot-configurable">Spring boot @Configurable</a></li>
  <li><a href="https://stackoverflow.com/questions/3471835/how-to-reattach-singleton-spring-beans-upon-deserialization#">how to reattach singleton Spring beans upon deserialization</a></li>
  </ul>
  <p>I want to use it like this</p>
  <pre class="lang-java prettyprint-override"><code>@Data
  @NoArgsConstructor
  @Slf4j
  @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS)
  @JsonSubTypes(
          value = {
              @JsonSubTypes.Type(value = SinglePipeLink.class),
              @JsonSubTypes.Type(value = SequencePipeLink.class),
              @JsonSubTypes.Type(value = SplitFlowPipeLink.class),
              @JsonSubTypes.Type(LoopPipeLink.class)
          })
  @Accessors(chain = true)
  @Configurable(autowire = Autowire.BY_NAME, preConstruction = true)
  public abstract class BasePipeLink implements Serializable {
      private static final long serialVersionUID = -5308571029549664750L;
      protected String copyFrom;
  
      @Resource @JsonIgnore protected transient RedisService redisService;
  }
  </code></pre>