title: Creating Spring beans dynamically runtime using method
body: <p>I have to use company's custom made libraries with Spring Boot and wondering if I'm able to create bean like this in runtime and add it to Spring application context.</p>
  
  <pre><code>@Bean(name = {"customConnectionFactory"})   
  public ConnFactory connector() {
      return new SimpleConnFactory(configuration(), "prefix");
  }
  </code></pre>
  
  <p>So this worked fine when I was allowed to wire beans normally when starting the application. Now requirements have changed and I should be able to do this dynamically runtime. I've done some research and it seems that it's possible to add class to spring context runtime, but how about running method which returns new object?</p>