Css Spring和Gradle-添加到项目WebJars引导

Css Spring和Gradle-添加到项目WebJars引导,css,spring,twitter-bootstrap,thymeleaf,Css,Spring,Twitter Bootstrap,Thymeleaf,我想在我的服务中使用webjars引导。 我添加了依赖项 compile group: 'org.webjars', name: 'bootstrap', version: '4.0.0-alpha.6-1' 我注册来源 registry .addResourceHandler("/webjars/**") .addResourceLocations("/webjars/"); 我在thymeleaf中使用引导css <l

我想在我的服务中使用webjars引导。 我添加了依赖项

compile group: 'org.webjars', name: 'bootstrap', version: '4.0.0-alpha.6-1'
我注册来源

        registry
            .addResourceHandler("/webjars/**")
            .addResourceLocations("/webjars/");
我在thymeleaf中使用引导css

<link rel="stylesheet" th:href="@{webjars/bootstrap/4.0.0-alpha.6-1/css/bootstrap.min.css}">


而引导根本不起作用。没有物品。此服务如何看不到引导css文件?例如,我在项目中使用Spring Security。会有什么影响吗?它值得费心去修理吗?webjars文件与“资源”文件夹中的此类普通css文件之间的速度是多少?

您可以添加
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示例:


完整教程如下:

您可以添加
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示例:


完整教程如下:

要将引导添加为webjar,请在build.gradle中添加以下内容:

dependencies {
    ...
    compile 'org.webjars:bootstrap:4.1.3'
}
并将其附加到html模板:

<body>
<script src="/webjars/bootstrap/4.1.3/js"></script>
...
</body>

...

要将引导添加为webjar,请在build.gradle中添加以下内容:

dependencies {
    ...
    compile 'org.webjars:bootstrap:4.1.3'
}
并将其附加到html模板:

<body>
<script src="/webjars/bootstrap/4.1.3/js"></script>
...
</body>

...

问题是关于Gradle,而不是Maven(在提供的链接中)。问题是关于Gradle,而不是Maven(在提供的链接中)。