More information about the project setup will help with more accurate suggestions.
There can be multiple way to achieve.
Assuming you have following
- Library has mentioned xml files
- We want the code not the configurations
As @Araf mentioned, we can request the team to update the library and change the configuration
- Restructure the code to provide Autoconfigurations files this way consumer of library can choose to load the configurations through autoload or not
- Define your own xml files to load so that it will not load library configurations
One way to achieve AutoConfiguration mechanism mentioned at https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.developing-auto-configuration
or as it is your own project you can try multi module project https://www.baeldung.com/spring-boot-multiple-modules
Choosing which package to load or exclude, we can use @ComponentScan
https://www.baeldung.com/spring-component-scanning.
XML version of annotations should be available, I personally prefer the annotations as it will use code as configurations.