Spring cannot scan the jar package it packed.

want to do this
use @ Autowired to inject a map in the service layer
let Spring scan automatically, and use key to fetch the injected classes in map, which is equivalent to policy mode

.

the newly added module is annotated with @ Service ("key")

without maven
use the command line to add the newly added module

jar crf extra.jar com/xxx/xxx/* com/xxx/xxx/test.class

package it into a Jar package and throw it into the lib folder of the project in tomcat. Do you want Spring to scan
but not
because you want MANIFAST.mf to write those dependencies?
there is still a problem with the idea

Apr.13,2022

does not scan, and Spring scans packages under the root of the project (where the Application class resides) by default.
if you want to import an external class, you need to indicate it with @ Import or @ ComponentScan in the Application class (or any other @ component class).

Menu