Is autoscan of Spring Configuration classes possible by ApplicationContext? -


i have multiple configuration configuration classes (@configuration) classes in application in multiple maven modules. use single instance of annotationconfigapplicationcontext register these configuration classes.

do have manually call , register classes shown below?

applicationcontext ac = new annotationconfigapplicationcontext(); ac.register(conf1); ac.register(conf2); 

...

or have way autoscan configuration classes? looking componentscan @ applicationcontext level.

there 2 ways can it. either scan using method on annotationconfigapplicationcontext example

applicationcontext ac = new annotationconfigapplicationcontext(); ac.scan("com.sample.service" , "com.sample.dao"); ac.refresh(); 

alternatively register @ least 1 @configuration class using register method in turn uses @componentscan include classes specific locations


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -