Code Monkey home page Code Monkey logo

thelab_thymeleaf's Introduction

SpringBoot and Thymeleaf basic setup:
1. Maven project with dependencies
2. Developer Tools:
This spring-boot-devtools helps to disable the caches
and enable hot swapping so that developers will always see the last changes. Good for development. Read this โ€“ Spring Boot โ€“ Developer tools Try to modify the Thymeleaf templates or properties files, refresh the browser
to see the changes take effect immediately.
<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-devtools</artifactId>
	<optional>true</optional>
</dependency>
3. Controller
4. Main app: @SpringBootApplication
5. Thymeleaf + Static files
https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-spring-mvc-static-content
5.1 For Thymeleaf template files, put in src/main/resources/templates/
src/main/resources/templates/welcome.html
5.2 Spring Boot common application properties
src/main/resources/application.properties

welcome.message: xxxxxxx

spring.thymeleaf.cache=false
5.3 For Static files like CSS or JS, put in src/main/resources/static/
src/main/resources/static/css/main.css
6. Unit Test

MockMvc to test the Spring MVC controller.

7. Demo
URL = http://localhost:8080
URL = http://localhost:8080/hello?name=abc

8. Create an executable JAR

For deployment, just normal Maven package to create an executable JAR file.

$ mvn clean package

$ java -jar target\web-thymeleaf-1.0.jar


thelab_thymeleaf's People

Contributors

jorgedirkx avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.