Configure java heap size when starting a Spring Boot application with embedded tomcat

Configure java heap size when starting a Spring Boot application with embedded tomcat

Using Java CMD while running the project

java -Xmx<size> -Xms<size> -jar app.jar|war
#example:
java -Xmx8g -Xms1024m -jar app.jar

Using maven

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
        <jvmArguments>-Xmx64m</jvmArguments>
    </configuration>
</plugin>