在pom.xml文件中引入相關依賴包,例如bootstrap和jQuery:java
<dependencies> <dependency> <groupId>org.webjars</groupId> <artifactId>bootstrap</artifactId> <version>3.1.0</version> </dependency> <dependency> <groupId>org.webjars</groupId> <artifactId>jquery</artifactId> <version>3.3.1-1</version> </dependency> <dependency> <groupId>org.webjars</groupId> <artifactId>webjars-locator</artifactId> <version>0.30</version> </dependency> </dependencies>
@Override protected void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/webjars/**") .addResourceLocations("/webjars/") .resourceChain(false) .addResolver(new WebJarsResourceResolver()) .addResolver(new PathResourceResolver()); super.addResourceHandlers(registry); }
便可。jquery