Member-only story
Top 10 Mind-Blowing Spring Boot Tricks for Beginners
Spring Boot is powerful, flexible, and developer-friendly β but did you know it has hidden tricks that can make your development experience even better? π― Here are 10+ mind-blowing Spring Boot tricks that will boost your productivity and take your applications to the next level! β‘
1. Enable DevTools for Auto Restart π
Tired of manually restarting your app after every code change?
π₯ Trick:
Add this to pom.xml
:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
π€― Why?
- Automatically restarts the app when a file is changed!
- No need to stop and restart manually.
2. Override Default Properties Without Changing application.properties
π§
Need to quickly change a property without modifying the config file?
π₯ Trick:
java -jar myapp.jar --server.port=9090
or
mvn spring-boot:run -Dspring-boot.run.arguments="--server.port=9090"
π€― Why?
- Temporary override without modifying files.
- Useful for testing different configurations quickly.
3. Use the Spring Boot Banner for Custom Messages π¨
Make your Spring Boot startup screen more awesome!
π₯ Trick:
Create a banner.txt
file in src/main/resources/
and add:
βββββββββββββββ βββββββββββββββ βββ
ββββββββββββββββββββββββββββββββ βββ
βββββββββββββββββββββββββββββββββ βββ
βββββββββββββββ βββββββββββββββββββββ
βββββββββββ ββββββββββββββ ββββββ
βββββββββββ ββββββββββββββ βββββ
or use ASCII generators like this.
π€― Why?
- Makes your Spring Boot startup unique and fun!
- Great for branding your app.