A Spring Boot application for managing an online bookstore with OAuth2 Google authentication.
- Java 11 or higher
- MongoDB
- Maven
Make sure MongoDB is running on localhost:27017
To enable Google login, you need to:
- Go to Google Cloud Console
- Create OAuth 2.0 credentials
- Create a file
src/main/resources/application-local.propertieswith:
spring.security.oauth2.client.registration.google.client-id=YOUR_GOOGLE_CLIENT_ID
spring.security.oauth2.client.registration.google.client-secret=YOUR_GOOGLE_CLIENT_SECRETNote: Never commit application-local.properties to version control as it contains sensitive information.
./mvnw spring-boot:runOr on Windows:
.\mvnw spring-boot:runThe application will be available at http://localhost:8080
- User authentication (login/register)
- Google OAuth2 login
- Book management
- Shopping cart
- Order management
- Checkout process
src/main/java/khang/demo/bookstore/- Main application codecontrollers/- Web and REST controllersentities/- Domain modelsrepositories/- Data access layerservices/- Business logicsecurity/- Security configuration
src/main/resources/templates/- Thymeleaf templatessrc/main/resources/static/- Static resources (CSS, JS, images)
This application uses Spring Security with:
- Form-based authentication
- OAuth2 Google login
- Password encryption
- Role-based access control