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