Log sql statements in spring boot

We can log sql statements in spring boot by using following properties in application.properties file. //It will shows sql statement in the logs logging.level.org.hibernate.SQL=debug //It will shows sql values in the logs logging.level.org.hibernate.type.descriptor.sql=trace

Spring boot with mysql database

Spring boot with mysql database example 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>w3schools</groupId> <artifactId>SpringBoot05</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging>   <name>SpringBoot05</name> <url>http://maven.apache.org</url>   <properties> <java.version>1.8</java.version> </properties>   <parent> … Read more

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