There are some class in jar (external library), that uses Spring internally. So library class has structure like a:
This worked for me:
import org.springframework.beans.factory.FactoryBean;
...
@Configuration
public class TestConfig {
@Bean
public FactoryBean bean() {
TestBean bean = Library.createBean();
return new FactoryBean()
{
@Override
public TestBean getObject() throws Exception
{
return bean;
}
@Override
public Class> getObjectType()
{
return TestBean.class;
}
@Override
public boolean isSingleton()
{
return true;
}
};
}
}