我想在我的服务中使用webjars引导。我添加了依赖项
compile group: 'org.webjars', name: 'bootstrap', version: '4.0.0-alpha.6-1'I注册来源
registry
.addResourceHandler("/webjars/**")
.addResourceLocations("/webjars/");I在胸腺叶中使用引导css
<link rel="stylesheet" th:href="@{webjars/bootstrap/4.0.0-alpha.6-1/css/bootstrap.min.css}">而且bootstrap根本不起作用。没有项目。这个服务怎么看不到引导css文件呢?例如,在我使用的项目中,Spring Security。它会有什么效果吗?而且值得费心去修复它吗?webjars文件和'resource‘文件夹中这样一个普通的css文件之间的速度是多少?
发布于 2018-08-09 17:24:00
要将Bootstrap添加为webjar,请在build.gradle中添加以下内容:
dependencies {
...
compile 'org.webjars:bootstrap:4.1.3'
}并将其附加到html模板:
<body>
<script src="/webjars/bootstrap/4.1.3/js"></script>
...
</body>发布于 2017-05-06 23:10:13
您可以像下面这样添加bootstrap.min.css文件:
<link href="http://cdn.jsdelivr.net/webjars/bootstrap/3.3.4/css/bootstrap.min.css"
th:href="@{/webjars/bootstrap/3.3.4/css/bootstrap.min.css}"
rel="stylesheet" media="screen" />此链接中提供了一个github示例:https://github.com/springframeworkguru/springbootwebapp
完整教程在这里: https://springframework.guru/spring-boot-web-application-part-2-using-thymeleaf/
https://stackoverflow.com/questions/43821396
复制相似问题