Gradle templates 的使用

 

使用gradle 时有一些繁琐的创建工程 使用插件的步骤。 这些步骤可以使用一些gradle的模板来代替。

具体的操作步骤:

安装gradle:

Prerequired: Java SDK installed

1. Dowload Gradle from:  http://gradle.org/downloads
2. Set gradle home environment variable: GRADLE_HOME. Pointing to the place where the gradle binaries is
3. Add %GRADLE_HOME%\bin; to your PATH environment variable string
4. Run gradle -v command to test your installation and configuration is correct

 

 应用gradle的模板:

下载gradle模板,推荐使用 https://github.com/townsfolk/gradle-templates 下载zip文件即可,解压缩到路径(比如 D:\gradle-template)

找到 %userprofile%/.gradle/init.gradle文件(如果没有请参照http://gradle.org/docs/current/userguide/init_scripts.html 创建一个)

 文件内容:

gradle.beforeProject { prj ->
    prj.apply from: 'E:\\gradle\\gradle-templates\\installation\\apply.groovy'
}

cmd命令执行。 gradle tasks. 可以看到template中涉及到的命令都被加载了

 

转载于:https://www.cnblogs.com/ygshen/p/4321283.html

在Spring Boot中使用Thymeleaf是相对简单的,你只需要在你的项目中加入Thymeleaf的相关依赖即可。使用Thymeleaf步骤如下: 1. 在你的项目中添加Thymeleaf的依赖。可以通过Maven或者Gradle来添加依赖。例如,在Maven中,你可以在`pom.xml`文件中添加以下依赖: ```xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> ``` 2. 在你的Spring Boot应用的配置文件中,配置Thymeleaf的一些属性。你可以在`application.properties`文件中添加下面的配置: ``` spring.thymeleaf.prefix=classpath:/templates/ spring.thymeleaf.suffix=.html spring.thymeleaf.cache=false ``` 在这个例子中,我们设置了模板文件的前缀为`classpath:/templates/`,后缀为`.html`,并且将缓存关闭。 3. 创建Thymeleaf模板文件。在`src/main/resources/templates/`目录下创建你的HTML模板文件。在这些模板文件中,你可以使用Thymeleaf的标记来进行动态数据绑定和渲染。 4. 在你的Spring Boot应用中使用Thymeleaf。你可以在Controller的方法中返回一个字符串,该字符串指定了你要渲染的Thymeleaf模板文件的名称。Spring Boot会自动根据配置的前缀和后缀来查找并渲染对应的模板文件。 以上就是在Spring Boot中使用Thymeleaf的简单步骤。通过这些步骤,你可以在你的Spring Boot应用中使用Thymeleaf来进行视图的渲染和展示。希望对你有帮助!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值