且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Spring Autowire停止为Tomcat类路径上的类工作

更新时间:2023-01-11 11:06:26

由于类型不兼容(例如,在多个类加载器中加载的类),自动装配可能会失败.

Autowiring can fail due to incompatible types (e.g. classes loaded in multiple classloaders).

由于您已经将JAR放置在tomcat的启动类路径中,因此web应用程序也必须可见该JAR,而不必将JAR放置在WEB-INF/lib中.

Since you already place the JAR in tomcat's boot classpath, it must be visible to the webapp as well without you having to place the JAR in WEB-INF/lib.

您可以将依赖项范围provided设置为不让Maven放置在WEB-INF/lib中.

You can make the dependency scope provided to not have Maven place it in WEB-INF/lib.