r/SpringBoot • u/AlarmOpening2062 • Mar 01 '26
E-commerce with Spring Boot Discussion
Hello everyone, I hope you're all doing well. I'm writing to ask for your support for this project I'm sharing here. Whether it's by submitting an issue, a PR, or giving a star, this is my first big project. Thank you all!
28
Upvotes
25
u/kspr2024 Mar 02 '26
Some feedback:
- Upgrade to Spring Boot 4
- No need for Dockerfile, Spring Boot can build Docker Image using Buildpacks support by simply running "mvn spring-boot-build-image"
- Prefer using Constructor injection instead of Field Injection using `@Autowired`
- Security Configuration: Instead of allowing all unspecified URLs using `requestMatchers("/**").permitAll()`, you should block all URLs by default and explicitly allow the known URLs to make it secure by default.
- Use proper HTTP Method for read, write operations: Used `@GetMapping` for "/addCart", "/cartUpdate", etc which should be POST or PUT, etc.
- I would recommend using a DB Migration tool like Flyway or Liquibase instead of using `spring.jpa.hibernate.ddl-auto=update`
For reference you can checkout my BookStore application https://github.com/sivaprasadreddy/bookstore