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

How to check data type in C++? -

javascript - Is getTimezoneOffset() stable during daylight saving transition? -

sql server - SQL Query returns one result, does not return 0 or NULL result -