Skip to content

My Learnings

kaushik ganguly edited this page Jul 9, 2020 · 1 revision

Injecting Bean in Spring Context programatically


//can be found in DefaultAccessControlService.java
this.applicationContext=new AnnotationConfigApplicationContext();
this.applicationContext.registerBean(AccessControlConfigConstants.ACCESS_CONTROL_CONFIG,Properties.class,()->this.getProperties(),bd->bd.setAutowireCandidate(true));
this.applicationContext.scan(AccessControlConfigConstants.BASE_PACKAGE_FOR_SCAN);
this.applicationContext.refresh();
this.applicationContext.start();
Clone this wiki locally