A demonstration project for implementing security features using Spring Boot. This repository showcases how to integrate Spring Security with a Java backend, including database authentication and web security configurations.
- Spring Boot 2.7.x based project structure
- Spring Security integration for authentication and authorization
- JPA support for database operations
- MySQL database connectivity (runtime)
- Lombok for boilerplate code reduction
- Maven Wrapper for easy project setup
- Ready for further extension and real-world use
- Java 11 or later
- Maven 3.6+
- MySQL server
git clone https://github.com/kaif77/spring-boot-security.git
cd spring-boot-securityUpdate your application.properties (typically placed in src/main/resources/) with your MySQL credentials and database information. For example:
spring.datasource.url=jdbc:mysql://localhost:3306/your_db
spring.datasource.username=your_username
spring.datasource.password=your_password
spring.jpa.hibernate.ddl-auto=updateYou can use the included Maven Wrapper for a consistent build experience:
./mvnw clean installOr, if Maven is installed globally:
mvn clean install./mvnw spring-boot:runor
mvn spring-boot:runThe application will start on http://localhost:8080.
JUnit 5 and Spring Boot Test are included for writing and running tests.
./mvnw testsrc/main/java/com/kaif/SpringBootSecurity/- Main application source codesrc/test/java/com/kaif/SpringBootSecurity/- Test casespom.xml- Project dependencies and build configuration
Key dependencies (see pom.xml for details):
spring-boot-starter-webspring-boot-starter-securityspring-boot-starter-data-jpamysql-connector-jlombok- Testing:
spring-boot-starter-test,spring-security-test
- Extend or replace the default security configuration to match your application's requirements.
- Modify entity models and repositories as needed for your business logic.