Spring Boot Thymeleaf Hello World

Spring Boot Thymeleaf Hello World Directory Structure pom.xml file Modify auto created POM file. We need to add parent in pom to make it a spring boot application. After that add spring-boot-starter-thymeleaf dependency and java version. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion>   <groupId>codesjava</groupId> <artifactId>SpringBoot04</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging>   <name>SpringBoot04</name> <url>http://maven.apache.org</url>   <properties> <java.version>1.8</java.version> </properties>   … Read more

spring boot change context path

Spring boot change context path Default context path in spring boot application is “/”. We can change it by overriding the default port in the application.properties file. server.contextPath=/w3schoolsserver.contextPath=/w3schools

Spring boot change default tomcat port

Default HTTP port in spring boot application is 8080. We can change it by overriding the default port in the application.properties file. server.port=7001server.port=7001

spring boot + Spring MVC + Maven + JSP example

Spring boot jsp example Directory Structure pom.xml file Modify auto created POM file. We need to add parent in pom to make it a spring boot application. After that add spring-boot-starter-web dependency and java version. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion>   <groupId>codesjava</groupId> <artifactId>SpringBoot02</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging>   <name>SpringBoot02</name> <url>http://maven.apache.org</url>   <properties> <java.version>1.8</java.version> </properties>   <parent> … Read more

Spring boot hello world

Spring boot hello world example Directory Structure pom.xml file Modify auto created POM file. We need to add parent in pom to make it a spring boot application. After that add spring-boot-starter-web dependency and java version. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion>   <groupId>codesjava</groupId> <artifactId>SpringBoot01</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging>   <name>SpringBoot01</name> <url>http://maven.apache.org</url>   <properties> <java.version>1.8</java.version> </properties>   … Read more

Run spring boot application from command line

We can run spring boot application from command line by using below command on command line. java -jar springbootapp.jar We can also pass properties as arguments like port number. java -jar springbootapp.jar \ –server.port=8080 \ –site.name=w3schools.com