Spring - adding a bean in code

less than 1 minute read

1
2
3
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    Set<int> sets = new Set<int>();
    ctx.getBeanFactory().registerSingleton("test", set);