├── .gitignore ├── Actuator-Demo ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── howtodoinjava │ │ │ └── app │ │ │ ├── SpringBootDemoApplication.java │ │ │ └── config │ │ │ └── CustomInfoContributor.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── howtodoinjava │ └── AppTest.java ├── Application-Properties ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── howtodoinjava │ │ │ └── demo │ │ │ ├── App.java │ │ │ ├── AppProperties.java │ │ │ ├── DatasourceProps.java │ │ │ └── UserRole.java │ └── resources │ │ ├── application.properties │ │ └── datasource.properties │ └── test │ ├── java │ └── com │ │ └── howtodoinjava │ │ └── demo │ │ └── AppTest.java │ └── resources │ └── application-test.properties ├── JUnit4-Tests ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── howtodoinjava │ │ └── demo │ │ └── App.java │ └── test │ └── java │ └── com │ └── howtodoinjava │ └── demo │ └── powermock │ └── PowerMockTests.java ├── Profiles ├── .gitignore ├── README.md ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── howtodoinjava │ │ └── demo │ │ ├── App.java │ │ ├── config │ │ └── JpaConfig.java │ │ └── runner │ │ └── CustomCommandLineRunner.java │ └── resources │ ├── application-dev.properties │ ├── application-local.properties │ ├── application-prod.properties │ └── application.properties ├── README.md ├── Retry-example ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── howtodoinjava │ │ │ └── app │ │ │ ├── BackendAdapter.java │ │ │ ├── BackendAdapterImpl.java │ │ │ ├── RemoteServiceNotAvailableException.java │ │ │ ├── ResourceController.java │ │ │ ├── SpringRetryApplication.java │ │ │ └── config │ │ │ └── RetryConfig.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── howtodoinjava │ └── app │ └── SpringRetryApplicationTests.java ├── Spring-Boot-Filters ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── howtodoinjava │ │ └── app │ │ ├── App.java │ │ ├── config │ │ ├── AppConfig.java │ │ ├── AuditFilter.java │ │ ├── LoggingFilter.java │ │ └── SecurityFilter.java │ │ └── web │ │ └── WebController.java │ └── test │ └── java │ └── com │ └── howtodoinjava │ └── app │ └── AppTest.java ├── Spring-Validation ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── howtodoinjava │ │ │ └── demo │ │ │ ├── App.java │ │ │ ├── api │ │ │ └── UserController.java │ │ │ ├── entity │ │ │ └── User.java │ │ │ └── validation │ │ │ ├── DoesNotContainValidator.java │ │ │ └── annotation │ │ │ └── DoesNotContain.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── howtodoinjava │ └── demo │ └── customValidation │ └── DoesNotContainValidatorTest.java ├── Testing-Libraries ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── howtodoinjava │ │ └── demo │ │ └── App.java │ └── test │ ├── java │ └── com │ │ └── howtodoinjava │ │ └── demo │ │ ├── easymock │ │ ├── EasyMockTests.java │ │ ├── EasyMockTestsWithAnnotations.java │ │ ├── EasyMockTestsWithAnnotationsJUnit5.java │ │ └── EasyMockTestsWithEasyMockSupport.java │ │ ├── jmockit │ │ └── JMockitDemoTests.java │ │ ├── junit5 │ │ └── HelloTest.java │ │ ├── mockito │ │ ├── MockStaticMethods.java │ │ └── MockitoHelloTest.java │ │ ├── mockwerbserver │ │ └── MockWebServerTests.java │ │ ├── systemUnderTest │ │ ├── NotificationService.java │ │ ├── Record.java │ │ ├── RecordDao.java │ │ ├── RecordService.java │ │ └── SequenceGenerator.java │ │ ├── testng │ │ ├── FactoryWithDataProviderTest.java │ │ ├── HelloTestNg.java │ │ ├── IgnoreTests.java │ │ ├── ParameterTest.java │ │ ├── README.md │ │ ├── SimpleTest.java │ │ ├── SimpleTestFactory.java │ │ ├── TestDataProvider.java │ │ ├── TestNgExpectedException.java │ │ ├── TestNgLifeCycle.java │ │ └── TestTimeout.java │ │ └── wiremock │ │ ├── WireMockAdvanceUsageTest.java │ │ ├── WireMockServerTest.java │ │ └── WireMockTestAnnotationTest.java │ └── resources │ ├── hello_testng_suite.xml │ └── suiteWithParameters.xml ├── application-events ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── howtodoinjava │ │ │ └── demo │ │ │ ├── App.java │ │ │ ├── dao │ │ │ └── EmployeeRepository.java │ │ │ ├── events │ │ │ └── employeeMgmt │ │ │ │ ├── AddEmployeeEvent.java │ │ │ │ └── DeleteEmployeeEvent.java │ │ │ ├── exception │ │ │ └── ApplicationException.java │ │ │ ├── listners │ │ │ ├── DeleteEmployeeEventListener.java │ │ │ └── EmployeeEventsListener.java │ │ │ ├── model │ │ │ └── Employee.java │ │ │ └── service │ │ │ └── EmployeeService.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── howtodoinjava │ └── demo │ └── AppTest.java ├── caching ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── howtodoinjava │ │ │ └── app │ │ │ ├── App.java │ │ │ ├── config │ │ │ └── CacheConfig.java │ │ │ ├── dao │ │ │ └── EmployeeRepository.java │ │ │ ├── model │ │ │ └── Employee.java │ │ │ └── service │ │ │ └── EmployeeService.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── howtodoinjava │ └── app │ └── AppTest.java ├── chatgpt-demo ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── howtodoinjava │ │ │ └── demo │ │ │ ├── ChatGptApplication.java │ │ │ ├── config │ │ │ └── ChatGptConfig.java │ │ │ ├── controller │ │ │ └── BotController.java │ │ │ ├── interceptor │ │ │ └── RequestResponseLoggingInterceptor.java │ │ │ └── model │ │ │ ├── BotRequest.java │ │ │ ├── BotResponse.java │ │ │ └── Message.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── howtodoinjava │ └── demo │ └── ChatGptApplicationTest.java ├── multiple-dataSources ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── howtodoinjava │ │ │ └── app │ │ │ ├── App.java │ │ │ ├── config │ │ │ ├── OrderDatasourceConfiguration.java │ │ │ └── UserDatasourceConfiguration.java │ │ │ ├── model │ │ │ ├── order │ │ │ │ └── Order.java │ │ │ └── user │ │ │ │ └── User.java │ │ │ └── repositories │ │ │ ├── order │ │ │ └── OrderRepository.java │ │ │ └── user │ │ │ └── UserRepository.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── howtodoinjava │ └── app │ └── AppTest.java ├── podman-deployment ├── Dockerfile ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── howtodoinjava │ │ │ └── demo │ │ │ ├── DemoApplication.java │ │ │ ├── exception │ │ │ └── RecordNotFoundException.java │ │ │ ├── model │ │ │ └── EmployeeEntity.java │ │ │ ├── repository │ │ │ └── EmployeeRepository.java │ │ │ ├── service │ │ │ └── EmployeeService.java │ │ │ └── web │ │ │ └── EmployeeMvcController.java │ └── resources │ │ ├── application.properties │ │ └── templates │ │ ├── add-edit-employee.html │ │ └── list-employees.html │ └── test │ └── java │ └── com │ └── howtodoinjava │ └── demo │ └── DemoApplicationTest.java ├── pom.xml ├── rest-api-timeout ├── README.md ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── howtodoinjava │ │ └── demo │ │ ├── App.java │ │ └── web │ │ ├── controller │ │ └── ItemController.java │ │ ├── model │ │ └── Item.java │ │ ├── service │ │ └── ItemService.java │ │ └── util │ │ └── TimeoutUtils.java │ └── resources │ └── application.properties ├── search-in-keycloak-with-spring-boot ├── .gitignore ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── searchinkeycloakwithspringboot │ │ │ ├── SearchInKeycloakWithSpringBootApplication.java │ │ │ ├── config │ │ │ └── Config.java │ │ │ ├── exception │ │ │ ├── UserNotFoundInKeycloakException.java │ │ │ └── handler │ │ │ │ └── ExceptionController.java │ │ │ ├── service │ │ │ └── KeycloakService.java │ │ │ └── web │ │ │ └── SearchController.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── example │ └── searchinkeycloakwithspringboot │ └── SearchInKeycloakWithSpringBootApplicationTests.java ├── social-connect-spring-boot-starter ├── .gitignore ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── howtodoinjava │ │ │ └── app │ │ │ ├── SocialConnectStarterSpringBootApplication.java │ │ │ ├── config │ │ │ ├── SocialConnectAutoConfiguration.java │ │ │ ├── SocialConnectProperties.java │ │ │ └── SocialConnection.java │ │ │ └── service │ │ │ ├── SocialConnectService.java │ │ │ └── SocialConnectServiceImpl.java │ └── resources │ │ ├── META-INF │ │ ├── spring.factories │ │ └── spring.provides │ │ └── application.properties │ └── test │ └── java │ └── com │ └── howtodoinjava │ └── app │ └── SocialConnectStarterSpringBootApplicationTest.java ├── spring-angular-application-example ├── SpringBootApplication │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── boot │ │ │ │ └── rest │ │ │ │ └── base │ │ │ │ ├── Application.java │ │ │ │ ├── controller │ │ │ │ └── UserController.java │ │ │ │ ├── model │ │ │ │ └── User.java │ │ │ │ ├── repository │ │ │ │ └── UserRepository.java │ │ │ │ └── service │ │ │ │ ├── UserService.java │ │ │ │ └── UserServiceImpl.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── boot │ │ └── rest │ │ └── base │ │ └── ApplicationTests.java └── angular-app │ ├── .browserslistrc │ ├── .editorconfig │ ├── .gitignore │ ├── README.md │ ├── angular.json │ ├── karma.conf.js │ ├── package-lock.json │ ├── package.json │ ├── src │ ├── app │ │ ├── app-routing.module.ts │ │ ├── app.component.css │ │ ├── app.component.html │ │ ├── app.component.spec.ts │ │ ├── app.component.ts │ │ ├── app.module.ts │ │ ├── services │ │ │ ├── user.service.spec.ts │ │ │ └── user.service.ts │ │ ├── user-create │ │ │ ├── user-create.component.css │ │ │ ├── user-create.component.html │ │ │ ├── user-create.component.spec.ts │ │ │ └── user-create.component.ts │ │ ├── user-list │ │ │ ├── user-list.component.css │ │ │ ├── user-list.component.html │ │ │ ├── user-list.component.spec.ts │ │ │ └── user-list.component.ts │ │ ├── user-update │ │ │ ├── user-update.component.css │ │ │ ├── user-update.component.html │ │ │ ├── user-update.component.spec.ts │ │ │ └── user-update.component.ts │ │ ├── user.model.spec.ts │ │ └── user.model.ts │ ├── assets │ │ └── .gitkeep │ ├── environments │ │ ├── environment.prod.ts │ │ └── environment.ts │ ├── favicon.ico │ ├── index.html │ ├── main.ts │ ├── polyfills.ts │ ├── styles.css │ └── test.ts │ ├── tsconfig.app.json │ ├── tsconfig.json │ └── tsconfig.spec.json ├── spring-aws-dynamodb-example ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── HELP.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── howtodoinjava │ │ │ └── demo │ │ │ ├── App.java │ │ │ ├── config │ │ │ └── DynamoDBConfiguration.java │ │ │ ├── controller │ │ │ └── MovieController.java │ │ │ ├── entity │ │ │ └── MovieDetails.java │ │ │ └── service │ │ │ └── DynamoDbOperationService.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── howtodoinjava │ └── demo │ └── AppTests.java ├── spring-batch-excel ├── data.xlsx ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── howtodoinjava │ │ │ └── demo │ │ │ ├── SpringBatchApplication.java │ │ │ ├── config │ │ │ ├── BatchJobLauncherScheduler.java │ │ │ ├── DatabasePersonWriter.java │ │ │ ├── ExcelToDatabaseJobConfiguration.java │ │ │ ├── LoggingPersonProcessor.java │ │ │ ├── LoggingPersonWriter.java │ │ │ ├── PersonListenerSupport.java │ │ │ └── PersonRowMapper.java │ │ │ └── model │ │ │ ├── Person.java │ │ │ └── PersonRepository.java │ └── resources │ │ ├── application.properties │ │ └── data.xlsx │ └── test │ └── java │ └── com │ └── howtodoinjava │ └── demo │ └── SpringBatchApplicationTest.java ├── spring-boot-batch ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── howtodoinjava │ │ │ └── demo │ │ │ └── batch │ │ │ ├── jobs │ │ │ └── csvToDb │ │ │ │ ├── BatchProcessingApplication.java │ │ │ │ ├── config │ │ │ │ └── BatchConfig.java │ │ │ │ ├── job │ │ │ │ └── CsvToDatabaseJob.java │ │ │ │ ├── listener │ │ │ │ ├── JobCompletionNotificationListener.java │ │ │ │ ├── PersonItemProcessListener.java │ │ │ │ ├── PersonItemReadListener.java │ │ │ │ └── PersonItemWriteListener.java │ │ │ │ ├── model │ │ │ │ └── Person.java │ │ │ │ ├── processor │ │ │ │ └── PersonItemProcessor.java │ │ │ │ └── tasklets │ │ │ │ └── DeleteInputCsvTasklet.java │ │ │ └── quartz │ │ │ ├── BatchJobByQuartzApplication.java │ │ │ ├── config │ │ │ ├── BatchConfig.java │ │ │ ├── DataSourceConfig.java │ │ │ └── QuartzConfig.java │ │ │ ├── quartzJobs │ │ │ └── CustomQuartzJob.java │ │ │ └── tasklets │ │ │ └── CustomTasklet.java │ └── resources │ │ ├── application.properties │ │ ├── csv │ │ ├── inputData-copy.csv │ │ └── inputData.csv │ │ └── sql │ │ └── batch-schema.sql │ └── test │ └── java │ └── com │ └── howtodoinjava │ └── demo │ └── AppTest.java ├── spring-boot-docker-compose ├── README.md ├── docker-compose.yaml ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── howtodoinjava │ │ │ └── demo │ │ │ ├── App.java │ │ │ └── dao │ │ │ ├── ItemRepository.java │ │ │ └── model │ │ │ └── Item.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── howtodoinjava │ └── demo │ ├── AppTest.java │ ├── ServiceConnectionBeanTest.java │ └── ServiceConnectionFieldTest.java ├── spring-boot-docker-minikube ├── Dockerfile ├── README.md ├── deployment.yaml ├── pom.xml ├── services.yaml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── howtodoinjava │ │ │ └── app │ │ │ └── App.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── howtodoinjava │ └── app │ └── AppTest.java ├── spring-boot-file-upload-restapi ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── howtodoinjava │ │ └── demo │ │ ├── SpringBootWebApplication.java │ │ ├── config │ │ └── AsyncConfig.java │ │ ├── controllers │ │ ├── FileAsyncUploadController.java │ │ ├── FileMultipleUploadController.java │ │ └── FileUploadController.java │ │ ├── exceptions │ │ └── CustomExceptionHandler.java │ │ └── model │ │ └── FileForm.java │ └── resources │ ├── application.properties │ └── templates │ └── home.html ├── spring-boot-load-initial-data ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── howtodoinjava │ │ │ └── demo │ │ │ ├── App.java │ │ │ ├── entity │ │ │ └── Item.java │ │ │ └── repository │ │ │ └── ItemRepository.java │ └── resources │ │ └── application.properties │ └── test │ ├── java │ └── com │ │ └── howtodoinjava │ │ └── demo │ │ ├── AppTest.java │ │ ├── TestSqlAnnotation.java │ │ └── config │ │ └── TestDataSourceConfig.java │ └── resources │ ├── application-test.properties │ ├── com │ └── howtodoinjava │ │ └── demo │ │ └── AppTest.testMethodNameScript.sql │ ├── data.sql │ ├── import.sql │ ├── schema.sql │ └── sql │ ├── data.sql │ ├── items-books.sql │ ├── items-grocery.sql │ └── schema.sql ├── spring-boot-long-running-tasks ├── docker-compose.yaml ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── howtodoinjava │ │ │ └── demo │ │ │ ├── LongRunningTaskApplication.java │ │ │ ├── jms │ │ │ ├── config │ │ │ │ └── KafkaConfig.java │ │ │ └── service │ │ │ │ ├── KafKaTopicListeners.java │ │ │ │ ├── KafkaConsumerService.java │ │ │ │ └── KafkaProducerService.java │ │ │ └── web │ │ │ ├── config │ │ │ └── AsyncConfiguration.java │ │ │ ├── controller │ │ │ └── TaskController.java │ │ │ ├── model │ │ │ ├── TaskRequest.java │ │ │ ├── TaskResponse.java │ │ │ └── TaskStatus.java │ │ │ └── service │ │ │ └── TaskService.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── howtodoinjava │ └── demo │ └── LongRunningTaskApplicationTest.java ├── spring-boot-mongodb-crud ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── howtodoinjava │ │ │ └── app │ │ │ ├── App.java │ │ │ ├── config │ │ │ └── MongoConfig.java │ │ │ ├── model │ │ │ └── Item.java │ │ │ ├── repositories │ │ │ └── ItemRepository.java │ │ │ └── service │ │ │ ├── MongoRepositoryService.java │ │ │ ├── MongoTemplateService.java │ │ │ └── impl │ │ │ ├── MongoRepositoryServiceImpl.java │ │ │ └── MongoTemplateServiceImpl.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── howtodoinjava │ └── app │ ├── AppTest.java │ └── service │ └── impl │ ├── MongoRepositoryServiceImplTest.java │ └── MongoTemplateServiceImplTest.java ├── spring-boot-mvc-thymeleaf ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── howtodoinjava │ │ │ └── demo │ │ │ ├── App.java │ │ │ ├── config │ │ │ └── WebMvcConfig.java │ │ │ ├── dao │ │ │ ├── ItemRepository.java │ │ │ └── model │ │ │ │ └── Item.java │ │ │ └── web │ │ │ └── ItemController.java │ └── resources │ │ ├── application.properties │ │ └── templates │ │ ├── index.html │ │ └── items.html │ └── test │ └── java │ └── com │ └── howtodoinjava │ └── demo │ └── AppTest.java ├── spring-boot-resilience4j ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── howtodoinjava │ │ │ └── resilience4j │ │ │ ├── Resilience4jApplication.java │ │ │ ├── controller │ │ │ └── StudentController.java │ │ │ └── dto │ │ │ └── Student.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── howtodoinjava │ └── resilience4j │ └── Resilience4jApplicationTests.java ├── spring-boot-response-entity-demo ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── howtodoinjava │ │ └── demo │ │ ├── SpringBootWebApplication.java │ │ ├── controllers │ │ ├── StudentControllerWithBuilders.java │ │ └── StudentControllerWithConstructors.java │ │ ├── entity │ │ └── Student.java │ │ ├── exception │ │ └── ResourceNotFoundException.java │ │ ├── repository │ │ └── StudentRepository.java │ │ └── service │ │ ├── StudentService.java │ │ └── StudentServiceImpl.java │ └── resources │ └── application.properties ├── spring-boot-template-engines-demo ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── howtodoinjava │ │ └── demo │ │ ├── SpringBootWebApplication.java │ │ └── controllers │ │ └── HomeController.java │ ├── resources │ ├── application.properties │ └── templates │ │ ├── freemarker.ftlh │ │ ├── home.mustache │ │ ├── index.tpl │ │ └── thymeleaf.html │ └── webapp │ └── WEB-INF │ └── views │ └── test.jsp ├── spring-boot-vaadin-demo ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ └── java │ │ ├── com │ │ └── howtodoinjava │ │ │ └── demo │ │ │ ├── CrudWithVaadinApplication.java │ │ │ ├── dao │ │ │ └── PersonRepository.java │ │ │ ├── model │ │ │ └── Person.java │ │ │ └── ui │ │ │ └── MainView.java │ │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── howtodoinjava │ └── demo │ └── AppTest.java ├── spring-boot-validate-list ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── howtodoinjava │ │ └── app │ │ ├── ValidateListsApplication.java │ │ ├── exception │ │ └── GlobalExceptionHandler.java │ │ ├── model │ │ ├── Car.java │ │ ├── EmailAddress.java │ │ ├── EmailRequest.java │ │ └── User.java │ │ ├── validator │ │ ├── EmailAddressForCustomValidator.java │ │ ├── EmailValidator.java │ │ └── constraints │ │ │ └── ValidEmail.java │ │ └── web │ │ ├── CarController.java │ │ ├── EmailController.java │ │ └── UserLogginController.java │ └── resources │ └── application.properties ├── spring-boot-vuejs-jwt-auth ├── README.md ├── Spring-Boot-API │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── howtodoinjava │ │ │ └── app │ │ │ ├── EmployeeRestApiApplication.java │ │ │ ├── entity │ │ │ └── Employee.java │ │ │ ├── repository │ │ │ └── EmployeeRepository.java │ │ │ ├── security │ │ │ ├── config │ │ │ │ └── SecurityConfig.java │ │ │ ├── dto │ │ │ │ ├── AuthenticationRequest.java │ │ │ │ └── AuthenticationResponse.java │ │ │ ├── entity │ │ │ │ ├── Role.java │ │ │ │ └── User.java │ │ │ ├── filter │ │ │ │ └── JwtTokenFilter.java │ │ │ ├── repo │ │ │ │ └── UserRepository.java │ │ │ ├── service │ │ │ │ └── CustomUserDetailsService.java │ │ │ └── utils │ │ │ │ ├── JwtAuthenticationEntryPoint.java │ │ │ │ └── JwtTokenProvider.java │ │ │ ├── service │ │ │ └── EmployeeService.java │ │ │ └── web │ │ │ ├── AuthController.java │ │ │ └── EmployeeController.java │ │ └── resources │ │ └── application.properties └── vue-app │ ├── .browserslistrc │ ├── .eslintrc.js │ ├── .gitignore │ ├── README.md │ ├── babel.config.js │ ├── jest.config.js │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── favicon.ico │ └── index.html │ ├── src │ ├── App.vue │ ├── assets │ │ └── lofi2.jpeg │ ├── components │ │ ├── EmployeeCard.vue │ │ ├── FooterPage.vue │ │ └── NavBar.vue │ ├── main.ts │ ├── router │ │ └── index.ts │ ├── services │ │ ├── AuthService.ts │ │ └── employeeService.ts │ ├── shims-vue.d.ts │ ├── store │ │ └── index.ts │ ├── types │ │ └── Employee.ts │ ├── utils │ │ └── apiClient.ts │ └── views │ │ ├── AboutView.vue │ │ ├── AddEmployeeView.vue │ │ ├── EditEmployeeView.vue │ │ ├── HomeView.vue │ │ ├── LoginView.vue │ │ └── ShowDetailsView.vue │ ├── tests │ └── unit │ │ └── example.spec.ts │ ├── tsconfig.json │ └── vue.config.js ├── spring-boot-vuejs ├── README.md ├── Spring-Boot-API │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── howtodoinjava │ │ │ │ └── app │ │ │ │ ├── EmployeeRestApiApplication.java │ │ │ │ ├── entity │ │ │ │ └── Employee.java │ │ │ │ ├── repository │ │ │ │ └── EmployeeRepository.java │ │ │ │ ├── service │ │ │ │ └── EmployeeService.java │ │ │ │ └── web │ │ │ │ └── EmployeeController.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── howtodoinjava │ │ └── app │ │ └── EmployeeRestApiApplicationTests.java └── vue-app │ ├── .browserslistrc │ ├── .eslintrc.js │ ├── .gitignore │ ├── README.md │ ├── babel.config.js │ ├── jest.config.js │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── favicon.ico │ └── index.html │ ├── src │ ├── App.vue │ ├── assets │ │ └── lofi2.jpeg │ ├── components │ │ ├── EmployeeCard.vue │ │ ├── FooterPage.vue │ │ └── NavBar.vue │ ├── main.ts │ ├── router │ │ └── index.ts │ ├── services │ │ └── employeeService.ts │ ├── shims-vue.d.ts │ ├── store │ │ └── index.ts │ ├── types │ │ └── Employee.ts │ ├── utils │ │ └── apiClient.ts │ └── views │ │ ├── AboutView.vue │ │ ├── AddEmployeeView.vue │ │ ├── EditEmployeeView.vue │ │ ├── HomeView.vue │ │ └── ShowDetailsView.vue │ ├── tests │ └── unit │ │ └── example.spec.ts │ ├── tsconfig.json │ └── vue.config.js ├── spring-boot-xml-request-response ├── README.md ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── howtodoinjava │ │ └── demo │ │ ├── App.java │ │ ├── model │ │ ├── Item.java │ │ ├── Items.java │ │ └── Record.java │ │ └── web │ │ └── ItemController.java │ └── test │ └── java │ └── com │ └── howtodoinjava │ └── demo │ └── AppTest.java ├── spring-data-dynamodb ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── howtodoinjava │ │ └── demo │ │ ├── App.java │ │ ├── config │ │ └── DynamoDbConfiguration.java │ │ ├── controller │ │ └── MovieController.java │ │ ├── model │ │ └── MovieDetail.java │ │ ├── repositories │ │ └── MovieDetailRepository.java │ │ └── service │ │ ├── MovieService.java │ │ └── impl │ │ └── MovieServiceImpl.java │ └── resources │ └── application.properties ├── spring-data-redis-lettuce ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── HELP.md ├── README.md ├── docker-compose.yml ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── howtodoinjava │ │ │ └── demo │ │ │ ├── SpringDataRedisLettuceApplication.java │ │ │ ├── config │ │ │ ├── ConnectionPoolProperties.java │ │ │ └── RedisConfig.java │ │ │ ├── service │ │ │ └── RedisCacheService.java │ │ │ └── util │ │ │ ├── CustomCacheErrorHandler.java │ │ │ └── CustomRedisSerializer.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── howtodoinjava │ └── demo │ └── SpringDataRedisLettuceApplicationTests.java ├── spring-deploy-docker-image-to-aws ├── Dockerfile ├── HELP.md ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── awsdockerdeploy │ │ │ ├── AwsDockerDeployApplication.java │ │ │ └── api │ │ │ └── HomeController.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── example │ └── awsdockerdeploy │ └── AwsDockerDeployApplicationTests.java ├── spring-elasticsearch-example ├── docker.txt ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── howtodoinjava │ │ │ └── demo │ │ │ └── elasticsearch │ │ │ ├── Main.java │ │ │ ├── config │ │ │ ├── ImperativeElasticsearchConfig.java │ │ │ └── ReactiveElasticsearchConfig.java │ │ │ ├── entities │ │ │ └── Employee.java │ │ │ ├── repository │ │ │ └── EmployeeRepository.java │ │ │ └── service │ │ │ ├── EmployeeOperationsService.java │ │ │ └── EmployeeRepositoryService.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── howtodoinjava │ └── demo │ └── elasticsearch │ └── service │ ├── EmployeeOperationsServiceTest.java │ └── EmployeeRepositoryServiceTest.java ├── spring-kafka-example ├── inventory-event-consumer │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── howtodoinjava │ │ │ │ └── demo │ │ │ │ └── kafka │ │ │ │ └── consumer │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── InventoryEventsConsumerConfig.java │ │ │ │ ├── consumer │ │ │ │ ├── InventoryEventsConsumer.java │ │ │ │ └── InventoryEventsConsumerManualOffset.java │ │ │ │ ├── model │ │ │ │ ├── InventoryEvent.java │ │ │ │ ├── InventoryEventType.java │ │ │ │ └── Product.java │ │ │ │ └── service │ │ │ │ └── InventoryEventService.java │ │ └── resources │ │ │ ├── application-dev.yml │ │ │ ├── application-prod.yml │ │ │ └── application.yml │ │ └── test │ │ └── java │ │ └── com │ │ └── howtodoinjava │ │ └── demo │ │ └── kafka │ │ └── consumer │ │ └── consumer │ │ └── InventoryEventsConsumerTest.java ├── inventory-event-producer │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── howtodoinjava │ │ │ │ └── demo │ │ │ │ └── kafka │ │ │ │ └── producer │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ ├── AutoCreateTopicConfig.java │ │ │ │ └── KafkaProducerConfig.java │ │ │ │ ├── controller │ │ │ │ └── InventoryEventController.java │ │ │ │ ├── model │ │ │ │ ├── InventoryEvent.java │ │ │ │ ├── InventoryEventType.java │ │ │ │ └── Product.java │ │ │ │ └── producer │ │ │ │ ├── InventoryEventProducer.java │ │ │ │ └── RoutingKafkaProducer.java │ │ └── resources │ │ │ ├── application-dev.yml │ │ │ ├── application-prod.yml │ │ │ └── application.yml │ │ └── test │ │ └── java │ │ └── com │ │ └── howtodoinjava │ │ └── demo │ │ └── kafka │ │ └── producer │ │ ├── producer │ │ └── InventoryEventProducerTest.java │ │ └── util │ │ └── TestUtil.java └── pom.xml ├── spring-kafka-streams-example ├── common-models │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── howtodoinjava │ │ └── demo │ │ └── kafka │ │ └── streams │ │ └── models │ │ ├── Order.java │ │ └── OrdersCountPerStoreDTO.java ├── docker-compose.yml ├── pom.xml └── stream-service │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── howtodoinjava │ │ │ └── demo │ │ │ └── kafka │ │ │ └── streams │ │ │ └── service │ │ │ ├── Main.java │ │ │ ├── config │ │ │ └── CustomStreamsConfig.java │ │ │ ├── controllers │ │ │ └── OrdersController.java │ │ │ ├── producer │ │ │ ├── OrdersMockDataProducer.java │ │ │ └── ProducerUtil.java │ │ │ ├── service │ │ │ └── OrderService.java │ │ │ └── topology │ │ │ └── OrdersTopology.java │ └── resources │ │ ├── application-local.yml │ │ └── application.yml │ └── test │ └── java │ └── com │ └── howtodoinjava │ └── demo │ └── kafka │ └── streams │ └── service │ └── topology │ ├── OrdersTopologyIntegrationTest.java │ └── OrdersTopologyTest.java ├── spring-mvc-angular-file-upload ├── angular-fileupload-frontend │ ├── .browserslistrc │ ├── .editorconfig │ ├── .gitignore │ ├── angular.json │ ├── karma.conf.js │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── app │ │ │ ├── app-routing.module.ts │ │ │ ├── app.component.css │ │ │ ├── app.component.html │ │ │ ├── app.component.spec.ts │ │ │ ├── app.component.ts │ │ │ ├── app.module.ts │ │ │ ├── file-details.model.spec.ts │ │ │ ├── file-details.model.ts │ │ │ ├── services │ │ │ │ ├── file-upload.service.spec.ts │ │ │ │ └── file-upload.service.ts │ │ │ └── upload-file │ │ │ │ ├── upload-file.component.css │ │ │ │ ├── upload-file.component.html │ │ │ │ ├── upload-file.component.spec.ts │ │ │ │ └── upload-file.component.ts │ │ ├── assets │ │ │ └── .gitkeep │ │ ├── environments │ │ │ ├── environment.prod.ts │ │ │ └── environment.ts │ │ ├── favicon.ico │ │ ├── index.html │ │ ├── main.ts │ │ ├── polyfills.ts │ │ ├── styles.css │ │ └── test.ts │ ├── tsconfig.app.json │ ├── tsconfig.json │ └── tsconfig.spec.json └── springboot-3-mvc-file-upload │ ├── .gitignore │ ├── pom.xml │ └── src │ └── main │ ├── java │ └── com │ │ └── howtodoinjava │ │ ├── App.java │ │ └── app │ │ ├── config │ │ └── WebFuxConfig.java │ │ └── web │ │ └── FileUploadController.java │ └── resources │ └── spring.png ├── spring-react-file-upload ├── SpringBootFileUploadApplication │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── boot │ │ │ └── rest │ │ │ └── base │ │ │ ├── Application.java │ │ │ ├── controller │ │ │ └── FileUploadController.java │ │ │ ├── exception │ │ │ └── FileNotSupportedException.java │ │ │ ├── model │ │ │ └── FileDetails.java │ │ │ ├── payload │ │ │ └── FileUploadResponse.java │ │ │ ├── repository │ │ │ └── FileDetailsRepository.java │ │ │ └── service │ │ │ ├── FileUploadSerivceImpl.java │ │ │ └── FileUploadService.java │ │ └── resources │ │ └── application.properties └── react-fileupload-frontend │ ├── .gitignore │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── favicon.ico │ ├── index.html │ ├── logo192.png │ ├── logo512.png │ ├── manifest.json │ └── robots.txt │ └── src │ ├── App.css │ ├── App.js │ ├── App.test.js │ ├── components │ ├── HeaderComponent.jsx │ ├── MyImagesComponent.jsx │ └── UploadImageComponent.jsx │ ├── hover.css │ ├── index.css │ ├── index.js │ ├── logo.svg │ ├── reportWebVitals.js │ ├── services │ └── FileService.js │ └── setupTests.js ├── spring-redis-pubsub ├── common-events-model │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── howtodoinjava │ │ └── demo │ │ └── model │ │ └── OrderEvent.java ├── order-events-publisher │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── howtodoinjava │ │ │ │ └── demo │ │ │ │ └── publisher │ │ │ │ ├── OrderEventsPublisherApplication.java │ │ │ │ ├── config │ │ │ │ └── RedisConfiguration.java │ │ │ │ ├── controller │ │ │ │ └── DemoController.java │ │ │ │ └── pubsub │ │ │ │ ├── config │ │ │ │ └── RedisConfiguration.java │ │ │ │ └── service │ │ │ │ ├── OrderService.java │ │ │ │ └── OrderServiceImpl.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── howtodoinjava │ │ └── demo │ │ └── publisher │ │ └── OrderEventPublisherApplicationTest.java ├── order-events-subscriber │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── howtodoinjava │ │ │ │ └── demo │ │ │ │ └── subscriber │ │ │ │ ├── Main.java │ │ │ │ └── pubsub │ │ │ │ ├── config │ │ │ │ ├── RedisConfiguration.java │ │ │ │ └── RedisSubscriberConfiguration.java │ │ │ │ └── subscriber │ │ │ │ └── OrderEventListener.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── howtodoinjava │ │ └── demo │ │ └── subscriber │ │ └── MainTest.java └── pom.xml ├── spring-redis-streams ├── README.md ├── common-event-model │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── howtodoinjava │ │ └── demo │ │ └── redis │ │ └── streams │ │ └── model │ │ └── PurchaseEvent.java ├── pom.xml ├── stream-event-consumer │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── howtodoinjava │ │ │ │ └── demo │ │ │ │ └── redis │ │ │ │ └── streams │ │ │ │ └── consumer │ │ │ │ ├── RedisStreamEventConsumer.java │ │ │ │ ├── config │ │ │ │ └── RedisStreamConfig.java │ │ │ │ └── service │ │ │ │ └── PurchaseStreamListener.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── howtodoinjava │ │ └── demo │ │ └── redis │ │ └── streams │ │ └── consumer │ │ └── RedisStreamEventConsumerTest.java └── stream-event-producer │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── howtodoinjava │ │ │ └── demo │ │ │ └── redis │ │ │ └── streams │ │ │ └── producer │ │ │ ├── RedisStreamEventProducer.java │ │ │ ├── controller │ │ │ └── DemoController.java │ │ │ └── service │ │ │ └── PurchaseStreamProducer.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── howtodoinjava │ └── demo │ └── redis │ └── streams │ └── producer │ └── RedisStreamEventProducerTest.java ├── spring-security-authentication-aws-cognito ├── AWSCognitoBasicAuthentication │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── oauth2 │ │ │ │ └── cognito │ │ │ │ └── demo │ │ │ │ └── base │ │ │ │ ├── AwsCognitoBasicAuthenticationApplication.java │ │ │ │ ├── config │ │ │ │ ├── CustomLogoutHandler.java │ │ │ │ ├── CustomizeAuthenticationSuccessHandler.java │ │ │ │ └── SecurityConfiguration.java │ │ │ │ └── controller │ │ │ │ └── WelcomeController.java │ │ └── resources │ │ │ ├── application.properties │ │ │ └── templates │ │ │ ├── greeting.html │ │ │ └── index.html │ │ └── test │ │ └── java │ │ └── com │ │ └── oauth2 │ │ └── cognito │ │ └── demo │ │ └── base │ │ └── AwsCognitoBasicAuthenticationApplicationTests.java └── AddUserToUserGroup │ ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ └── main │ └── java │ └── com │ └── howtodoinjava │ └── LambdaRequestHandler.java ├── spring_boot_elastic-beanstalk-aws ├── .elasticbeanstalk │ └── config.yml ├── .gitignore ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── howtodoinjava │ │ │ └── app │ │ │ ├── SpringBootElasticBeanstalkAwsApplication.java │ │ │ ├── entity │ │ │ └── Employee.java │ │ │ ├── repo │ │ │ └── EmployeeRepo.java │ │ │ ├── service │ │ │ └── EmployeeService.java │ │ │ └── web │ │ │ └── EmployeeController.java │ └── resources │ │ ├── application-dev.properties │ │ ├── application-prod.properties │ │ └── application.properties │ └── test │ └── java │ └── com │ └── howtodoinjava │ └── app │ └── SpringBootElasticBeanstalkAwsApplicationTests.java ├── springboot-graphql-main ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── howtodoinjava │ │ │ └── graphql │ │ │ ├── GraphqlApplication.java │ │ │ ├── controller │ │ │ └── BookController.java │ │ │ ├── dto │ │ │ ├── Author.java │ │ │ └── Book.java │ │ │ └── repository │ │ │ ├── BookRepository.java │ │ │ └── GraphQLBookRepository.java │ └── resources │ │ ├── application.properties │ │ └── graphql │ │ └── schema.graphqls │ └── test │ └── java │ └── com │ └── howtodoinjava │ └── graphql │ └── GraphqlApplicationTests.java └── thymeleaf-upload-display-images ├── .gitignore ├── pom.xml └── src └── main ├── java └── com │ └── howtodoinjava │ ├── Application.java │ ├── ServletInitializer.java │ ├── configuration │ └── SecurityConfiguration.java │ ├── controller │ └── ProfileController.java │ ├── exceptions │ └── HandleSizeLimitExceededException.java │ ├── model │ └── Profile.java │ ├── repository │ └── ProfileRepository.java │ └── service │ └── ProfileService.java └── resources ├── application.properties ├── static ├── images │ ├── email.svg │ ├── github.svg │ ├── link.svg │ ├── tick.svg │ └── twitter.svg └── private │ └── logo.png └── templates ├── addProfile.html ├── fragments ├── footer.html └── header.html └── view.html /Actuator-Demo/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | !**/src/main/**/target/ 4 | !**/src/test/**/target/ 5 | 6 | ### IntelliJ IDEA ### 7 | .idea/modules.xml 8 | .idea/jarRepositories.xml 9 | .idea/compiler.xml 10 | .idea/libraries/ 11 | *.iws 12 | *.iml 13 | *.ipr 14 | 15 | ### Eclipse ### 16 | .apt_generated 17 | .classpath 18 | .factorypath 19 | .project 20 | .settings 21 | .springBeans 22 | .sts4-cache 23 | 24 | ### NetBeans ### 25 | /nbproject/private/ 26 | /nbbuild/ 27 | /dist/ 28 | /nbdist/ 29 | /.nb-gradle/ 30 | build/ 31 | !**/src/main/**/build/ 32 | !**/src/test/**/build/ 33 | 34 | ### VS Code ### 35 | .vscode/ 36 | 37 | ### Mac OS ### 38 | .DS_Store -------------------------------------------------------------------------------- /Actuator-Demo/README.md: -------------------------------------------------------------------------------- 1 | # Related Tutorials 2 | 3 | * [Spring Boot Actuator ‘/Info’ Endpoint](https://howtodoinjava.com/spring-boot/info-endpoint-custom-info/) -------------------------------------------------------------------------------- /Actuator-Demo/src/main/java/com/howtodoinjava/app/SpringBootDemoApplication.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app; 2 | 3 | //@SpringBootApplication 4 | public class SpringBootDemoApplication { 5 | 6 | public static void main(String[] args) throws InterruptedException { 7 | //SpringApplication.run(SpringBootDemoApplication.class, args); 8 | 9 | Runnable runnable = new Runnable() { 10 | @lombok.SneakyThrows 11 | @Override 12 | public void run() { 13 | while (true) { 14 | Thread.sleep(1000); 15 | System.out.println(Thread.currentThread().getState()); 16 | } 17 | } 18 | }; 19 | 20 | Thread thread = new Thread(runnable); 21 | thread.start(); 22 | 23 | Thread.sleep(5000); 24 | } 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /Actuator-Demo/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | management.endpoints.web.exposure.include=info 2 | management.info.env.enabled=true 3 | management.info.build.enabled=true 4 | management.info.git.enabled=true 5 | management.info.java.enabled=true 6 | management.info.os.enabled=true 7 | info.application.name=Actuator info 8 | info.application.description=A demo Spring Project with information 9 | info.organization=How to do in Java 10 | info.java-version=${java.version} 11 | info.java-vendor=${java.vendor} 12 | 13 | -------------------------------------------------------------------------------- /Actuator-Demo/src/test/java/com/howtodoinjava/AppTest.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | public class AppTest { 6 | 7 | @Test 8 | void contextLoads() { 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /Application-Properties/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | !**/src/main/**/target/ 4 | !**/src/test/**/target/ 5 | 6 | ### IntelliJ IDEA ### 7 | .idea/modules.xml 8 | .idea/jarRepositories.xml 9 | .idea/compiler.xml 10 | .idea/libraries/ 11 | *.iws 12 | *.iml 13 | *.ipr 14 | 15 | ### Eclipse ### 16 | .apt_generated 17 | .classpath 18 | .factorypath 19 | .project 20 | .settings 21 | .springBeans 22 | .sts4-cache 23 | 24 | ### NetBeans ### 25 | /nbproject/private/ 26 | /nbbuild/ 27 | /dist/ 28 | /nbdist/ 29 | /.nb-gradle/ 30 | build/ 31 | !**/src/main/**/build/ 32 | !**/src/test/**/build/ 33 | 34 | ### VS Code ### 35 | .vscode/ 36 | 37 | ### Mac OS ### 38 | .DS_Store -------------------------------------------------------------------------------- /Application-Properties/README.md: -------------------------------------------------------------------------------- 1 | # Related Tutorials 2 | 3 | * [How to Configure Properties with Spring 4 | Boot](https://howtodoinjava.com/spring-boot/properties-with-spring-boot/) -------------------------------------------------------------------------------- /Application-Properties/src/main/java/com/howtodoinjava/demo/App.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class App { 8 | public static void main(String[] args) { 9 | 10 | String[] arr1 = new String[]{"token1"}; 11 | String[] arr2 = new String[]{"token1"}; 12 | 13 | arr1.equals(arr2); 14 | 15 | SpringApplication.run(App.class, args); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Application-Properties/src/main/java/com/howtodoinjava/demo/DatasourceProps.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.context.annotation.PropertySource; 6 | import org.springframework.stereotype.Component; 7 | 8 | @Data 9 | @Component 10 | @PropertySource("classpath:datasource.properties") 11 | @ConfigurationProperties(prefix = "spring.datasource") 12 | public class DatasourceProps { 13 | private String url; 14 | private String username; 15 | private String password; 16 | private String driverClassName; 17 | private String dialect; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /Application-Properties/src/main/java/com/howtodoinjava/demo/UserRole.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @AllArgsConstructor 9 | @NoArgsConstructor 10 | public class UserRole { 11 | private Integer type; 12 | private String desc; 13 | } 14 | -------------------------------------------------------------------------------- /Application-Properties/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | application.name=Demo App 2 | app.environments=local,dev,test,prod 3 | user.roles[0].type=1 4 | user.roles[0].desc=Subscriber 5 | user.roles[1].type=2 6 | user.roles[1].desc=Editor 7 | user.roles[2].type=3 8 | user.roles[2].desc=Admin -------------------------------------------------------------------------------- /Application-Properties/src/main/resources/datasource.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=jdbc:h2:file:C:/temp/test 2 | spring.datasource.username=sa 3 | spring.datasource.password= 4 | spring.datasource.driverClassName=org.h2.Driver 5 | spring.datasource.dialect=org.hibernate.dialect.H2Dialect -------------------------------------------------------------------------------- /Application-Properties/src/test/resources/application-test.properties: -------------------------------------------------------------------------------- 1 | application.name=Test App -------------------------------------------------------------------------------- /JUnit4-Tests/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | !**/src/main/**/target/ 4 | !**/src/test/**/target/ 5 | 6 | ### IntelliJ IDEA ### 7 | .idea/modules.xml 8 | .idea/jarRepositories.xml 9 | .idea/compiler.xml 10 | .idea/libraries/ 11 | *.iws 12 | *.iml 13 | *.ipr 14 | 15 | ### Eclipse ### 16 | .apt_generated 17 | .classpath 18 | .factorypath 19 | .project 20 | .settings 21 | .springBeans 22 | .sts4-cache 23 | 24 | ### NetBeans ### 25 | /nbproject/private/ 26 | /nbbuild/ 27 | /dist/ 28 | /nbdist/ 29 | /.nb-gradle/ 30 | build/ 31 | !**/src/main/**/build/ 32 | !**/src/test/**/build/ 33 | 34 | ### VS Code ### 35 | .vscode/ 36 | 37 | ### Mac OS ### 38 | .DS_Store -------------------------------------------------------------------------------- /JUnit4-Tests/README.md: -------------------------------------------------------------------------------- 1 | # Related Tutorials 2 | 3 | * [Using PowerMock with JUnit and Mockito](https://howtodoinjava.com/java/library/mock-testing-using-powermock-with-junit-and-mockito/) -------------------------------------------------------------------------------- /JUnit4-Tests/src/main/java/com/howtodoinjava/demo/App.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class App 8 | { 9 | public static void main( String[] args ) 10 | { 11 | SpringApplication.run(App.class, args); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Profiles/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | !**/src/main/**/target/ 4 | !**/src/test/**/target/ 5 | 6 | ### IntelliJ IDEA ### 7 | .idea/modules.xml 8 | .idea/jarRepositories.xml 9 | .idea/compiler.xml 10 | .idea/libraries/ 11 | *.iws 12 | *.iml 13 | *.ipr 14 | 15 | ### Eclipse ### 16 | .apt_generated 17 | .classpath 18 | .factorypath 19 | .project 20 | .settings 21 | .springBeans 22 | .sts4-cache 23 | 24 | ### NetBeans ### 25 | /nbproject/private/ 26 | /nbbuild/ 27 | /dist/ 28 | /nbdist/ 29 | /.nb-gradle/ 30 | build/ 31 | !**/src/main/**/build/ 32 | !**/src/test/**/build/ 33 | 34 | ### VS Code ### 35 | .vscode/ 36 | 37 | ### Mac OS ### 38 | .DS_Store -------------------------------------------------------------------------------- /Profiles/README.md: -------------------------------------------------------------------------------- 1 | # Related Tutorials 2 | 3 | * [Spring Boot Profiles](https://howtodoinjava.com/spring-boot/spring-profiles/) -------------------------------------------------------------------------------- /Profiles/src/main/java/com/howtodoinjava/demo/App.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class App { 8 | public static void main(String[] args) { 9 | SpringApplication.run(App.class, args); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Profiles/src/main/java/com/howtodoinjava/demo/runner/CustomCommandLineRunner.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.runner; 2 | 3 | import lombok.extern.java.Log; 4 | import org.springframework.beans.factory.annotation.Value; 5 | import org.springframework.boot.CommandLineRunner; 6 | import org.springframework.stereotype.Component; 7 | 8 | @Component 9 | @Log 10 | public class CustomCommandLineRunner implements CommandLineRunner { 11 | 12 | @Value("${application.thread.pool.size:10}") 13 | private int threadPoolSize; 14 | 15 | @Override 16 | public void run(String... args) throws Exception { 17 | log.info("Thread pool size is : " + threadPoolSize); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Profiles/src/main/resources/application-dev.properties: -------------------------------------------------------------------------------- 1 | application.thread.pool.size=100 -------------------------------------------------------------------------------- /Profiles/src/main/resources/application-local.properties: -------------------------------------------------------------------------------- 1 | application.thread.pool.size=10 -------------------------------------------------------------------------------- /Profiles/src/main/resources/application-prod.properties: -------------------------------------------------------------------------------- 1 | application.thread.pool.size=1000 -------------------------------------------------------------------------------- /Profiles/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.profiles.active=local 2 | application.thread.pool.size=1 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Spring-Boot-Examples 2 | -------------------------------------------------------------------------------- /Retry-example/README.md: -------------------------------------------------------------------------------- 1 | # Related Tutorials 2 | 3 | 1. [Spring Boot Retry Example](https://howtodoinjava.com/spring-boot2/spring-retry-module/) -------------------------------------------------------------------------------- /Retry-example/src/main/java/com/howtodoinjava/app/BackendAdapter.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app; 2 | 3 | import org.springframework.retry.annotation.Backoff; 4 | import org.springframework.retry.annotation.Recover; 5 | import org.springframework.retry.annotation.Retryable; 6 | 7 | public interface BackendAdapter { 8 | 9 | @Retryable(retryFor = {RemoteServiceNotAvailableException.class}, 10 | maxAttempts = 3, 11 | backoff = @Backoff(delay = 1000)) 12 | public String getBackendResponse(String param1, String param2); 13 | 14 | @Recover 15 | public String getBackendResponseFallback(RemoteServiceNotAvailableException e, String param1, String param2); 16 | } 17 | -------------------------------------------------------------------------------- /Retry-example/src/main/java/com/howtodoinjava/app/RemoteServiceNotAvailableException.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app; 2 | 3 | public class RemoteServiceNotAvailableException extends RuntimeException { 4 | 5 | private static final long serialVersionUID = 1L; 6 | 7 | public RemoteServiceNotAvailableException(String msg) { 8 | super(msg); 9 | } 10 | 11 | public RemoteServiceNotAvailableException(String msg, Exception ex) { 12 | super(msg, ex); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Retry-example/src/main/java/com/howtodoinjava/app/SpringRetryApplication.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringRetryApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringRetryApplication.class, args); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Retry-example/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | logging.level.org.springframework=TRACE 2 | retry.maxAttempts=2 3 | retry.maxDelay=100 -------------------------------------------------------------------------------- /Retry-example/src/test/java/com/howtodoinjava/app/SpringRetryApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | public class SpringRetryApplicationTests { 8 | 9 | @Test 10 | public void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Spring-Boot-Filters/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | !**/src/main/**/target/ 4 | !**/src/test/**/target/ 5 | 6 | ### IntelliJ IDEA ### 7 | .idea/modules.xml 8 | .idea/jarRepositories.xml 9 | .idea/compiler.xml 10 | .idea/libraries/ 11 | *.iws 12 | *.iml 13 | *.ipr 14 | 15 | ### Eclipse ### 16 | .apt_generated 17 | .classpath 18 | .factorypath 19 | .project 20 | .settings 21 | .springBeans 22 | .sts4-cache 23 | 24 | ### NetBeans ### 25 | /nbproject/private/ 26 | /nbbuild/ 27 | /dist/ 28 | /nbdist/ 29 | /.nb-gradle/ 30 | build/ 31 | !**/src/main/**/build/ 32 | !**/src/test/**/build/ 33 | 34 | ### VS Code ### 35 | .vscode/ 36 | 37 | ### Mac OS ### 38 | .DS_Store -------------------------------------------------------------------------------- /Spring-Boot-Filters/README.md: -------------------------------------------------------------------------------- 1 | # Related Tutorials 2 | 3 | 1. [Guide to Spring Boot Filter](https://howtodoinjava.com/spring-boot/spring-filter-examples/) -------------------------------------------------------------------------------- /Spring-Boot-Filters/src/main/java/com/howtodoinjava/app/App.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.web.servlet.ServletComponentScan; 6 | 7 | @SpringBootApplication 8 | @ServletComponentScan 9 | public class App { 10 | public static void main(String[] args) { 11 | SpringApplication.run(App.class, args); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Spring-Boot-Filters/src/main/java/com/howtodoinjava/app/config/AppConfig.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app.config; 2 | 3 | import org.springframework.boot.web.servlet.FilterRegistrationBean; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | @Configuration 8 | public class AppConfig { 9 | @Bean 10 | public FilterRegistrationBean filterRegistrationBean() { 11 | FilterRegistrationBean registrationBean = 12 | new FilterRegistrationBean(); 13 | 14 | registrationBean.setFilter(new SecurityFilter()); 15 | registrationBean.addUrlPatterns("/admin/*"); 16 | registrationBean.setOrder(2); 17 | return registrationBean; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Spring-Boot-Filters/src/main/java/com/howtodoinjava/app/web/WebController.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app.web; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | 7 | @RestController 8 | @RequestMapping("/") 9 | public class WebController { 10 | @GetMapping 11 | public String getRootMessage() { 12 | return "Hello World!"; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Spring-Boot-Filters/src/test/java/com/howtodoinjava/app/AppTest.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | class AppTests { 6 | 7 | @Test 8 | void contextLoads() { 9 | } 10 | 11 | } -------------------------------------------------------------------------------- /Spring-Validation/README.md: -------------------------------------------------------------------------------- 1 | # Related Tutorials 2 | 3 | 1. [Spring MVC Custom Validation Annotation](https://howtodoinjava.com/spring-mvc/spring-custom-constraint-annotation/) -------------------------------------------------------------------------------- /Spring-Validation/src/main/java/com/howtodoinjava/demo/App.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class App { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(App.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Spring-Validation/src/main/java/com/howtodoinjava/demo/entity/User.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.entity; 2 | 3 | import com.howtodoinjava.demo.validation.annotation.DoesNotContain; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Getter; 6 | import lombok.NoArgsConstructor; 7 | import lombok.Setter; 8 | 9 | @AllArgsConstructor 10 | @Getter 11 | @Setter 12 | @NoArgsConstructor 13 | public class User { 14 | 15 | @DoesNotContain(chars = {"#", "%", "@"}) 16 | private String username; 17 | private String email; 18 | private String password; 19 | } 20 | -------------------------------------------------------------------------------- /Spring-Validation/src/main/java/com/howtodoinjava/demo/validation/annotation/DoesNotContain.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.validation.annotation; 2 | 3 | 4 | import com.howtodoinjava.demo.validation.DoesNotContainValidator; 5 | import jakarta.validation.Constraint; 6 | import jakarta.validation.Payload; 7 | 8 | import java.lang.annotation.*; 9 | 10 | @Target({ElementType.FIELD, ElementType.PARAMETER}) 11 | @Retention(RetentionPolicy.RUNTIME) 12 | @Documented 13 | @Constraint(validatedBy = DoesNotContainValidator.class) 14 | public @interface DoesNotContain { 15 | 16 | String message() default "The field contains invalid characters"; 17 | 18 | Class[] groups() default {}; 19 | 20 | Class[] payload() default {}; 21 | 22 | String[] chars(); 23 | } 24 | -------------------------------------------------------------------------------- /Spring-Validation/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Testing-Libraries/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | !**/src/main/**/target/ 4 | !**/src/test/**/target/ 5 | 6 | ### IntelliJ IDEA ### 7 | .idea/modules.xml 8 | .idea/jarRepositories.xml 9 | .idea/compiler.xml 10 | .idea/libraries/ 11 | *.iws 12 | *.iml 13 | *.ipr 14 | 15 | ### Eclipse ### 16 | .apt_generated 17 | .classpath 18 | .factorypath 19 | .project 20 | .settings 21 | .springBeans 22 | .sts4-cache 23 | 24 | ### NetBeans ### 25 | /nbproject/private/ 26 | /nbbuild/ 27 | /dist/ 28 | /nbdist/ 29 | /.nb-gradle/ 30 | build/ 31 | !**/src/main/**/build/ 32 | !**/src/test/**/build/ 33 | 34 | ### VS Code ### 35 | .vscode/ 36 | 37 | ### Mac OS ### 38 | .DS_Store -------------------------------------------------------------------------------- /Testing-Libraries/README.md: -------------------------------------------------------------------------------- 1 | # Java Mocking Tutorials 2 | 3 | * [Integration Testing with Mock APIs using WireMock](https://howtodoinjava.com/java/library/mock-rest-api-with-wiremock/) 4 | * [Mocking REST APIs with MockWebServer and JUnit](https://howtodoinjava.com/java/library/mockwebserver-junit-webclient/) 5 | * [Getting Started with EasyMock and JUnit](https://howtodoinjava.com/java/library/easymock-tutorial/) 6 | * [Guide to Mocking with JMockit](https://howtodoinjava.com/java/library/jmockit-tutorial/) 7 | 8 | ## Mockito Tutorials 9 | 10 | * [Getting Started With Mockito](https://howtodoinjava.com/mockito/junit-mockito-example/) -------------------------------------------------------------------------------- /Testing-Libraries/src/main/java/com/howtodoinjava/demo/App.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo; 2 | 3 | /** 4 | * Hello world! 5 | * 6 | */ 7 | public class App 8 | { 9 | public static void main( String[] args ) 10 | { 11 | System.out.println( "Hello World!" ); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Testing-Libraries/src/test/java/com/howtodoinjava/demo/systemUnderTest/NotificationService.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.systemUnderTest; 2 | 3 | import lombok.extern.java.Log; 4 | 5 | @Log 6 | public class NotificationService { 7 | 8 | private static final NotificationService instance = new NotificationService(); 9 | 10 | public static NotificationService getInstance() { 11 | return instance; 12 | } 13 | 14 | public static boolean sendNotification(String message) { 15 | log.info("Sending notification : " + message); 16 | return true; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Testing-Libraries/src/test/java/com/howtodoinjava/demo/systemUnderTest/Record.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.systemUnderTest; 2 | 3 | import lombok.Data; 4 | import lombok.NoArgsConstructor; 5 | 6 | @Data 7 | @NoArgsConstructor 8 | public class Record { 9 | public Record(String name) { 10 | this.name = name; 11 | } 12 | 13 | private long id; 14 | private String name; 15 | } 16 | -------------------------------------------------------------------------------- /Testing-Libraries/src/test/java/com/howtodoinjava/demo/systemUnderTest/RecordDao.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.systemUnderTest; 2 | 3 | import lombok.extern.java.Log; 4 | 5 | @Log 6 | public class RecordDao { 7 | 8 | public Record saveRecord(Record record) { 9 | log.info("Saving Record in RecordDao"); 10 | return record; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Testing-Libraries/src/test/java/com/howtodoinjava/demo/systemUnderTest/RecordService.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.systemUnderTest; 2 | 3 | import lombok.extern.java.Log; 4 | 5 | @Log 6 | public class RecordService { 7 | private final RecordDao dao; 8 | private final SequenceGenerator generator; 9 | 10 | public RecordService(SequenceGenerator generator, RecordDao dao) { 11 | this.generator = generator; 12 | this.dao = dao; 13 | } 14 | 15 | public Record saveRecord(Record record) { 16 | 17 | log.info("Saving Record in RecordService"); 18 | record.setId(generator.getNext()); 19 | dao.saveRecord(record); 20 | 21 | NotificationService.getInstance().sendNotification("New Record Added"); 22 | return record; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Testing-Libraries/src/test/java/com/howtodoinjava/demo/systemUnderTest/SequenceGenerator.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.systemUnderTest; 2 | 3 | import lombok.extern.java.Log; 4 | 5 | @Log 6 | public class SequenceGenerator { 7 | private long value = 1; 8 | 9 | public long getNext() { 10 | log.info("Get Next Id in SequenceGenerator"); 11 | return value++; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Testing-Libraries/src/test/java/com/howtodoinjava/demo/testng/HelloTestNg.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.testng; 2 | 3 | import org.testng.annotations.Test; 4 | import java.util.stream.LongStream; 5 | import static org.testng.Assert.assertEquals; 6 | 7 | public class HelloTestNg { 8 | @Test 9 | public void testAddOperation_withValidArgs_thenCorrect() { 10 | assertEquals(6, Calculator.add(1,2,3)); 11 | } 12 | } 13 | 14 | class Calculator { 15 | public static long add(long... nums){ 16 | return LongStream.of(nums).sum(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Testing-Libraries/src/test/java/com/howtodoinjava/demo/testng/IgnoreTests.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.testng; 2 | 3 | import org.testng.annotations.Test; 4 | 5 | @Test(enabled = false) 6 | public class IgnoreTests { 7 | @Test 8 | public void testCase() { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Testing-Libraries/src/test/java/com/howtodoinjava/demo/testng/SimpleTest.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.testng; 2 | 3 | import org.testng.annotations.Test; 4 | 5 | public class SimpleTest { 6 | private int param; 7 | 8 | public SimpleTest(int param) { 9 | this.param = param; 10 | } 11 | 12 | @Test 13 | public void testMethodOne() { 14 | int opValue = param + 1; 15 | System.out.println("Test method one output: " + opValue); 16 | } 17 | 18 | @Test 19 | public void testMethodTwo() { 20 | int opValue = param + 2; 21 | System.out.println("Test method two output: " + opValue); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Testing-Libraries/src/test/java/com/howtodoinjava/demo/testng/SimpleTestFactory.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.testng; 2 | 3 | import org.testng.annotations.Factory; 4 | 5 | public class SimpleTestFactory { 6 | @Factory 7 | public Object[] factoryMethod() { 8 | return new Object[]{new SimpleTest(0), new SimpleTest(1)}; 9 | } 10 | } -------------------------------------------------------------------------------- /Testing-Libraries/src/test/java/com/howtodoinjava/demo/testng/TestTimeout.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.testng; 2 | 3 | import org.testng.annotations.Test; 4 | 5 | @Test(timeOut = 500) 6 | public class TestTimeout { 7 | @Test 8 | public void timeTestOne() throws InterruptedException { //Fails 9 | Thread.sleep(1000); 10 | System.out.println("Time test method one"); 11 | } 12 | 13 | @Test 14 | public void timeTestTwo() throws InterruptedException { 15 | Thread.sleep(400); 16 | System.out.println("Time test method two"); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Testing-Libraries/src/test/resources/hello_testng_suite.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /application-events/src/main/java/com/howtodoinjava/demo/dao/EmployeeRepository.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.dao; 2 | 3 | 4 | import com.howtodoinjava.demo.model.Employee; 5 | import org.springframework.data.repository.ListCrudRepository; 6 | import org.springframework.stereotype.Repository; 7 | 8 | @Repository 9 | public interface EmployeeRepository extends ListCrudRepository { 10 | } 11 | -------------------------------------------------------------------------------- /application-events/src/main/java/com/howtodoinjava/demo/events/employeeMgmt/AddEmployeeEvent.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.events.employeeMgmt; 2 | 3 | import com.howtodoinjava.demo.model.Employee; 4 | 5 | public class AddEmployeeEvent { 6 | 7 | private Employee employee; 8 | 9 | public AddEmployeeEvent(Employee employee) { 10 | this.employee = employee; 11 | } 12 | 13 | public Employee getEmployee() { 14 | return employee; 15 | } 16 | 17 | @Override 18 | public String toString() { 19 | return "ApplicationEvent: New Employee Saved :: " + this.employee; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /application-events/src/main/java/com/howtodoinjava/demo/events/employeeMgmt/DeleteEmployeeEvent.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.events.employeeMgmt; 2 | 3 | import com.howtodoinjava.demo.model.Employee; 4 | import org.springframework.context.ApplicationEvent; 5 | 6 | public class DeleteEmployeeEvent extends ApplicationEvent { 7 | 8 | public DeleteEmployeeEvent(Employee employee) { 9 | super(employee); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "ApplicationEvent: Employee Deleted :: " + this.getSource(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /application-events/src/main/java/com/howtodoinjava/demo/exception/ApplicationException.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.exception; 2 | 3 | public class ApplicationException extends Exception { 4 | public ApplicationException(String msg) { 5 | super(msg); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /application-events/src/main/java/com/howtodoinjava/demo/listners/DeleteEmployeeEventListener.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.listners; 2 | 3 | import com.howtodoinjava.demo.events.employeeMgmt.DeleteEmployeeEvent; 4 | import lombok.extern.slf4j.Slf4j; 5 | import org.springframework.context.ApplicationListener; 6 | import org.springframework.stereotype.Component; 7 | 8 | @Slf4j 9 | @Component 10 | public class DeleteEmployeeEventListener implements ApplicationListener { 11 | 12 | @Override 13 | public void onApplicationEvent(DeleteEmployeeEvent event) { 14 | log.info(event.toString()); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /application-events/src/main/java/com/howtodoinjava/demo/listners/EmployeeEventsListener.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.listners; 2 | 3 | import com.howtodoinjava.demo.events.employeeMgmt.AddEmployeeEvent; 4 | import com.howtodoinjava.demo.events.employeeMgmt.DeleteEmployeeEvent; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.springframework.context.event.EventListener; 7 | import org.springframework.stereotype.Component; 8 | 9 | @Slf4j 10 | @Component 11 | public class EmployeeEventsListener { 12 | 13 | @EventListener 14 | void handleAddEmployeeEvent(AddEmployeeEvent event) { 15 | log.info(event.toString()); 16 | } 17 | 18 | @EventListener 19 | void handleDeleteEmployeeEvent(DeleteEmployeeEvent event) { 20 | log.info(event.toString()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /application-events/src/main/java/com/howtodoinjava/demo/model/Employee.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.model; 2 | 3 | import jakarta.persistence.Entity; 4 | import jakarta.persistence.GeneratedValue; 5 | import jakarta.persistence.GenerationType; 6 | import jakarta.persistence.Id; 7 | import lombok.Data; 8 | import lombok.NoArgsConstructor; 9 | 10 | @Entity 11 | @Data 12 | @NoArgsConstructor 13 | public class Employee { 14 | 15 | @Id 16 | @GeneratedValue(strategy = GenerationType.IDENTITY) 17 | Long id; 18 | String name; 19 | 20 | public Employee(String name) { 21 | this.name = name; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /application-events/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=jdbc:h2:mem:testdb;DB_CLOSE_ON_EXIT=TRUE 2 | spring.datasource.username=sa 3 | spring.datasource.password= -------------------------------------------------------------------------------- /caching/README.md: -------------------------------------------------------------------------------- 1 | # Related Tutorials 2 | 3 | * [Spring Boot Caching Example](https://howtodoinjava.com/spring-boot/spring-boot-cache-example/) -------------------------------------------------------------------------------- /caching/src/main/java/com/howtodoinjava/app/config/CacheConfig.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app.config; 2 | 3 | import org.springframework.cache.CacheManager; 4 | import org.springframework.cache.annotation.EnableCaching; 5 | import org.springframework.cache.concurrent.ConcurrentMapCacheManager; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | 9 | import static java.util.Arrays.asList; 10 | 11 | @Configuration 12 | @EnableCaching 13 | public class CacheConfig { 14 | 15 | @Bean 16 | public CacheManager cacheManager() { 17 | ConcurrentMapCacheManager mgr = new ConcurrentMapCacheManager(); 18 | mgr.setCacheNames(asList("employees")); 19 | return mgr; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /caching/src/main/java/com/howtodoinjava/app/dao/EmployeeRepository.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app.dao; 2 | 3 | import com.howtodoinjava.app.model.Employee; 4 | import org.springframework.data.repository.CrudRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | @Repository 8 | public interface EmployeeRepository extends CrudRepository { 9 | } 10 | -------------------------------------------------------------------------------- /caching/src/main/java/com/howtodoinjava/app/model/Employee.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app.model; 2 | 3 | import jakarta.persistence.Entity; 4 | import jakarta.persistence.Id; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | @Data 10 | @NoArgsConstructor 11 | @AllArgsConstructor 12 | @Entity 13 | public class Employee { 14 | @Id 15 | private Long id; 16 | private String firstName; 17 | private String lastName; 18 | private String email; 19 | } 20 | -------------------------------------------------------------------------------- /caching/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=jdbc:h2:mem:testdb 2 | spring.datasource.username=sa 3 | spring.datasource.password= 4 | spring.datasource.driverClassName=org.h2.Driver 5 | spring.jpa.database-platform=org.hibernate.dialect.H2Dialect 6 | spring.jpa.show-sql=true -------------------------------------------------------------------------------- /caching/src/test/java/com/howtodoinjava/app/AppTest.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | public class AppTest { 8 | 9 | @Test 10 | public void contextLoads() { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /chatgpt-demo/src/main/java/com/howtodoinjava/demo/ChatGptApplication.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class ChatGptApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(ChatGptApplication.class, args); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /chatgpt-demo/src/main/java/com/howtodoinjava/demo/model/BotRequest.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.model; 2 | 3 | import java.util.List; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | @Data 9 | @NoArgsConstructor 10 | @AllArgsConstructor 11 | public class BotRequest { 12 | 13 | private String model; 14 | private List messages; 15 | private int n; 16 | private double temperature; 17 | private int max_tokens; 18 | } 19 | -------------------------------------------------------------------------------- /chatgpt-demo/src/main/java/com/howtodoinjava/demo/model/BotResponse.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.model; 2 | 3 | import java.util.List; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | @Data 9 | @AllArgsConstructor 10 | @NoArgsConstructor 11 | public class BotResponse { 12 | 13 | private List choices; 14 | 15 | @Data 16 | @AllArgsConstructor 17 | @NoArgsConstructor 18 | public static class Choice { 19 | 20 | private int index; 21 | private Message message; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /chatgpt-demo/src/main/java/com/howtodoinjava/demo/model/Message.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @AllArgsConstructor 9 | @NoArgsConstructor 10 | public class Message { 11 | private String role; 12 | private String content; 13 | } 14 | -------------------------------------------------------------------------------- /chatgpt-demo/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | openai.model=gpt-3.5-turbo 2 | openai.max-completions=1 3 | openai.temperature=0 4 | openai.max_tokens=100 5 | openai.api.url=https://api.openai.com/v1/chat/completions 6 | openai.api.key=YOUR-API-KEY 7 | logging.level.root=DEBUG -------------------------------------------------------------------------------- /chatgpt-demo/src/test/java/com/howtodoinjava/demo/ChatGptApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | public class ChatGptApplicationTest 8 | { 9 | @Test 10 | void contextLoads(){ 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /multiple-dataSources/src/main/java/com/howtodoinjava/app/App.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class App { 8 | public static void main(String[] args) { 9 | SpringApplication.run(App.class, args); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /multiple-dataSources/src/main/java/com/howtodoinjava/app/model/order/Order.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app.model.order; 2 | 3 | import jakarta.persistence.*; 4 | import lombok.Data; 5 | 6 | @Data 7 | @Entity 8 | @Table(name = "tbl_orders", schema = "orders") 9 | public class Order { 10 | 11 | @Id 12 | @GeneratedValue(strategy = GenerationType.SEQUENCE) 13 | @Column(name = "id") 14 | private Integer id; 15 | 16 | @Column(name = "product_name") 17 | private String productName; 18 | 19 | @Column(name = "order_amount") 20 | private Integer orderAmount; 21 | 22 | @Column(name = "user_id") 23 | private Integer userId; 24 | } 25 | -------------------------------------------------------------------------------- /multiple-dataSources/src/main/java/com/howtodoinjava/app/model/user/User.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app.model.user; 2 | 3 | import jakarta.persistence.*; 4 | import lombok.Data; 5 | 6 | @Data 7 | @Entity 8 | @Table(name = "tbl_users", schema = "users") 9 | public class User { 10 | 11 | @Id 12 | @GeneratedValue(strategy = GenerationType.SEQUENCE) 13 | @Column(name = "id") 14 | private Integer id; 15 | 16 | @Column(name = "first_name") 17 | private String firstName; 18 | 19 | @Column(name = "last_name") 20 | private String lastName; 21 | 22 | @Column(name = "email") 23 | private String email; 24 | } 25 | -------------------------------------------------------------------------------- /multiple-dataSources/src/main/java/com/howtodoinjava/app/repositories/order/OrderRepository.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app.repositories.order; 2 | 3 | import com.howtodoinjava.app.model.order.Order; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | @Repository 8 | public interface OrderRepository extends JpaRepository { 9 | } 10 | -------------------------------------------------------------------------------- /multiple-dataSources/src/main/java/com/howtodoinjava/app/repositories/user/UserRepository.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app.repositories.user; 2 | 3 | 4 | import com.howtodoinjava.app.model.user.User; 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | import org.springframework.stereotype.Repository; 7 | 8 | @Repository 9 | public interface UserRepository extends JpaRepository { 10 | } 11 | -------------------------------------------------------------------------------- /podman-deployment/Dockerfile: -------------------------------------------------------------------------------- 1 | #pulling jre image 2 | FROM docker.io/library/openjdk:17-oracle 3 | #setting db environment varilable 4 | ENV SPRING_DATASOURCE_URL jdbc:postgresql://10.88.0.14:5432/pgadmin 5 | ENV SPRING_DATASOURCE_USERNAME pgadmin 6 | ENV SPRING_DATASOURCE_PASSWORD postgres@dm1n 7 | #set working dir 8 | WORKDIR /app 9 | COPY demo-0.0.1-SNAPSHOT.jar app.jar 10 | # Expose the port that your Spring Boot application listens on (default is 8080) 11 | EXPOSE 8080 12 | # Define the command to run your application 13 | CMD ["java","-Dserver.port=8080","-jar","app.jar","spring.datasource.url=${SPRING_DATASOURCE_URL}", "spring.datasource.username=${SPRING_DATASOURCE_USERNAME}","spring.datasource.password=${SPRING_DATASOURCE_PASSWORD}"] 14 | 15 | -------------------------------------------------------------------------------- /podman-deployment/src/main/java/com/howtodoinjava/demo/DemoApplication.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class DemoApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(DemoApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /podman-deployment/src/main/java/com/howtodoinjava/demo/exception/RecordNotFoundException.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.exception; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(value = HttpStatus.NOT_FOUND) 7 | public class RecordNotFoundException extends Exception { 8 | 9 | private static final long serialVersionUID = 1L; 10 | 11 | public RecordNotFoundException(String message) { 12 | super(message); 13 | } 14 | 15 | public RecordNotFoundException(String message, Throwable t) { 16 | super(message, t); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /podman-deployment/src/main/java/com/howtodoinjava/demo/repository/EmployeeRepository.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.repository; 2 | 3 | import org.springframework.data.repository.CrudRepository; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import com.howtodoinjava.demo.model.EmployeeEntity; 7 | 8 | @Repository 9 | public interface EmployeeRepository 10 | extends CrudRepository { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /podman-deployment/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | #properties for postgres 2 | spring.datasource.url=jdbc:postgresql://localhost:5432/employee 3 | spring.datasource.username=postgres 4 | spring.datasource.password=P0$t@dm!n 5 | spring.jpa.show-sql=true 6 | ## Hibernate Properties 7 | # The SQL dialect makes Hibernate generate better SQL for the chosen database 8 | spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect 9 | 10 | # Hibernate ddl auto (create, create-drop, validate, update) 11 | spring.jpa.hibernate.ddl-auto = update 12 | 13 | -------------------------------------------------------------------------------- /podman-deployment/src/test/java/com/howtodoinjava/demo/DemoApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo; 2 | 3 | 4 | public class DemoApplicationTest { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /rest-api-timeout/README.md: -------------------------------------------------------------------------------- 1 | ## Related Tutorials 2 | 3 | * [Spring Boot REST API Timeout](https://howtodoinjava.com/spring-boot/spring-boot-rest-api-timeout-examples/) -------------------------------------------------------------------------------- /rest-api-timeout/src/main/java/com/howtodoinjava/demo/App.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class App { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(App.class); 11 | } 12 | } -------------------------------------------------------------------------------- /rest-api-timeout/src/main/java/com/howtodoinjava/demo/web/model/Item.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.web.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @AllArgsConstructor 9 | @NoArgsConstructor 10 | public class Item { 11 | 12 | Long id; 13 | String name; 14 | } 15 | -------------------------------------------------------------------------------- /rest-api-timeout/src/main/java/com/howtodoinjava/demo/web/service/ItemService.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.web.service; 2 | 3 | import com.howtodoinjava.demo.web.model.Item; 4 | import com.howtodoinjava.demo.web.util.TimeoutUtils; 5 | import java.util.List; 6 | import org.springframework.stereotype.Service; 7 | 8 | @Service 9 | public class ItemService { 10 | 11 | public List getAll() { 12 | TimeoutUtils.busyOperation(10000); 13 | return List.of(new Item(1L, "Item-1"), new Item(2L, "Item-2")); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /rest-api-timeout/src/main/java/com/howtodoinjava/demo/web/util/TimeoutUtils.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.web.util; 2 | 3 | public class TimeoutUtils { 4 | 5 | public static boolean busyOperation(long millis) { 6 | long startTime = System.currentTimeMillis(); 7 | long targetTime = startTime + millis; // 10 seconds in milliseconds 8 | 9 | while (System.currentTimeMillis() < targetTime) { 10 | try { 11 | Thread.sleep(100); 12 | } catch (InterruptedException e) { 13 | throw new RuntimeException(e); 14 | } 15 | } 16 | return true; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /rest-api-timeout/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.mvc.async.request-timeout=5000 2 | resilience4j.instances.itemService.timeoutDuration=5s -------------------------------------------------------------------------------- /search-in-keycloak-with-spring-boot/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /search-in-keycloak-with-spring-boot/src/main/java/com/example/searchinkeycloakwithspringboot/SearchInKeycloakWithSpringBootApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.searchinkeycloakwithspringboot; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SearchInKeycloakWithSpringBootApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SearchInKeycloakWithSpringBootApplication.class, args); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /search-in-keycloak-with-spring-boot/src/main/java/com/example/searchinkeycloakwithspringboot/exception/UserNotFoundInKeycloakException.java: -------------------------------------------------------------------------------- 1 | package com.example.searchinkeycloakwithspringboot.exception; 2 | 3 | public class UserNotFoundInKeycloakException extends Exception{ 4 | public UserNotFoundInKeycloakException(String message) { 5 | super(message); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /search-in-keycloak-with-spring-boot/src/main/java/com/example/searchinkeycloakwithspringboot/exception/handler/ExceptionController.java: -------------------------------------------------------------------------------- 1 | package com.example.searchinkeycloakwithspringboot.exception.handler; 2 | 3 | import com.example.searchinkeycloakwithspringboot.exception.UserNotFoundInKeycloakException; 4 | import org.springframework.http.ResponseEntity; 5 | import org.springframework.web.bind.annotation.ControllerAdvice; 6 | import org.springframework.web.bind.annotation.ExceptionHandler; 7 | 8 | @ControllerAdvice 9 | public class ExceptionController { 10 | 11 | @ExceptionHandler 12 | public ResponseEntity handleUserNotFoundInKeycloakException( 13 | UserNotFoundInKeycloakException e) { 14 | return ResponseEntity.badRequest().body(e.getMessage()); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /search-in-keycloak-with-spring-boot/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=9090 2 | -------------------------------------------------------------------------------- /social-connect-spring-boot-starter/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /social-connect-spring-boot-starter/src/main/java/com/howtodoinjava/app/config/SocialConnectProperties.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app.config; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | 6 | @Data 7 | @ConfigurationProperties(prefix = "social-connect") 8 | public class SocialConnectProperties { 9 | 10 | private Boolean debug = false; 11 | private OAuth oauth = new OAuth(); 12 | 13 | public OAuth getOauth() { 14 | return oauth; 15 | } 16 | 17 | @Data 18 | public static class OAuth { 19 | 20 | private String consumerKey = null; 21 | private String consumerSecret = null; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /social-connect-spring-boot-starter/src/main/java/com/howtodoinjava/app/config/SocialConnection.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app.config; 2 | 3 | public class SocialConnection { 4 | public SocialConnection() { 5 | } 6 | 7 | public SocialConnection connect(String key, String secret) { 8 | System.out.println("Initializing connection to social media with " + key + " and " + secret); 9 | return this; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /social-connect-spring-boot-starter/src/main/java/com/howtodoinjava/app/service/SocialConnectService.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app.service; 2 | 3 | import java.util.List; 4 | 5 | public interface SocialConnectService { 6 | public List fetchMessages(); 7 | } 8 | -------------------------------------------------------------------------------- /social-connect-spring-boot-starter/src/main/java/com/howtodoinjava/app/service/SocialConnectServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app.service; 2 | 3 | import com.howtodoinjava.app.config.SocialConnection; 4 | import lombok.extern.slf4j.Slf4j; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | 7 | import java.util.List; 8 | 9 | @Slf4j 10 | public class SocialConnectServiceImpl implements SocialConnectService { 11 | 12 | @Autowired 13 | private SocialConnection socialConnection; 14 | 15 | @Override 16 | public List fetchMessages() { 17 | log.info("Fetching messages using SocialConnection ..."); 18 | //TODO: Do something with socialConnection 19 | return List.of("Hello, World!"); 20 | } 21 | } -------------------------------------------------------------------------------- /social-connect-spring-boot-starter/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.howtodoinjava.app.config.SocialConnectAutoConfiguration -------------------------------------------------------------------------------- /social-connect-spring-boot-starter/src/main/resources/META-INF/spring.provides: -------------------------------------------------------------------------------- 1 | provides: lombok,spring-boot-starter-web,spring-boot-starter-test -------------------------------------------------------------------------------- /social-connect-spring-boot-starter/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | social-connect.debug=false 2 | social-connect.oauth.consumer-key=your-consumer-key-here 3 | social-connect.oauth.consumer-secret=your-consumer-secret-here 4 | -------------------------------------------------------------------------------- /spring-angular-application-example/SpringBootApplication/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /spring-angular-application-example/SpringBootApplication/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/spring-angular-application-example/SpringBootApplication/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /spring-angular-application-example/SpringBootApplication/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar 3 | -------------------------------------------------------------------------------- /spring-angular-application-example/SpringBootApplication/src/main/java/com/boot/rest/base/Application.java: -------------------------------------------------------------------------------- 1 | package com.boot.rest.base; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Application.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-angular-application-example/SpringBootApplication/src/main/java/com/boot/rest/base/repository/UserRepository.java: -------------------------------------------------------------------------------- 1 | package com.boot.rest.base.repository; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | 5 | import com.boot.rest.base.model.User; 6 | 7 | public interface UserRepository extends JpaRepository { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /spring-angular-application-example/SpringBootApplication/src/main/java/com/boot/rest/base/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.boot.rest.base.service; 2 | 3 | import java.util.List; 4 | 5 | import com.boot.rest.base.model.User; 6 | 7 | public interface UserService { 8 | 9 | public User insert(User userVO); 10 | 11 | public List findAll(); 12 | 13 | public void delete(int id); 14 | 15 | public User findById(int id); 16 | 17 | public User updateUser(int id, User userVO); 18 | } 19 | -------------------------------------------------------------------------------- /spring-angular-application-example/SpringBootApplication/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | #jpa config 2 | 3 | #JDBC connection properties 4 | spring.datasource.url=jdbc:h2:file:C:/temp/test 5 | spring.datasource.username=sa 6 | spring.datasource.password= 7 | spring.datasource.driverClassName=org.h2.Driver 8 | spring.jpa.database-platform=org.hibernate.dialect.H2Dialect 9 | 10 | 11 | #Hibernate properties 12 | spring.jpa.hibernate.ddl-auto = update 13 | spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true 14 | 15 | -------------------------------------------------------------------------------- /spring-angular-application-example/SpringBootApplication/src/test/java/com/boot/rest/base/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.boot.rest.base; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class ApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-angular-application-example/angular-app/.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # For the full list of supported browsers by the Angular framework, please see: 6 | # https://angular.io/guide/browser-support 7 | 8 | # You can see what browsers were selected by your queries by running: 9 | # npx browserslist 10 | 11 | last 1 Chrome version 12 | last 1 Firefox version 13 | last 2 Edge major versions 14 | last 2 Safari major versions 15 | last 2 iOS major versions 16 | Firefox ESR 17 | -------------------------------------------------------------------------------- /spring-angular-application-example/angular-app/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /spring-angular-application-example/angular-app/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # Compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | /bazel-out 8 | 9 | # Node 10 | **/node_modules 11 | npm-debug.log 12 | yarn-error.log 13 | 14 | # IDEs and editors 15 | .idea/ 16 | .project 17 | .classpath 18 | .c9/ 19 | *.launch 20 | .settings/ 21 | *.sublime-workspace 22 | 23 | # Visual Studio Code 24 | .vscode/* 25 | !.vscode/settings.json 26 | !.vscode/tasks.json 27 | !.vscode/launch.json 28 | !.vscode/extensions.json 29 | .history/* 30 | 31 | # Miscellaneous 32 | /.angular/cache 33 | .sass-cache/ 34 | /connect.lock 35 | /coverage 36 | /libpeerconnection.log 37 | testem.log 38 | /typings 39 | 40 | # System files 41 | .DS_Store 42 | Thumbs.db 43 | -------------------------------------------------------------------------------- /spring-angular-application-example/angular-app/src/app/app.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/spring-angular-application-example/angular-app/src/app/app.component.css -------------------------------------------------------------------------------- /spring-angular-application-example/angular-app/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 11 | 12 | -------------------------------------------------------------------------------- /spring-angular-application-example/angular-app/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.css'] 7 | }) 8 | export class AppComponent { 9 | title = 'angular-app'; 10 | } 11 | -------------------------------------------------------------------------------- /spring-angular-application-example/angular-app/src/app/services/user.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { UserService } from './user.service'; 4 | 5 | describe('UserService', () => { 6 | let service: UserService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(UserService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /spring-angular-application-example/angular-app/src/app/user-create/user-create.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/spring-angular-application-example/angular-app/src/app/user-create/user-create.component.css -------------------------------------------------------------------------------- /spring-angular-application-example/angular-app/src/app/user-list/user-list.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/spring-angular-application-example/angular-app/src/app/user-list/user-list.component.css -------------------------------------------------------------------------------- /spring-angular-application-example/angular-app/src/app/user-list/user-list.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { UserListComponent } from './user-list.component'; 4 | 5 | describe('UserListComponent', () => { 6 | let component: UserListComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ UserListComponent ] 12 | }) 13 | .compileComponents(); 14 | 15 | fixture = TestBed.createComponent(UserListComponent); 16 | component = fixture.componentInstance; 17 | fixture.detectChanges(); 18 | }); 19 | 20 | it('should create', () => { 21 | expect(component).toBeTruthy(); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /spring-angular-application-example/angular-app/src/app/user-update/user-update.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/spring-angular-application-example/angular-app/src/app/user-update/user-update.component.css -------------------------------------------------------------------------------- /spring-angular-application-example/angular-app/src/app/user.model.spec.ts: -------------------------------------------------------------------------------- 1 | import { User } from './user.model'; 2 | 3 | describe('User', () => { 4 | it('should create an instance', () => { 5 | expect(new User()).toBeTruthy(); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /spring-angular-application-example/angular-app/src/app/user.model.ts: -------------------------------------------------------------------------------- 1 | export class User { 2 | id!: number; 3 | firstName!: string; 4 | lastName!: string; 5 | username!: string; 6 | password!: string; 7 | } 8 | -------------------------------------------------------------------------------- /spring-angular-application-example/angular-app/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/spring-angular-application-example/angular-app/src/assets/.gitkeep -------------------------------------------------------------------------------- /spring-angular-application-example/angular-app/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /spring-angular-application-example/angular-app/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/plugins/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /spring-angular-application-example/angular-app/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/spring-angular-application-example/angular-app/src/favicon.ico -------------------------------------------------------------------------------- /spring-angular-application-example/angular-app/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AngularApp 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /spring-angular-application-example/angular-app/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /spring-angular-application-example/angular-app/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /spring-angular-application-example/angular-app/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": [ 9 | "src/main.ts", 10 | "src/polyfills.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /spring-angular-application-example/angular-app/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/spec", 6 | "types": [ 7 | "jasmine" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /spring-aws-dynamodb-example/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/spring-aws-dynamodb-example/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /spring-aws-dynamodb-example/src/main/java/com/howtodoinjava/demo/App.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class App { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(App.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-aws-dynamodb-example/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | aws.dynamodb.accesskey=accesskey 2 | aws.dynamodb.secretkey=secretkey 3 | aws.dynamodb.endpoint=http://localhost:8000 4 | -------------------------------------------------------------------------------- /spring-batch-excel/data.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/spring-batch-excel/data.xlsx -------------------------------------------------------------------------------- /spring-batch-excel/src/main/java/com/howtodoinjava/demo/SpringBatchApplication.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.scheduling.annotation.EnableScheduling; 6 | 7 | @SpringBootApplication 8 | @EnableScheduling 9 | public class SpringBatchApplication { 10 | public static void main(String[] args) { 11 | SpringApplication.run(SpringBatchApplication.class); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /spring-batch-excel/src/main/java/com/howtodoinjava/demo/config/LoggingPersonProcessor.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.config; 2 | 3 | import com.howtodoinjava.demo.model.Person; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | import org.springframework.batch.item.ItemProcessor; 7 | 8 | public class LoggingPersonProcessor implements ItemProcessor { 9 | private static final Logger LOGGER = LoggerFactory.getLogger(LoggingPersonProcessor.class); 10 | 11 | @Override 12 | public Person process(Person item) throws Exception { 13 | LOGGER.info("Processing person information: {}", item); 14 | return item; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /spring-batch-excel/src/main/java/com/howtodoinjava/demo/config/LoggingPersonWriter.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.config; 2 | 3 | import com.howtodoinjava.demo.model.Person; 4 | import org.springframework.batch.item.Chunk; 5 | import org.springframework.batch.item.ItemWriter; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | 9 | public class LoggingPersonWriter implements ItemWriter { 10 | 11 | private static final Logger LOGGER = LoggerFactory.getLogger(LoggingPersonWriter.class); 12 | 13 | @Override 14 | public void write(Chunk items) throws Exception { 15 | LOGGER.info("Received the information of {} people", items.size()); 16 | items.forEach(i -> LOGGER.debug("Received the information of a person: {}", i)); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /spring-batch-excel/src/main/java/com/howtodoinjava/demo/model/Person.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.model; 2 | 3 | import jakarta.persistence.Entity; 4 | import jakarta.persistence.GeneratedValue; 5 | import jakarta.persistence.GenerationType; 6 | import jakarta.persistence.Id; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Data; 9 | import lombok.NoArgsConstructor; 10 | 11 | @Data 12 | @NoArgsConstructor 13 | @AllArgsConstructor 14 | 15 | @Entity 16 | public class Person { 17 | 18 | @Id 19 | @GeneratedValue(strategy = GenerationType.IDENTITY) 20 | Long id; 21 | String firstName; 22 | String lastName; 23 | Integer age; 24 | Boolean active; 25 | } -------------------------------------------------------------------------------- /spring-batch-excel/src/main/java/com/howtodoinjava/demo/model/PersonRepository.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.model; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import org.springframework.stereotype.Repository; 5 | 6 | @Repository 7 | public interface PersonRepository extends JpaRepository { 8 | } 9 | -------------------------------------------------------------------------------- /spring-batch-excel/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | excel.to.database.job.source.file.path=data.xlsx 2 | excel.to.database.job.cron=*/10 * * * * * 3 | spring.batch.job.enabled=false 4 | spring.jpa.show-sql=true 5 | spring.jpa.properties.hibernate.jdbc.batch_size = 50 6 | spring.jpa.properties.hibernate.order_inserts = true 7 | 8 | spring.datasource.url=jdbc:h2:mem:testdb;DB_CLOSE_ON_EXIT=TRUE 9 | spring.datasource.driverClassName=org.h2.Driver 10 | spring.datasource.username=sa 11 | spring.datasource.password= 12 | spring.jpa.database-platform=org.hibernate.dialect.H2Dialect 13 | 14 | spring.h2.console.enabled=true 15 | spring.h2.console.path=/h2-console 16 | spring.h2.console.settings.trace=false -------------------------------------------------------------------------------- /spring-batch-excel/src/main/resources/data.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/spring-batch-excel/src/main/resources/data.xlsx -------------------------------------------------------------------------------- /spring-batch-excel/src/test/java/com/howtodoinjava/demo/SpringBatchApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | public class SpringBatchApplicationTest { 8 | 9 | @Test 10 | public void contextLoads(){ 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /spring-boot-batch/src/main/java/com/howtodoinjava/demo/batch/jobs/csvToDb/model/Person.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.batch.jobs.csvToDb.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @NoArgsConstructor 9 | @AllArgsConstructor 10 | public class Person { 11 | 12 | String firstName; 13 | String lastName; 14 | Integer age; 15 | Boolean active; 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-batch/src/main/java/com/howtodoinjava/demo/batch/jobs/csvToDb/processor/PersonItemProcessor.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.batch.jobs.csvToDb.processor; 2 | 3 | import com.howtodoinjava.demo.batch.jobs.csvToDb.model.Person; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | import org.springframework.batch.item.ItemProcessor; 7 | 8 | public class PersonItemProcessor implements ItemProcessor { 9 | 10 | public static final Logger logger = LoggerFactory.getLogger(PersonItemProcessor.class); 11 | 12 | @Override 13 | public Person process(Person person) throws Exception { 14 | //... 15 | logger.info("Processed record: " + person); 16 | return person; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /spring-boot-batch/src/main/java/com/howtodoinjava/demo/batch/quartz/BatchJobByQuartzApplication.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.batch.quartz; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.context.annotation.ComponentScan; 6 | 7 | @SpringBootApplication 8 | @ComponentScan(basePackages = {"com.howtodoinjava.demo.batch.quartz"}) 9 | public class BatchJobByQuartzApplication { 10 | public static void main(String[] args) { 11 | SpringApplication.run(BatchJobByQuartzApplication.class, args); 12 | } 13 | } -------------------------------------------------------------------------------- /spring-boot-batch/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=jdbc:h2:mem:testdb 2 | spring.datasource.username=sa 3 | spring.datasource.password= 4 | 5 | spring.batch.job.enabled=false 6 | 7 | spring.h2.console.enabled=true 8 | spring.h2.console.path=/h2-console 9 | spring.h2.console.settings.trace=false 10 | 11 | # Uncomment for using the RAMJobStore 12 | #spring.quartz.job-store-type=jdbc 13 | 14 | spring.quartz.job-store-type=jdbc 15 | spring.quartz.properties.org.quartz.jobStore.tablePrefix=QRTZ_ 16 | spring.quartz.properties.org.quartz.jobStore.isClustered=false 17 | spring.quartz.properties.org.quartz.scheduler.instanceName=MyScheduler 18 | spring.quartz.properties.org.quartz.threadPool.threadCount=5 19 | -------------------------------------------------------------------------------- /spring-boot-batch/src/main/resources/csv/inputData-copy.csv: -------------------------------------------------------------------------------- 1 | Lokesh,Gupta,41,true 2 | Brian,Schultz,42,false 3 | John,Cena,43,true 4 | Albert,Pinto,44,false -------------------------------------------------------------------------------- /spring-boot-batch/src/main/resources/csv/inputData.csv: -------------------------------------------------------------------------------- 1 | Lokesh,Gupta,41,true 2 | Brian,Schultz,42,false 3 | John,Cena,43,true 4 | Albert,Pinto,44,false -------------------------------------------------------------------------------- /spring-boot-batch/src/main/resources/sql/batch-schema.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS person; 2 | 3 | CREATE TABLE person ( 4 | person_id BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY, 5 | first_name VARCHAR(50), 6 | last_name VARCHAR(50), 7 | age INTEGER, 8 | is_active BOOLEAN 9 | ); -------------------------------------------------------------------------------- /spring-boot-batch/src/test/java/com/howtodoinjava/demo/AppTest.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo; 2 | 3 | public class AppTest { 4 | } 5 | -------------------------------------------------------------------------------- /spring-boot-docker-compose/README.md: -------------------------------------------------------------------------------- 1 | # Related Tutorials 2 | 3 | * [Using Docker Compose with Spring Boot](https://howtodoinjava.com/spring-boot/spring-boot-docker-compose/) -------------------------------------------------------------------------------- /spring-boot-docker-compose/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | redis: 3 | image: 'redis' 4 | ports: 5 | - '6379' 6 | labels: 7 | org.springframework.boot.readiness-check.tcp.disable: true -------------------------------------------------------------------------------- /spring-boot-docker-compose/src/main/java/com/howtodoinjava/demo/App.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class App { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(App.class, args); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /spring-boot-docker-compose/src/main/java/com/howtodoinjava/demo/dao/ItemRepository.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.dao; 2 | 3 | import com.howtodoinjava.demo.dao.model.Item; 4 | import org.springframework.data.repository.CrudRepository; 5 | 6 | public interface ItemRepository extends CrudRepository { 7 | } 8 | -------------------------------------------------------------------------------- /spring-boot-docker-compose/src/main/java/com/howtodoinjava/demo/dao/model/Item.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.dao.model; 2 | 3 | import jakarta.persistence.Entity; 4 | import jakarta.persistence.GeneratedValue; 5 | import jakarta.persistence.GenerationType; 6 | import jakarta.persistence.Id; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Data; 9 | import lombok.NoArgsConstructor; 10 | 11 | @Entity 12 | @Data 13 | @AllArgsConstructor 14 | @NoArgsConstructor 15 | public class Item { 16 | 17 | @Id 18 | @GeneratedValue(strategy = GenerationType.AUTO) 19 | Long id; 20 | String name; 21 | } 22 | -------------------------------------------------------------------------------- /spring-boot-docker-compose/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.docker.compose.file=./spring-boot-docker-compose/docker-compose.yaml 2 | 3 | spring.datasource.url=jdbc:postgresql://localhost:5432/items 4 | spring.datasource.username=postgres-admin 5 | spring.datasource.password=secret-password 6 | spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect 7 | spring.jpa.hibernate.ddl-auto=update -------------------------------------------------------------------------------- /spring-boot-docker-minikube/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:17 2 | VOLUME /tmp 3 | EXPOSE 8080 4 | ARG JAR_FILE=target/spring-demo-0.0.1-SNAPSHOT.jar 5 | ADD ${JAR_FILE} app.jar 6 | ENTRYPOINT ["java","-jar","/app.jar"] -------------------------------------------------------------------------------- /spring-boot-docker-minikube/README.md: -------------------------------------------------------------------------------- 1 | # Related Tutorials 2 | 3 | 1. [Deploying a Spring Boot App to Kubernetes (Minikube)](https://howtodoinjava.com/devops/deploy-dockerized-spring-boot-app-to-minikube/) -------------------------------------------------------------------------------- /spring-boot-docker-minikube/deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: spring-app 5 | spec: 6 | replicas: 2 7 | selector: 8 | matchLabels: 9 | app: spring-app 10 | template: 11 | metadata: 12 | labels: 13 | app: spring-app 14 | spec: 15 | containers: 16 | - name: spring-app 17 | image: springboot-app:latest 18 | imagePullPolicy: IfNotPresent 19 | ports: 20 | - containerPort: 8080 21 | -------------------------------------------------------------------------------- /spring-boot-docker-minikube/services.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: spring-service 5 | spec: 6 | type: NodePort 7 | selector: 8 | app: spring-app 9 | ports: 10 | - name: http 11 | port: 80 12 | targetPort: 8080 13 | nodePort: 30005 14 | -------------------------------------------------------------------------------- /spring-boot-docker-minikube/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /spring-boot-docker-minikube/src/test/java/com/howtodoinjava/app/AppTest.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class AppTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-boot-file-upload-restapi/src/main/java/com/howtodoinjava/demo/SpringBootWebApplication.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringBootWebApplication { 8 | 9 | public static void main(String[] args) throws Exception { 10 | SpringApplication.run(SpringBootWebApplication.class, args); 11 | } 12 | } -------------------------------------------------------------------------------- /spring-boot-file-upload-restapi/src/main/java/com/howtodoinjava/demo/model/FileForm.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | import org.springframework.web.multipart.MultipartFile; 7 | 8 | @Data 9 | @AllArgsConstructor 10 | @NoArgsConstructor 11 | public class FileForm { 12 | 13 | private String name; 14 | private String email; 15 | private MultipartFile file; 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-file-upload-restapi/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.servlet.multipart.max-file-size=10MB 2 | spring.servlet.multipart.max-request-size=10MB -------------------------------------------------------------------------------- /spring-boot-load-initial-data/README.md: -------------------------------------------------------------------------------- 1 | # Related Tutorials 2 | 3 | 1. [Load Initial Data with SQL Scripts in Spring Boot](https://howtodoinjava.com/spring-boot/execute-sql-scripts-on-startup/) 4 | 2. [Spring @Sql, @SqlGroup](https://howtodoinjava.com/spring/spring-sql-sqlgroup-and-sqlmergemode/) -------------------------------------------------------------------------------- /spring-boot-load-initial-data/src/main/java/com/howtodoinjava/demo/App.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class App { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(App.class, args); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /spring-boot-load-initial-data/src/main/java/com/howtodoinjava/demo/entity/Item.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.entity; 2 | 3 | import static jakarta.persistence.GenerationType.IDENTITY; 4 | 5 | import jakarta.persistence.Column; 6 | import jakarta.persistence.Entity; 7 | import jakarta.persistence.GeneratedValue; 8 | import jakarta.persistence.Id; 9 | import jakarta.persistence.Table; 10 | import lombok.AllArgsConstructor; 11 | import lombok.Data; 12 | import lombok.NoArgsConstructor; 13 | 14 | @Data 15 | @NoArgsConstructor 16 | @AllArgsConstructor 17 | @Entity 18 | @Table(name = "ITEM") 19 | public class Item { 20 | @Id 21 | @GeneratedValue(strategy = IDENTITY) 22 | private Integer id; 23 | 24 | @Column(nullable = false) 25 | private String name; 26 | } 27 | -------------------------------------------------------------------------------- /spring-boot-load-initial-data/src/main/java/com/howtodoinjava/demo/repository/ItemRepository.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.repository; 2 | 3 | import com.howtodoinjava.demo.entity.Item; 4 | import java.util.Optional; 5 | import org.springframework.data.repository.CrudRepository; 6 | import org.springframework.stereotype.Repository; 7 | 8 | @Repository 9 | public interface ItemRepository extends CrudRepository { 10 | public Optional findByName(String name); 11 | } 12 | -------------------------------------------------------------------------------- /spring-boot-load-initial-data/src/test/resources/application-test.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/spring-boot-load-initial-data/src/test/resources/application-test.properties -------------------------------------------------------------------------------- /spring-boot-load-initial-data/src/test/resources/com/howtodoinjava/demo/AppTest.testMethodNameScript.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO ITEM (name) VALUES ('Tickets'); 2 | INSERT INTO ITEM (name) VALUES ('Spices'); -------------------------------------------------------------------------------- /spring-boot-load-initial-data/src/test/resources/data.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO ITEM (name) VALUES ('Mobiles'); 2 | INSERT INTO ITEM (name) VALUES ('Laptops'); -------------------------------------------------------------------------------- /spring-boot-load-initial-data/src/test/resources/import.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO ITEM (name) VALUES ('Books'); 2 | INSERT INTO ITEM (name) VALUES ('Games'); -------------------------------------------------------------------------------- /spring-boot-load-initial-data/src/test/resources/schema.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE ITEM IF EXISTS; 2 | 3 | CREATE TABLE ITEM ( 4 | id INTEGER NOT NULL AUTO_INCREMENT, 5 | name VARCHAR(128) NOT NULL, 6 | PRIMARY KEY (id) 7 | ); -------------------------------------------------------------------------------- /spring-boot-load-initial-data/src/test/resources/sql/data.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO ITEM (name) VALUES ('Mobiles'); 2 | INSERT INTO ITEM (name) VALUES ('Laptops'); -------------------------------------------------------------------------------- /spring-boot-load-initial-data/src/test/resources/sql/items-books.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO ITEM (name) VALUES ('Book-1'); 2 | INSERT INTO ITEM (name) VALUES ('Book-2'); -------------------------------------------------------------------------------- /spring-boot-load-initial-data/src/test/resources/sql/items-grocery.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO ITEM (name) VALUES ('Grocery-1'); 2 | INSERT INTO ITEM (name) VALUES ('Grocery-2'); -------------------------------------------------------------------------------- /spring-boot-load-initial-data/src/test/resources/sql/schema.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE ITEM IF EXISTS; 2 | 3 | CREATE TABLE ITEM ( 4 | id INTEGER NOT NULL AUTO_INCREMENT, 5 | name VARCHAR(128) NOT NULL, 6 | PRIMARY KEY (id) 7 | ); -------------------------------------------------------------------------------- /spring-boot-long-running-tasks/src/main/java/com/howtodoinjava/demo/web/model/TaskRequest.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.web.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @AllArgsConstructor 9 | @NoArgsConstructor 10 | public class TaskRequest { 11 | 12 | private String name; 13 | } 14 | -------------------------------------------------------------------------------- /spring-boot-long-running-tasks/src/main/java/com/howtodoinjava/demo/web/model/TaskResponse.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.web.model; 2 | 3 | import java.io.Serializable; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | @Data 9 | @AllArgsConstructor 10 | @NoArgsConstructor 11 | public class TaskResponse implements Serializable { 12 | 13 | private String taskId; 14 | private String name; 15 | } 16 | -------------------------------------------------------------------------------- /spring-boot-long-running-tasks/src/main/java/com/howtodoinjava/demo/web/model/TaskStatus.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.web.model; 2 | 3 | import java.io.Serializable; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | @Data 9 | @AllArgsConstructor 10 | @NoArgsConstructor 11 | public class TaskStatus implements Serializable { 12 | 13 | private String taskId; 14 | private String taskName; 15 | private float percentageComplete; 16 | private Status status; 17 | 18 | public enum Status { 19 | SUBMITTED, STARTED, RUNNING, FINISHED, TERMINATED 20 | } 21 | } 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /spring-boot-mongodb-crud/src/main/java/com/howtodoinjava/app/App.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class App { 8 | 9 | public static void main(String[] args) { 10 | 11 | SpringApplication.run(App.class, args); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /spring-boot-mongodb-crud/src/main/java/com/howtodoinjava/app/model/Item.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | import org.springframework.data.annotation.Id; 7 | import org.springframework.data.mongodb.core.mapping.Document; 8 | import org.springframework.data.mongodb.core.mapping.Field; 9 | 10 | @Data 11 | @NoArgsConstructor 12 | @AllArgsConstructor 13 | @Document("items") 14 | public class Item { 15 | 16 | @Id 17 | private String id; 18 | 19 | @Field("name") 20 | private String name; 21 | 22 | @Field("quantity") 23 | private int quantity; 24 | 25 | @Field("category") 26 | private String category; 27 | } -------------------------------------------------------------------------------- /spring-boot-mongodb-crud/src/main/java/com/howtodoinjava/app/repositories/ItemRepository.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app.repositories; 2 | 3 | import com.howtodoinjava.app.model.Item; 4 | import org.springframework.data.mongodb.repository.MongoRepository; 5 | import org.springframework.data.mongodb.repository.Query; 6 | 7 | import java.util.List; 8 | 9 | public interface ItemRepository extends MongoRepository { 10 | 11 | @Query("{name:'?0'}") 12 | Item findByName(String name); 13 | 14 | @Query(value = "{category:'?0'}", fields = "{'name' : 1, 'quantity' : 1}") 15 | List findByCategory(String category); 16 | 17 | @Query("{ 'quantity' : { $gt: ?0, $lt: ?1 } }") 18 | List findAllByQuantityBetween(int qtyGT, int qtyLT); 19 | 20 | } -------------------------------------------------------------------------------- /spring-boot-mongodb-crud/src/main/java/com/howtodoinjava/app/service/MongoRepositoryService.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app.service; 2 | 3 | import com.howtodoinjava.app.model.Item; 4 | 5 | import java.util.List; 6 | 7 | public interface MongoRepositoryService { 8 | 9 | public Item add(Item item); 10 | 11 | public Item update(Item itemToUpdate); 12 | 13 | public boolean delete(String id); 14 | 15 | public List getAll(); 16 | 17 | public List getAll(Integer page, Integer size); 18 | 19 | public Item getById(String id); 20 | 21 | public Item findByName(String name); 22 | 23 | public List findAllByCategory(String category); 24 | 25 | public List findAllByQuantityBetween(int qtyGT, int qtyLT); 26 | } 27 | -------------------------------------------------------------------------------- /spring-boot-mongodb-crud/src/main/java/com/howtodoinjava/app/service/MongoTemplateService.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app.service; 2 | 3 | import com.howtodoinjava.app.model.Item; 4 | 5 | import java.util.List; 6 | 7 | public interface MongoTemplateService { 8 | 9 | public Item add(Item item); 10 | 11 | public Item update(Item item); 12 | 13 | public boolean delete(String id); 14 | 15 | public boolean delete(Item item); 16 | 17 | public List getAll(); 18 | 19 | public List getAll(Integer page, Integer size); 20 | 21 | public Item getById(String id); 22 | 23 | public List search(String name, Integer minQuantity, 24 | Integer maxQuantity, 25 | String category); 26 | } 27 | -------------------------------------------------------------------------------- /spring-boot-mongodb-crud/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | #spring.data.mongodb.host=localhost 2 | #spring.data.mongodb.port=27017 3 | #spring.data.mongodb.database=testdb 4 | #spring.data.mongodb.username=mongoadmin 5 | #spring.data.mongodb.password=secret 6 | #spring.data.mongodb.authentication-database=admin 7 | # 8 | #spring.data.mongodb.uri=mongodb://mongoadmin:secret@localhost:27017 9 | # 10 | logging.level.org.springframework.data.mongodb.core.MongoTemplate=DEBUG 11 | -------------------------------------------------------------------------------- /spring-boot-mongodb-crud/src/test/java/com/howtodoinjava/app/AppTest.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | public class AppTest { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /spring-boot-mvc-thymeleaf/src/main/java/com/howtodoinjava/demo/dao/ItemRepository.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.dao; 2 | 3 | import com.howtodoinjava.demo.dao.model.Item; 4 | import org.springframework.data.repository.CrudRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | @Repository 8 | public interface ItemRepository extends CrudRepository { 9 | } 10 | -------------------------------------------------------------------------------- /spring-boot-mvc-thymeleaf/src/main/java/com/howtodoinjava/demo/dao/model/Item.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.dao.model; 2 | 3 | import jakarta.persistence.Entity; 4 | import jakarta.persistence.Id; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | @Data 10 | @AllArgsConstructor 11 | @NoArgsConstructor 12 | @Entity 13 | public class Item { 14 | 15 | @Id 16 | long id; 17 | String name; 18 | } 19 | -------------------------------------------------------------------------------- /spring-boot-mvc-thymeleaf/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=jdbc:h2:mem:testdb 2 | spring.datasource.driverClassName=org.h2.Driver 3 | spring.datasource.username=sa 4 | spring.datasource.password= 5 | spring.jpa.database-platform=org.hibernate.dialect.H2Dialect 6 | 7 | spring.thymeleaf.prefix=classpath:/templates/ 8 | spring.thymeleaf.suffix=.html 9 | spring.thymeleaf.cache=false 10 | -------------------------------------------------------------------------------- /spring-boot-mvc-thymeleaf/src/main/resources/templates/index.html: -------------------------------------------------------------------------------- 1 | 5 | 6 | 12 | 13 | 14 |

Home

15 |

Show Items

16 | 17 | -------------------------------------------------------------------------------- /spring-boot-mvc-thymeleaf/src/test/java/com/howtodoinjava/demo/AppTest.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | public class AppTest { 8 | 9 | @Test 10 | public void contextLoads() { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /spring-boot-resilience4j/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /spring-boot-resilience4j/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/spring-boot-resilience4j/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /spring-boot-resilience4j/src/main/java/com/howtodoinjava/resilience4j/Resilience4jApplication.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.resilience4j; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Resilience4jApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Resilience4jApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-boot-resilience4j/src/main/java/com/howtodoinjava/resilience4j/dto/Student.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.resilience4j.dto; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @AllArgsConstructor 9 | @NoArgsConstructor 10 | public class Student { 11 | 12 | private int id; 13 | private String name; 14 | } 15 | -------------------------------------------------------------------------------- /spring-boot-resilience4j/src/test/java/com/howtodoinjava/resilience4j/Resilience4jApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.resilience4j; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class Resilience4jApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-boot-response-entity-demo/src/main/java/com/howtodoinjava/demo/exception/ResourceNotFoundException.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.exception; 2 | 3 | public class ResourceNotFoundException extends RuntimeException { 4 | public ResourceNotFoundException(String message) { 5 | super(message); 6 | } 7 | } 8 | 9 | 10 | -------------------------------------------------------------------------------- /spring-boot-response-entity-demo/src/main/java/com/howtodoinjava/demo/repository/StudentRepository.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.repository; 2 | 3 | import com.howtodoinjava.demo.entity.Student; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | @Repository 8 | public interface StudentRepository extends JpaRepository { 9 | // Custom query methods if needed 10 | } 11 | -------------------------------------------------------------------------------- /spring-boot-response-entity-demo/src/main/java/com/howtodoinjava/demo/service/StudentService.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.service; 2 | 3 | import com.howtodoinjava.demo.entity.Student; 4 | 5 | import java.util.List; 6 | import java.util.Optional; 7 | 8 | public interface StudentService { 9 | List getAllStudents(); 10 | Optional getStudentById(Long id); 11 | Student createStudent(Student student); 12 | Student updateStudent(Long id, Student updatedStudent); 13 | void deleteStudent(Long id); 14 | } 15 | -------------------------------------------------------------------------------- /spring-boot-response-entity-demo/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=jdbc:h2:mem:testdb 2 | spring.datasource.driverClassName=org.h2.Driver 3 | spring.datasource.username=sa 4 | spring.datasource.password=password 5 | spring.jpa.database-platform=org.hibernate.dialect.H2Dialect 6 | spring.jpa.hibernate.ddl-auto=update 7 | 8 | # Server Configuration 9 | server.port=8080 10 | 11 | -------------------------------------------------------------------------------- /spring-boot-template-engines-demo/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.mustache.prefix=classpath:/templates/ 2 | spring.mustache.suffix=.mustache 3 | spring.mustache.content-type=text/html; charset=UTF-8 4 | 5 | 6 | # Thymeleaf template prefix (default: classpath:/templates/) 7 | spring.thymeleaf.prefix=classpath:/templates/ 8 | # Thymeleaf template suffix (default: .html) 9 | spring.thymeleaf.suffix=.html 10 | # Enable Thymeleaf cache (default: true for production, false for development) 11 | spring.thymeleaf.cache=true 12 | 13 | #spring.freemarker.suffix=.ftlh 14 | #spring.freemarker.template-loader-path=classpath:/templates/ 15 | 16 | spring.mvc.view.prefix=WEB-INF/views/ 17 | spring.mvc.view.suffix=.jsp 18 | -------------------------------------------------------------------------------- /spring-boot-template-engines-demo/src/main/resources/templates/freemarker.ftlh: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Freemarker Demo 5 | 6 | 7 |

${message}

8 |

Current date and time: ${.now}

9 | 10 | 11 | -------------------------------------------------------------------------------- /spring-boot-template-engines-demo/src/main/resources/templates/home.mustache: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Mustache Demo 5 | 6 | 7 |

{{message}}

8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /spring-boot-template-engines-demo/src/main/resources/templates/index.tpl: -------------------------------------------------------------------------------- 1 | yieldUnescaped '' 2 | html(lang:'en') { 3 | head { 4 | meta('http-equiv':'"Content-Type" content="text/html; charset=utf-8"') 5 | title("Groovy Demo") 6 | } 7 | body { 8 | h3 ("$message") 9 | 10 | p ("Current date and time: ${new Date()}") 11 | 12 | } 13 | } -------------------------------------------------------------------------------- /spring-boot-template-engines-demo/src/main/resources/templates/thymeleaf.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Thymeleaf Demo 5 | 6 | 7 |

8 | Current date and time:

9 | 10 | 11 | -------------------------------------------------------------------------------- /spring-boot-template-engines-demo/src/main/webapp/WEB-INF/views/test.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> 2 | 3 | 4 | 5 | Sample JSP 6 | 7 | 8 |

${message}

9 |

Current date and time: <%= new java.util.Date() %>

10 | 11 | 12 | -------------------------------------------------------------------------------- /spring-boot-vaadin-demo/.gitignore: -------------------------------------------------------------------------------- 1 | /frontend 2 | */generated/* 3 | */generated-sources/* 4 | */generated-test-sources/* -------------------------------------------------------------------------------- /spring-boot-vaadin-demo/README.md: -------------------------------------------------------------------------------- 1 | # Related Tutorials 2 | 3 | * [Spring Boot and Vaadin CRUD Example](https://howtodoinjava.com/vaadin/spring-boot-and-vaadin-crud-example/) -------------------------------------------------------------------------------- /spring-boot-vaadin-demo/src/main/java/com/howtodoinjava/demo/dao/PersonRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package com.howtodoinjava.demo.dao; 7 | 8 | import com.howtodoinjava.demo.model.Person; 9 | import org.springframework.data.jpa.repository.JpaRepository; 10 | import org.springframework.stereotype.Repository; 11 | 12 | @Repository 13 | public interface PersonRepository extends JpaRepository { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /spring-boot-vaadin-demo/src/main/java/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=jdbc:h2:mem:testdb 2 | spring.datasource.driverClassName=org.h2.Driver 3 | spring.datasource.username=sa 4 | spring.datasource.password= 5 | spring.jpa.database-platform=org.hibernate.dialect.H2Dialect 6 | 7 | spring.h2.console.enabled=true 8 | -------------------------------------------------------------------------------- /spring-boot-vaadin-demo/src/test/java/com/howtodoinjava/demo/AppTest.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | public class AppTest { 8 | 9 | @Test 10 | public void contextLoads() { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /spring-boot-validate-list/src/main/java/com/howtodoinjava/app/ValidateListsApplication.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class ValidateListsApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(ValidateListsApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-boot-validate-list/src/main/java/com/howtodoinjava/app/model/Car.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package com.howtodoinjava.app.model; 7 | 8 | import jakarta.validation.constraints.Min; 9 | import lombok.AllArgsConstructor; 10 | import lombok.Data; 11 | import lombok.NoArgsConstructor; 12 | 13 | /* JSON example: 14 | { 15 | "brand": "BMW", 16 | "price": 5 17 | } 18 | */ 19 | 20 | @Data 21 | @AllArgsConstructor 22 | @NoArgsConstructor 23 | public class Car { 24 | 25 | private String brand; 26 | 27 | @Min(value = 10, message = "Price must be greater than 10") 28 | private Integer price; 29 | } 30 | -------------------------------------------------------------------------------- /spring-boot-validate-list/src/main/java/com/howtodoinjava/app/model/EmailAddress.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package com.howtodoinjava.app.model; 7 | 8 | import jakarta.validation.constraints.Email; 9 | import jakarta.validation.constraints.NotBlank; 10 | import lombok.AllArgsConstructor; 11 | import lombok.Data; 12 | import lombok.NoArgsConstructor; 13 | 14 | @Data 15 | @AllArgsConstructor 16 | @NoArgsConstructor 17 | public class EmailAddress { 18 | 19 | @NotBlank(message = "Email address must not be blank") 20 | @Email(message = "Invalid email address format") 21 | private String email; 22 | } 23 | -------------------------------------------------------------------------------- /spring-boot-validate-list/src/main/java/com/howtodoinjava/app/model/EmailRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package com.howtodoinjava.app.model; 7 | 8 | import jakarta.validation.Valid; 9 | import java.util.List; 10 | import lombok.AllArgsConstructor; 11 | import lombok.Data; 12 | import lombok.NoArgsConstructor; 13 | 14 | @Data 15 | @AllArgsConstructor 16 | @NoArgsConstructor 17 | public class EmailRequest { 18 | 19 | @Valid 20 | private List emailAddresses; 21 | } 22 | -------------------------------------------------------------------------------- /spring-boot-validate-list/src/main/java/com/howtodoinjava/app/model/User.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package com.howtodoinjava.app.model; 7 | 8 | import jakarta.validation.constraints.NotEmpty; 9 | import lombok.AllArgsConstructor; 10 | import lombok.Data; 11 | import lombok.NoArgsConstructor; 12 | 13 | @Data 14 | @AllArgsConstructor 15 | @NoArgsConstructor 16 | public class User { 17 | 18 | private String username; 19 | 20 | @NotEmpty(message = "Password cannot be empty") 21 | private String password; 22 | } 23 | -------------------------------------------------------------------------------- /spring-boot-validate-list/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /spring-boot-vuejs-jwt-auth/README.md: -------------------------------------------------------------------------------- 1 | # Related Tutorials 2 | 3 | 1. [Vue.js Application with Spring Boot](https://howtodoinjava.com/spring-boot/vuejs-app-with-spring-boot/) -------------------------------------------------------------------------------- /spring-boot-vuejs-jwt-auth/Spring-Boot-API/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /spring-boot-vuejs-jwt-auth/Spring-Boot-API/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/spring-boot-vuejs-jwt-auth/Spring-Boot-API/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /spring-boot-vuejs-jwt-auth/Spring-Boot-API/src/main/java/com/howtodoinjava/app/repository/EmployeeRepository.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app.repository; 2 | 3 | import com.howtodoinjava.app.entity.Employee; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | @Repository 8 | public interface EmployeeRepository extends JpaRepository { 9 | } 10 | 11 | -------------------------------------------------------------------------------- /spring-boot-vuejs-jwt-auth/Spring-Boot-API/src/main/java/com/howtodoinjava/app/security/dto/AuthenticationRequest.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app.security.dto; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | import lombok.NoArgsConstructor; 6 | import lombok.Setter; 7 | 8 | @AllArgsConstructor 9 | @NoArgsConstructor 10 | @Getter 11 | @Setter 12 | public class AuthenticationRequest { 13 | 14 | private String username; 15 | private String password; 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-vuejs-jwt-auth/Spring-Boot-API/src/main/java/com/howtodoinjava/app/security/dto/AuthenticationResponse.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app.security.dto; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | import lombok.NoArgsConstructor; 6 | import lombok.Setter; 7 | 8 | @Getter 9 | @Setter 10 | @AllArgsConstructor 11 | @NoArgsConstructor 12 | public class AuthenticationResponse { 13 | 14 | private String accessToken; 15 | } 16 | -------------------------------------------------------------------------------- /spring-boot-vuejs-jwt-auth/Spring-Boot-API/src/main/java/com/howtodoinjava/app/security/entity/Role.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app.security.entity; 2 | 3 | public enum Role { 4 | ADMIN,USER 5 | } 6 | -------------------------------------------------------------------------------- /spring-boot-vuejs-jwt-auth/Spring-Boot-API/src/main/java/com/howtodoinjava/app/security/repo/UserRepository.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app.security.repo; 2 | 3 | import com.howtodoinjava.app.security.entity.User; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | 6 | import java.util.Optional; 7 | 8 | public interface UserRepository extends JpaRepository { 9 | 10 | Optional findByUsername(String username); 11 | } 12 | -------------------------------------------------------------------------------- /spring-boot-vuejs-jwt-auth/Spring-Boot-API/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=9090 2 | 3 | spring.datasource.url=jdbc:h2:mem:testdb 4 | spring.datasource.driverClassName=org.h2.Driver 5 | spring.datasource.username=sa 6 | spring.datasource.password=password 7 | spring.jpa.database-platform=org.hibernate.dialect.H2Dialect 8 | spring.h2.console.enabled=true 9 | 10 | spring.main.allow-circular-references=true 11 | -------------------------------------------------------------------------------- /spring-boot-vuejs-jwt-auth/vue-app/.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | not dead 4 | not ie 11 5 | -------------------------------------------------------------------------------- /spring-boot-vuejs-jwt-auth/vue-app/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true, 5 | }, 6 | extends: [ 7 | "plugin:vue/vue3-essential", 8 | "eslint:recommended", 9 | "@vue/typescript/recommended", 10 | "plugin:prettier/recommended", 11 | ], 12 | parserOptions: { 13 | ecmaVersion: 2020, 14 | }, 15 | rules: { 16 | "no-console": process.env.NODE_ENV === "production" ? "warn" : "off", 17 | "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off", 18 | }, 19 | overrides: [ 20 | { 21 | files: [ 22 | "**/__tests__/*.{j,t}s?(x)", 23 | "**/tests/unit/**/*.spec.{j,t}s?(x)", 24 | ], 25 | env: { 26 | jest: true, 27 | }, 28 | }, 29 | ], 30 | }; 31 | -------------------------------------------------------------------------------- /spring-boot-vuejs-jwt-auth/vue-app/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | 6 | # local env files 7 | .env.local 8 | .env.*.local 9 | 10 | # Log files 11 | npm-debug.log* 12 | yarn-debug.log* 13 | yarn-error.log* 14 | pnpm-debug.log* 15 | 16 | # Editor directories and files 17 | .idea 18 | .vscode 19 | *.suo 20 | *.ntvs* 21 | *.njsproj 22 | *.sln 23 | *.sw? 24 | -------------------------------------------------------------------------------- /spring-boot-vuejs-jwt-auth/vue-app/README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Project setup 4 | ``` 5 | npm install 6 | ``` 7 | 8 | ### Compiles and hot-reloads for development 9 | ``` 10 | npm run serve 11 | ``` 12 | 13 | ### Compiles and minifies for production 14 | ``` 15 | npm run build 16 | ``` 17 | 18 | ### Run your unit tests 19 | ``` 20 | npm run test:unit 21 | ``` 22 | 23 | ### Lints and fixes files 24 | ``` 25 | npm run lint 26 | ``` 27 | 28 | ### Customize configuration 29 | See [Configuration Reference](https://cli.vuejs.org/config/). 30 | -------------------------------------------------------------------------------- /spring-boot-vuejs-jwt-auth/vue-app/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ["@vue/cli-plugin-babel/preset"], 3 | }; 4 | -------------------------------------------------------------------------------- /spring-boot-vuejs-jwt-auth/vue-app/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: "@vue/cli-plugin-unit-jest/presets/typescript-and-babel", 3 | }; 4 | -------------------------------------------------------------------------------- /spring-boot-vuejs-jwt-auth/vue-app/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/spring-boot-vuejs-jwt-auth/vue-app/public/favicon.ico -------------------------------------------------------------------------------- /spring-boot-vuejs-jwt-auth/vue-app/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= htmlWebpackPlugin.options.title %> 9 | 10 | 11 | 14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /spring-boot-vuejs-jwt-auth/vue-app/src/App.vue: -------------------------------------------------------------------------------- 1 | 5 | 6 | 16 | -------------------------------------------------------------------------------- /spring-boot-vuejs-jwt-auth/vue-app/src/assets/lofi2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/spring-boot-vuejs-jwt-auth/vue-app/src/assets/lofi2.jpeg -------------------------------------------------------------------------------- /spring-boot-vuejs-jwt-auth/vue-app/src/components/FooterPage.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 14 | 15 | 23 | -------------------------------------------------------------------------------- /spring-boot-vuejs-jwt-auth/vue-app/src/main.ts: -------------------------------------------------------------------------------- 1 | import { createApp } from "vue"; 2 | import App from "./App.vue"; 3 | import router from "./router"; 4 | import store from "./store"; 5 | 6 | createApp(App).use(store).use(router).mount("#app"); 7 | -------------------------------------------------------------------------------- /spring-boot-vuejs-jwt-auth/vue-app/src/services/AuthService.ts: -------------------------------------------------------------------------------- 1 | import apiClient from "@/utils/apiClient"; 2 | import router from "@/router"; 3 | import homeView from "@/views/HomeView.vue"; 4 | class AuthService { 5 | login = async (user: any): Promise => { 6 | return await apiClient.post("/auth/login", { 7 | username: user.username, 8 | password: user.password, 9 | }); 10 | }; 11 | logout() { 12 | window.localStorage.removeItem("jwtToken"); 13 | router.push("/login"); 14 | } 15 | } 16 | export default new AuthService(); 17 | -------------------------------------------------------------------------------- /spring-boot-vuejs-jwt-auth/vue-app/src/shims-vue.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | declare module '*.vue' { 3 | import type { DefineComponent } from 'vue' 4 | const component: DefineComponent<{}, {}, any> 5 | export default component 6 | } 7 | -------------------------------------------------------------------------------- /spring-boot-vuejs-jwt-auth/vue-app/src/store/index.ts: -------------------------------------------------------------------------------- 1 | import { createStore } from "vuex"; 2 | 3 | export default createStore({ 4 | state: {}, 5 | getters: {}, 6 | mutations: {}, 7 | actions: {}, 8 | modules: {}, 9 | }); 10 | -------------------------------------------------------------------------------- /spring-boot-vuejs-jwt-auth/vue-app/src/types/Employee.ts: -------------------------------------------------------------------------------- 1 | interface Employee { 2 | id: number; 3 | name: string; 4 | phone: string; 5 | email: string; 6 | position: string; 7 | bio: string; 8 | } 9 | export default Employee; 10 | -------------------------------------------------------------------------------- /spring-boot-vuejs-jwt-auth/vue-app/src/utils/apiClient.ts: -------------------------------------------------------------------------------- 1 | import axios, { AxiosInstance } from "axios"; 2 | 3 | const API_URL = "http://localhost:9090/api"; 4 | 5 | const axiosInstance: AxiosInstance = axios.create({ 6 | baseURL: API_URL, 7 | headers: { 8 | "Content-Type": "application/json", 9 | }, 10 | withCredentials: true, 11 | }); 12 | 13 | const token = localStorage.getItem("jwtToken"); 14 | 15 | axiosInstance.interceptors.request.use( 16 | (config) => { 17 | config.headers.Authorization = `Bearer ${token}`; 18 | return config; 19 | }, 20 | (error) => { 21 | return Promise.reject(error); 22 | } 23 | ); 24 | 25 | export default axiosInstance; 26 | -------------------------------------------------------------------------------- /spring-boot-vuejs-jwt-auth/vue-app/src/views/AboutView.vue: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /spring-boot-vuejs-jwt-auth/vue-app/tests/unit/example.spec.ts: -------------------------------------------------------------------------------- 1 | import { shallowMount } from "@vue/test-utils"; 2 | import HelloWorld from "@/components/HelloWorld.vue"; 3 | 4 | describe("HelloWorld.vue", () => { 5 | it("renders props.msg when passed", () => { 6 | const msg = "new message"; 7 | const wrapper = shallowMount(HelloWorld, { 8 | props: { msg }, 9 | }); 10 | expect(wrapper.text()).toMatch(msg); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /spring-boot-vuejs-jwt-auth/vue-app/vue.config.js: -------------------------------------------------------------------------------- 1 | const { defineConfig } = require("@vue/cli-service"); 2 | module.exports = defineConfig({ 3 | transpileDependencies: true, 4 | }); 5 | -------------------------------------------------------------------------------- /spring-boot-vuejs/README.md: -------------------------------------------------------------------------------- 1 | # Related Tutorials 2 | 3 | 1. [Vue.js Application with Spring Boot](https://howtodoinjava.com/spring-boot/vuejs-app-with-spring-boot/) -------------------------------------------------------------------------------- /spring-boot-vuejs/Spring-Boot-API/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /spring-boot-vuejs/Spring-Boot-API/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/spring-boot-vuejs/Spring-Boot-API/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /spring-boot-vuejs/Spring-Boot-API/src/main/java/com/howtodoinjava/app/EmployeeRestApiApplication.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class EmployeeRestApiApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(EmployeeRestApiApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-boot-vuejs/Spring-Boot-API/src/main/java/com/howtodoinjava/app/entity/Employee.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app.entity; 2 | 3 | import jakarta.persistence.*; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Getter; 6 | import lombok.NoArgsConstructor; 7 | import lombok.Setter; 8 | 9 | @Entity 10 | @Getter 11 | @Setter 12 | @AllArgsConstructor 13 | @NoArgsConstructor 14 | public class Employee { 15 | @Id 16 | @GeneratedValue(strategy = GenerationType.IDENTITY) 17 | private Long id; 18 | 19 | private String name; 20 | 21 | private String phone; 22 | 23 | private String email; 24 | 25 | private String position; 26 | 27 | 28 | @Column(length = 1000) 29 | private String bio; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /spring-boot-vuejs/Spring-Boot-API/src/main/java/com/howtodoinjava/app/repository/EmployeeRepository.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app.repository; 2 | 3 | import com.howtodoinjava.app.entity.Employee; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | @Repository 8 | public interface EmployeeRepository extends JpaRepository { 9 | 10 | 11 | } 12 | 13 | -------------------------------------------------------------------------------- /spring-boot-vuejs/Spring-Boot-API/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=9090 2 | -------------------------------------------------------------------------------- /spring-boot-vuejs/Spring-Boot-API/src/test/java/com/howtodoinjava/app/EmployeeRestApiApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class EmployeeRestApiApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-boot-vuejs/vue-app/.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | not dead 4 | not ie 11 5 | -------------------------------------------------------------------------------- /spring-boot-vuejs/vue-app/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true, 5 | }, 6 | extends: [ 7 | "plugin:vue/vue3-essential", 8 | "eslint:recommended", 9 | "@vue/typescript/recommended", 10 | "plugin:prettier/recommended", 11 | ], 12 | parserOptions: { 13 | ecmaVersion: 2020, 14 | }, 15 | rules: { 16 | "no-console": process.env.NODE_ENV === "production" ? "warn" : "off", 17 | "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off", 18 | }, 19 | overrides: [ 20 | { 21 | files: [ 22 | "**/__tests__/*.{j,t}s?(x)", 23 | "**/tests/unit/**/*.spec.{j,t}s?(x)", 24 | ], 25 | env: { 26 | jest: true, 27 | }, 28 | }, 29 | ], 30 | }; 31 | -------------------------------------------------------------------------------- /spring-boot-vuejs/vue-app/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | 6 | # local env files 7 | .env.local 8 | .env.*.local 9 | 10 | # Log files 11 | npm-debug.log* 12 | yarn-debug.log* 13 | yarn-error.log* 14 | pnpm-debug.log* 15 | 16 | # Editor directories and files 17 | .idea 18 | .vscode 19 | *.suo 20 | *.ntvs* 21 | *.njsproj 22 | *.sln 23 | *.sw? 24 | -------------------------------------------------------------------------------- /spring-boot-vuejs/vue-app/README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Project setup 4 | ``` 5 | npm install 6 | ``` 7 | 8 | ### Compiles and hot-reloads for development 9 | ``` 10 | npm run serve 11 | ``` 12 | 13 | ### Compiles and minifies for production 14 | ``` 15 | npm run build 16 | ``` 17 | 18 | ### Run your unit tests 19 | ``` 20 | npm run test:unit 21 | ``` 22 | 23 | ### Lints and fixes files 24 | ``` 25 | npm run lint 26 | ``` 27 | 28 | ### Customize configuration 29 | See [Configuration Reference](https://cli.vuejs.org/config/). 30 | -------------------------------------------------------------------------------- /spring-boot-vuejs/vue-app/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ["@vue/cli-plugin-babel/preset"], 3 | }; 4 | -------------------------------------------------------------------------------- /spring-boot-vuejs/vue-app/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: "@vue/cli-plugin-unit-jest/presets/typescript-and-babel", 3 | }; 4 | -------------------------------------------------------------------------------- /spring-boot-vuejs/vue-app/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/spring-boot-vuejs/vue-app/public/favicon.ico -------------------------------------------------------------------------------- /spring-boot-vuejs/vue-app/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= htmlWebpackPlugin.options.title %> 9 | 10 | 11 | 14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /spring-boot-vuejs/vue-app/src/App.vue: -------------------------------------------------------------------------------- 1 | 5 | 6 | 16 | -------------------------------------------------------------------------------- /spring-boot-vuejs/vue-app/src/assets/lofi2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/spring-boot-vuejs/vue-app/src/assets/lofi2.jpeg -------------------------------------------------------------------------------- /spring-boot-vuejs/vue-app/src/components/FooterPage.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 14 | 15 | 23 | -------------------------------------------------------------------------------- /spring-boot-vuejs/vue-app/src/main.ts: -------------------------------------------------------------------------------- 1 | import { createApp } from "vue"; 2 | import App from "./App.vue"; 3 | import router from "./router"; 4 | import store from "./store"; 5 | 6 | createApp(App).use(store).use(router).mount("#app"); 7 | -------------------------------------------------------------------------------- /spring-boot-vuejs/vue-app/src/shims-vue.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | declare module '*.vue' { 3 | import type { DefineComponent } from 'vue' 4 | const component: DefineComponent<{}, {}, any> 5 | export default component 6 | } 7 | -------------------------------------------------------------------------------- /spring-boot-vuejs/vue-app/src/store/index.ts: -------------------------------------------------------------------------------- 1 | import { createStore } from "vuex"; 2 | 3 | export default createStore({ 4 | state: {}, 5 | getters: {}, 6 | mutations: {}, 7 | actions: {}, 8 | modules: {}, 9 | }); 10 | -------------------------------------------------------------------------------- /spring-boot-vuejs/vue-app/src/types/Employee.ts: -------------------------------------------------------------------------------- 1 | interface Employee { 2 | id: number; 3 | name: string; 4 | phone: string; 5 | email: string; 6 | position: string; 7 | bio: string; 8 | } 9 | export default Employee; 10 | -------------------------------------------------------------------------------- /spring-boot-vuejs/vue-app/src/utils/apiClient.ts: -------------------------------------------------------------------------------- 1 | import axios, { AxiosInstance } from "axios"; 2 | 3 | const API_URL = "http://localhost:9090/api"; 4 | 5 | const axiosInstance: AxiosInstance = axios.create({ 6 | baseURL: API_URL, 7 | headers: { 8 | "Content-Type": "application/json", 9 | }, 10 | }); 11 | 12 | export default axiosInstance; 13 | -------------------------------------------------------------------------------- /spring-boot-vuejs/vue-app/src/views/AboutView.vue: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /spring-boot-vuejs/vue-app/tests/unit/example.spec.ts: -------------------------------------------------------------------------------- 1 | import { shallowMount } from "@vue/test-utils"; 2 | import HelloWorld from "@/components/HelloWorld.vue"; 3 | 4 | describe("HelloWorld.vue", () => { 5 | it("renders props.msg when passed", () => { 6 | const msg = "new message"; 7 | const wrapper = shallowMount(HelloWorld, { 8 | props: { msg }, 9 | }); 10 | expect(wrapper.text()).toMatch(msg); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /spring-boot-vuejs/vue-app/vue.config.js: -------------------------------------------------------------------------------- 1 | const { defineConfig } = require("@vue/cli-service"); 2 | module.exports = defineConfig({ 3 | transpileDependencies: true, 4 | }); 5 | -------------------------------------------------------------------------------- /spring-boot-xml-request-response/README.md: -------------------------------------------------------------------------------- 1 | # Related Tutorials 2 | 3 | 1. [Spring Boot REST – Handling XML Request and Response](https://howtodoinjava.com/spring-boot/xml-request-response-body/) -------------------------------------------------------------------------------- /spring-boot-xml-request-response/src/main/java/com/howtodoinjava/demo/model/Item.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.model; 2 | 3 | import jakarta.xml.bind.annotation.XmlAccessType; 4 | import jakarta.xml.bind.annotation.XmlAccessorType; 5 | import jakarta.xml.bind.annotation.XmlRootElement; 6 | import lombok.AllArgsConstructor; 7 | import lombok.Data; 8 | import lombok.NoArgsConstructor; 9 | 10 | @Data 11 | @AllArgsConstructor 12 | @NoArgsConstructor 13 | /*@JacksonXmlRootElement(localName = "item")*/ 14 | @XmlRootElement(name = "item") 15 | @XmlAccessorType(XmlAccessType.FIELD) 16 | public class Item { 17 | 18 | private Long id; 19 | private String name; 20 | } 21 | -------------------------------------------------------------------------------- /spring-boot-xml-request-response/src/test/java/com/howtodoinjava/demo/AppTest.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | public class AppTest 6 | { 7 | @Test 8 | void loadsContext(){ 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /spring-data-dynamodb/src/main/java/com/howtodoinjava/demo/repositories/MovieDetailRepository.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.repositories; 2 | 3 | import com.howtodoinjava.demo.model.MovieDetail; 4 | import org.socialsignin.spring.data.dynamodb.repository.EnableScan; 5 | import org.springframework.data.repository.CrudRepository; 6 | 7 | /** 8 | * Repository to connect with DynamoDB and fetch daya with queries from 9 | * tbl_movie_dtl 10 | */ 11 | @EnableScan 12 | public interface MovieDetailRepository 13 | extends CrudRepository { 14 | 15 | } -------------------------------------------------------------------------------- /spring-data-dynamodb/src/main/java/com/howtodoinjava/demo/service/MovieService.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.service; 2 | 3 | import com.howtodoinjava.demo.model.MovieDetail; 4 | 5 | import java.util.List; 6 | 7 | public interface MovieService { 8 | 9 | MovieDetail addMovieInfo(MovieDetail movieDetail); 10 | 11 | List fetchAllMovieDetails(); 12 | 13 | void deleteOneMovie(String id); 14 | } 15 | -------------------------------------------------------------------------------- /spring-data-dynamodb/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | aws.dynamodb.accessKey=accessKey 2 | aws.dynamodb.secretKey=secretKey 3 | aws.dynamodb.endpoint=http://localhost:8000 4 | aws.dynamodb.region=ap-south-1 5 | 6 | -------------------------------------------------------------------------------- /spring-data-redis-lettuce/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/spring-data-redis-lettuce/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /spring-data-redis-lettuce/README.md: -------------------------------------------------------------------------------- 1 | # Related Tutorials 2 | 3 | * [Spring Boot Data Redis with Lettuce and Jedis](https://howtodoinjava.com/spring-data/spring-boot-redis-with-lettuce-jedis/) -------------------------------------------------------------------------------- /spring-data-redis-lettuce/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | networks: 4 | app-tier: 5 | driver: bridge 6 | 7 | services: 8 | redis: 9 | image: 'bitnami/redis:latest' 10 | environment: 11 | - ALLOW_EMPTY_PASSWORD=yes 12 | ports: 13 | - '6379:6379' 14 | networks: 15 | - app-tier 16 | redis-sentinel: 17 | image: 'bitnami/redis-sentinel:latest' 18 | environment: 19 | - REDIS_MASTER_HOST=localhost 20 | - REDIS_SENTINEL_RESOLVE_HOSTNAMES=yes 21 | ports: 22 | - '26379:26379' 23 | networks: 24 | - app-tier -------------------------------------------------------------------------------- /spring-data-redis-lettuce/src/main/java/com/howtodoinjava/demo/SpringDataRedisLettuceApplication.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringDataRedisLettuceApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringDataRedisLettuceApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-data-redis-lettuce/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | default.redis.connection=standalone 2 | default.redis.TTL=60 3 | 4 | ## Standalone Config ## 5 | 6 | spring.data.redis.host=localhost 7 | spring.data.redis.port=6379 8 | spring.data.redis.password= 9 | spring.data.redis.timeout=3000 10 | 11 | 12 | ## Sentinel Config ## 13 | ## use attached docker compose to start redis is sentinel mode ### 14 | 15 | spring.data.redis.sentinel.master=mymaster 16 | spring.data.redis.sentinel.nodes=localhost:26379 #Comma-separated list of "host:port" pairs. 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /spring-deploy-docker-image-to-aws/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8-jdk-alpine 2 | MAINTAINER howtodoinjava.com 3 | ADD target/AWSDockerDeploy-0.0.1-SNAPSHOT.jar AWSDockerDeploy-0.0.1-SNAPSHOT.jar 4 | ENTRYPOINT ["java","-jar","AWSDockerDeploy-0.0.1-SNAPSHOT.jar"] -------------------------------------------------------------------------------- /spring-deploy-docker-image-to-aws/src/main/java/com/example/awsdockerdeploy/AwsDockerDeployApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.awsdockerdeploy; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class AwsDockerDeployApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(AwsDockerDeployApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-deploy-docker-image-to-aws/src/main/java/com/example/awsdockerdeploy/api/HomeController.java: -------------------------------------------------------------------------------- 1 | package com.example.awsdockerdeploy.api; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class HomeController { 8 | 9 | @GetMapping("/home") 10 | public String hello() { 11 | return "Project running successfully "; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /spring-deploy-docker-image-to-aws/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /spring-deploy-docker-image-to-aws/src/test/java/com/example/awsdockerdeploy/AwsDockerDeployApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.example.awsdockerdeploy; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class AwsDockerDeployApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-elasticsearch-example/docker.txt: -------------------------------------------------------------------------------- 1 | docker run -d -p 9200:9200 -e "discovery.type=single-node" -e "xpack.security.enabled=false" elasticsearch:8.8.1 2 | -------------------------------------------------------------------------------- /spring-elasticsearch-example/src/main/java/com/howtodoinjava/demo/elasticsearch/Main.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.elasticsearch; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | public static void main(String[] args) { 9 | SpringApplication.run(Main.class, args); 10 | } 11 | } -------------------------------------------------------------------------------- /spring-elasticsearch-example/src/main/java/com/howtodoinjava/demo/elasticsearch/config/ReactiveElasticsearchConfig.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.elasticsearch.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.data.elasticsearch.client.ClientConfiguration; 5 | import org.springframework.data.elasticsearch.client.elc.ReactiveElasticsearchConfiguration; 6 | 7 | //@Configuration 8 | public class ReactiveElasticsearchConfig extends ReactiveElasticsearchConfiguration { 9 | @Override 10 | public ClientConfiguration clientConfiguration() { 11 | return ClientConfiguration.builder() 12 | .connectedTo("localhost:9200") 13 | .build(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /spring-elasticsearch-example/src/main/java/com/howtodoinjava/demo/elasticsearch/entities/Employee.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.elasticsearch.entities; 2 | 3 | import lombok.Data; 4 | import org.springframework.data.annotation.Id; 5 | import org.springframework.data.elasticsearch.annotations.Document; 6 | import org.springframework.data.elasticsearch.annotations.Field; 7 | import org.springframework.data.elasticsearch.annotations.FieldType; 8 | 9 | @Data 10 | @Document(indexName = "employees") 11 | public class Employee { 12 | 13 | @Id 14 | private String employeeId; 15 | 16 | @Field(type = FieldType.Text, name = "name") 17 | private String name; 18 | 19 | @Field(type = FieldType.Long, name = "price") 20 | private long salary; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /spring-elasticsearch-example/src/main/resources/application.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/spring-elasticsearch-example/src/main/resources/application.yml -------------------------------------------------------------------------------- /spring-kafka-example/inventory-event-consumer/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | !**/src/main/**/target/ 4 | !**/src/test/**/target/ 5 | 6 | ### IntelliJ IDEA ### 7 | .idea/modules.xml 8 | .idea/jarRepositories.xml 9 | .idea/compiler.xml 10 | .idea/libraries/ 11 | *.iws 12 | *.iml 13 | *.ipr 14 | 15 | ### Eclipse ### 16 | .apt_generated 17 | .classpath 18 | .factorypath 19 | .project 20 | .settings 21 | .springBeans 22 | .sts4-cache 23 | 24 | ### NetBeans ### 25 | /nbproject/private/ 26 | /nbbuild/ 27 | /dist/ 28 | /nbdist/ 29 | /.nb-gradle/ 30 | build/ 31 | !**/src/main/**/build/ 32 | !**/src/test/**/build/ 33 | 34 | ### VS Code ### 35 | .vscode/ 36 | 37 | ### Mac OS ### 38 | .DS_Store -------------------------------------------------------------------------------- /spring-kafka-example/inventory-event-consumer/src/main/java/com/howtodoinjava/demo/kafka/consumer/Main.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.kafka.consumer; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | public static void main(String[] args) { 9 | SpringApplication.run(Main.class, args); 10 | } 11 | } -------------------------------------------------------------------------------- /spring-kafka-example/inventory-event-consumer/src/main/java/com/howtodoinjava/demo/kafka/consumer/model/InventoryEvent.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.kafka.consumer.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | @Data 9 | @AllArgsConstructor 10 | @NoArgsConstructor 11 | @Builder 12 | public class InventoryEvent { 13 | private Integer inventoryId; 14 | private InventoryEventType inventoryEventType; 15 | private Product product; 16 | } 17 | -------------------------------------------------------------------------------- /spring-kafka-example/inventory-event-consumer/src/main/java/com/howtodoinjava/demo/kafka/consumer/model/InventoryEventType.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.kafka.consumer.model; 2 | 3 | public enum InventoryEventType { 4 | NEW, 5 | UPDATE 6 | } 7 | -------------------------------------------------------------------------------- /spring-kafka-example/inventory-event-consumer/src/main/java/com/howtodoinjava/demo/kafka/consumer/model/Product.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.kafka.consumer.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | @Data 9 | @AllArgsConstructor 10 | @NoArgsConstructor 11 | @Builder 12 | public class Product { 13 | private Integer productId; 14 | private String productName; 15 | private String price; 16 | private Integer quantity; 17 | } 18 | -------------------------------------------------------------------------------- /spring-kafka-example/inventory-event-consumer/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8081 3 | 4 | spring: 5 | profiles: 6 | active: dev -------------------------------------------------------------------------------- /spring-kafka-example/inventory-event-producer/src/main/java/com/howtodoinjava/demo/kafka/producer/Main.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.kafka.producer; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | public static void main(String[] args) { 9 | SpringApplication.run(Main.class, args); 10 | } 11 | } -------------------------------------------------------------------------------- /spring-kafka-example/inventory-event-producer/src/main/java/com/howtodoinjava/demo/kafka/producer/model/InventoryEvent.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.kafka.producer.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | @Data 9 | @AllArgsConstructor 10 | @NoArgsConstructor 11 | @Builder 12 | public class InventoryEvent { 13 | private Integer inventoryId; 14 | private InventoryEventType inventoryEventType; 15 | private Product product; 16 | } 17 | -------------------------------------------------------------------------------- /spring-kafka-example/inventory-event-producer/src/main/java/com/howtodoinjava/demo/kafka/producer/model/InventoryEventType.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.kafka.producer.model; 2 | 3 | public enum InventoryEventType { 4 | NEW, 5 | UPDATE 6 | } 7 | -------------------------------------------------------------------------------- /spring-kafka-example/inventory-event-producer/src/main/java/com/howtodoinjava/demo/kafka/producer/model/Product.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.kafka.producer.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | @Data 9 | @AllArgsConstructor 10 | @NoArgsConstructor 11 | @Builder 12 | public class Product { 13 | private Integer productId; 14 | private String productName; 15 | private String price; 16 | private Integer quantity; 17 | } 18 | -------------------------------------------------------------------------------- /spring-kafka-example/inventory-event-producer/src/main/resources/application-dev.yml: -------------------------------------------------------------------------------- 1 | 2 | topic: 3 | partitions: 3 4 | replicas: 1 5 | 6 | spring: 7 | kafka: 8 | topic: library-events 9 | bootstrap-servers: localhost:9092 10 | producer: 11 | bootstrap-servers: localhost:9092 12 | key-serializer: org.apache.kafka.common.serialization.IntegerSerializer 13 | value-serializer: org.springframework.kafka.support.serializer.JsonSerializer 14 | properties: 15 | acks: all 16 | retries: 10 17 | retry.backoff.ms: 1000 18 | admin: 19 | properties: 20 | bootstrap.servers: localhost:9092 -------------------------------------------------------------------------------- /spring-kafka-example/inventory-event-producer/src/main/resources/application-prod.yml: -------------------------------------------------------------------------------- 1 | 2 | topic: 3 | partitions: 3 4 | replicas: 3 5 | 6 | spring: 7 | kafka: 8 | topic: library-events 9 | bootstrap-servers: localhost:9092,localhost:9093,localhost:9094 10 | producer: 11 | bootstrap-servers: localhost:9092,localhost:9093,localhost:9094 12 | key-serializer: org.apache.kafka.common.serialization.IntegerSerializer 13 | value-serializer: org.apache.kafka.common.serialization.StringSerializer 14 | properties: 15 | acks: all 16 | retries: 10 17 | retry.backoff.ms: 1000 18 | admin: 19 | properties: 20 | bootstrap.servers: localhost:9092,localhost:9093,localhost:9094 -------------------------------------------------------------------------------- /spring-kafka-example/inventory-event-producer/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | profiles: 3 | active: dev 4 | #To Test cluster uncomment below . 5 | # profiles: 6 | # active: prod -------------------------------------------------------------------------------- /spring-kafka-streams-example/common-models/src/main/java/com/howtodoinjava/demo/kafka/streams/models/Order.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.kafka.streams.models; 2 | 3 | import java.math.BigDecimal; 4 | 5 | public record Order(Integer orderId, 6 | String productId, 7 | BigDecimal finalAmount) { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /spring-kafka-streams-example/common-models/src/main/java/com/howtodoinjava/demo/kafka/streams/models/OrdersCountPerStoreDTO.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.kafka.streams.models; 2 | 3 | public record OrdersCountPerStoreDTO(String locationId, 4 | Long count) { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /spring-kafka-streams-example/stream-service/src/main/java/com/howtodoinjava/demo/kafka/streams/service/Main.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.kafka.streams.service; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | } -------------------------------------------------------------------------------- /spring-kafka-streams-example/stream-service/src/main/resources/application-local.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | config: 3 | activate: 4 | on-profile: local 5 | kafka: 6 | streams: 7 | bootstrap-servers: localhost:9092 8 | application-id: order-streams-app -------------------------------------------------------------------------------- /spring-kafka-streams-example/stream-service/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: order-streams-app 4 | profiles: 5 | active: local -------------------------------------------------------------------------------- /spring-mvc-angular-file-upload/angular-fileupload-frontend/.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # For the full list of supported browsers by the Angular framework, please see: 6 | # https://angular.io/guide/browser-support 7 | 8 | # You can see what browsers were selected by your queries by running: 9 | # npx browserslist 10 | 11 | last 1 Chrome version 12 | last 1 Firefox version 13 | last 2 Edge major versions 14 | last 2 Safari major versions 15 | last 2 iOS major versions 16 | Firefox ESR 17 | -------------------------------------------------------------------------------- /spring-mvc-angular-file-upload/angular-fileupload-frontend/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /spring-mvc-angular-file-upload/angular-fileupload-frontend/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # Compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | /bazel-out 8 | 9 | # Node 10 | /node_modules 11 | npm-debug.log 12 | yarn-error.log 13 | 14 | # IDEs and editors 15 | .idea/ 16 | .project 17 | .classpath 18 | .c9/ 19 | *.launch 20 | .settings/ 21 | *.sublime-workspace 22 | 23 | # Visual Studio Code 24 | .vscode/* 25 | !.vscode/settings.json 26 | !.vscode/tasks.json 27 | !.vscode/launch.json 28 | !.vscode/extensions.json 29 | .history/* 30 | 31 | # Miscellaneous 32 | /.angular/cache 33 | .sass-cache/ 34 | /connect.lock 35 | /coverage 36 | /libpeerconnection.log 37 | testem.log 38 | /typings 39 | 40 | # System files 41 | .DS_Store 42 | Thumbs.db 43 | -------------------------------------------------------------------------------- /spring-mvc-angular-file-upload/angular-fileupload-frontend/src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | import { UploadFileComponent } from './upload-file/upload-file.component'; 4 | 5 | const routes: Routes = [ 6 | { path: 'upload-file', component: UploadFileComponent }, 7 | { path: '', redirectTo: 'upload-file', pathMatch: 'full' } 8 | ]; 9 | 10 | @NgModule({ 11 | imports: [RouterModule.forRoot(routes)], 12 | exports: [RouterModule] 13 | }) 14 | export class AppRoutingModule { } 15 | -------------------------------------------------------------------------------- /spring-mvc-angular-file-upload/angular-fileupload-frontend/src/app/app.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/spring-mvc-angular-file-upload/angular-fileupload-frontend/src/app/app.component.css -------------------------------------------------------------------------------- /spring-mvc-angular-file-upload/angular-fileupload-frontend/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 11 | -------------------------------------------------------------------------------- /spring-mvc-angular-file-upload/angular-fileupload-frontend/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.css'] 7 | }) 8 | export class AppComponent { 9 | title = 'angular-fileupload-frontend'; 10 | } 11 | -------------------------------------------------------------------------------- /spring-mvc-angular-file-upload/angular-fileupload-frontend/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { HttpClientModule } from '@angular/common/http'; 2 | import { NgModule } from '@angular/core'; 3 | import { BrowserModule } from '@angular/platform-browser'; 4 | 5 | import { AppRoutingModule } from './app-routing.module'; 6 | import { AppComponent } from './app.component'; 7 | import { UploadFileComponent } from './upload-file/upload-file.component'; 8 | 9 | @NgModule({ 10 | declarations: [ 11 | AppComponent, 12 | UploadFileComponent 13 | ], 14 | imports: [ 15 | BrowserModule, 16 | AppRoutingModule, 17 | HttpClientModule 18 | ], 19 | providers: [], 20 | bootstrap: [AppComponent] 21 | }) 22 | export class AppModule { } 23 | -------------------------------------------------------------------------------- /spring-mvc-angular-file-upload/angular-fileupload-frontend/src/app/file-details.model.spec.ts: -------------------------------------------------------------------------------- 1 | import { FileDetails } from './file-details.model'; 2 | 3 | describe('FileDetails', () => { 4 | it('should create an instance', () => { 5 | expect(new FileDetails()).toBeTruthy(); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /spring-mvc-angular-file-upload/angular-fileupload-frontend/src/app/file-details.model.ts: -------------------------------------------------------------------------------- 1 | export class FileDetails { 2 | filename!: string; 3 | fileUri!: string; 4 | } 5 | -------------------------------------------------------------------------------- /spring-mvc-angular-file-upload/angular-fileupload-frontend/src/app/services/file-upload.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { FileUploadService } from './file-upload.service'; 4 | 5 | describe('FileUploadService', () => { 6 | let service: FileUploadService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(FileUploadService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /spring-mvc-angular-file-upload/angular-fileupload-frontend/src/app/services/file-upload.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { FileDetails } from '../file-details.model'; 5 | 6 | @Injectable({ 7 | providedIn: 'root' 8 | }) 9 | export class FileUploadService { 10 | 11 | private basUrl = "http://localhost:8080" 12 | 13 | constructor(private httpClient: HttpClient) { 14 | 15 | } 16 | 17 | upload(file: File): Observable { 18 | const formData: FormData = new FormData(); 19 | formData.append('file', file); 20 | 21 | return this.httpClient.post(`${this.basUrl}/simple-form-upload-mvc`, formData); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /spring-mvc-angular-file-upload/angular-fileupload-frontend/src/app/upload-file/upload-file.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/spring-mvc-angular-file-upload/angular-fileupload-frontend/src/app/upload-file/upload-file.component.css -------------------------------------------------------------------------------- /spring-mvc-angular-file-upload/angular-fileupload-frontend/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/spring-mvc-angular-file-upload/angular-fileupload-frontend/src/assets/.gitkeep -------------------------------------------------------------------------------- /spring-mvc-angular-file-upload/angular-fileupload-frontend/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /spring-mvc-angular-file-upload/angular-fileupload-frontend/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/spring-mvc-angular-file-upload/angular-fileupload-frontend/src/favicon.ico -------------------------------------------------------------------------------- /spring-mvc-angular-file-upload/angular-fileupload-frontend/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AngularFileuploadFrontend 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /spring-mvc-angular-file-upload/angular-fileupload-frontend/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /spring-mvc-angular-file-upload/angular-fileupload-frontend/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /spring-mvc-angular-file-upload/angular-fileupload-frontend/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": [ 9 | "src/main.ts", 10 | "src/polyfills.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /spring-mvc-angular-file-upload/angular-fileupload-frontend/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/spec", 6 | "types": [ 7 | "jasmine" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /spring-mvc-angular-file-upload/springboot-3-mvc-file-upload/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | !**/src/main/**/target/ 4 | !**/src/test/**/target/ 5 | 6 | ### IntelliJ IDEA ### 7 | .idea/modules.xml 8 | .idea/jarRepositories.xml 9 | .idea/compiler.xml 10 | .idea/libraries/ 11 | *.iws 12 | *.iml 13 | *.ipr 14 | 15 | ### Eclipse ### 16 | .apt_generated 17 | .classpath 18 | .factorypath 19 | .project 20 | .settings 21 | .springBeans 22 | .sts4-cache 23 | 24 | ### NetBeans ### 25 | /nbproject/private/ 26 | /nbbuild/ 27 | /dist/ 28 | /nbdist/ 29 | /.nb-gradle/ 30 | build/ 31 | !**/src/main/**/build/ 32 | !**/src/test/**/build/ 33 | 34 | ### VS Code ### 35 | .vscode/ 36 | 37 | ### Mac OS ### 38 | .DS_Store -------------------------------------------------------------------------------- /spring-mvc-angular-file-upload/springboot-3-mvc-file-upload/src/main/java/com/howtodoinjava/App.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class App 8 | { 9 | public static void main(String[] args) { 10 | SpringApplication.run(App.class, args); 11 | } 12 | } -------------------------------------------------------------------------------- /spring-mvc-angular-file-upload/springboot-3-mvc-file-upload/src/main/java/com/howtodoinjava/app/config/WebFuxConfig.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app.config; 2 | 3 | import com.fasterxml.jackson.databind.ObjectMapper; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.http.MediaType; 7 | import org.springframework.http.codec.ServerCodecConfigurer; 8 | import org.springframework.http.codec.json.Jackson2JsonDecoder; 9 | import org.springframework.http.codec.json.Jackson2JsonEncoder; 10 | import org.springframework.web.reactive.config.WebFluxConfigurer; 11 | 12 | @Configuration 13 | public class WebFuxConfig implements WebFluxConfigurer { 14 | 15 | } -------------------------------------------------------------------------------- /spring-mvc-angular-file-upload/springboot-3-mvc-file-upload/src/main/resources/spring.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/spring-mvc-angular-file-upload/springboot-3-mvc-file-upload/src/main/resources/spring.png -------------------------------------------------------------------------------- /spring-react-file-upload/SpringBootFileUploadApplication/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /spring-react-file-upload/SpringBootFileUploadApplication/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/spring-react-file-upload/SpringBootFileUploadApplication/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /spring-react-file-upload/SpringBootFileUploadApplication/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar 3 | -------------------------------------------------------------------------------- /spring-react-file-upload/SpringBootFileUploadApplication/src/main/java/com/boot/rest/base/Application.java: -------------------------------------------------------------------------------- 1 | package com.boot.rest.base; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; 6 | 7 | @SpringBootApplication 8 | public class Application extends SpringBootServletInitializer { 9 | 10 | public static void main(String[] args) { 11 | SpringApplication.run(Application.class, args); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /spring-react-file-upload/SpringBootFileUploadApplication/src/main/java/com/boot/rest/base/exception/FileNotSupportedException.java: -------------------------------------------------------------------------------- 1 | package com.boot.rest.base.exception; 2 | 3 | public class FileNotSupportedException extends RuntimeException { 4 | 5 | private static final long serialVersionUID = 1L; 6 | 7 | public FileNotSupportedException(String message) { 8 | super(message); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /spring-react-file-upload/SpringBootFileUploadApplication/src/main/java/com/boot/rest/base/payload/FileUploadResponse.java: -------------------------------------------------------------------------------- 1 | package com.boot.rest.base.payload; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @AllArgsConstructor 9 | @NoArgsConstructor 10 | public class FileUploadResponse { 11 | 12 | private int id; 13 | private String fileName; 14 | private String fileUri; 15 | private String fileDownloadUri; 16 | private long fileSize; 17 | private String uploaderName; 18 | } 19 | -------------------------------------------------------------------------------- /spring-react-file-upload/SpringBootFileUploadApplication/src/main/java/com/boot/rest/base/repository/FileDetailsRepository.java: -------------------------------------------------------------------------------- 1 | package com.boot.rest.base.repository; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | 5 | import com.boot.rest.base.model.FileDetails; 6 | 7 | public interface FileDetailsRepository extends JpaRepository { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /spring-react-file-upload/react-fileupload-frontend/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /spring-react-file-upload/react-fileupload-frontend/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/spring-react-file-upload/react-fileupload-frontend/public/favicon.ico -------------------------------------------------------------------------------- /spring-react-file-upload/react-fileupload-frontend/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/spring-react-file-upload/react-fileupload-frontend/public/logo192.png -------------------------------------------------------------------------------- /spring-react-file-upload/react-fileupload-frontend/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/spring-react-file-upload/react-fileupload-frontend/public/logo512.png -------------------------------------------------------------------------------- /spring-react-file-upload/react-fileupload-frontend/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /spring-react-file-upload/react-fileupload-frontend/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /spring-react-file-upload/react-fileupload-frontend/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | height: 40vmin; 7 | pointer-events: none; 8 | } 9 | 10 | @media (prefers-reduced-motion: no-preference) { 11 | .App-logo { 12 | animation: App-logo-spin infinite 20s linear; 13 | } 14 | } 15 | 16 | .App-header { 17 | background-color: #282c34; 18 | min-height: 100vh; 19 | display: flex; 20 | flex-direction: column; 21 | align-items: center; 22 | justify-content: center; 23 | font-size: calc(10px + 2vmin); 24 | color: white; 25 | } 26 | 27 | .App-link { 28 | color: #61dafb; 29 | } 30 | 31 | @keyframes App-logo-spin { 32 | from { 33 | transform: rotate(0deg); 34 | } 35 | to { 36 | transform: rotate(360deg); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /spring-react-file-upload/react-fileupload-frontend/src/App.test.js: -------------------------------------------------------------------------------- 1 | import { render, screen } from '@testing-library/react'; 2 | import App from './App'; 3 | 4 | test('renders learn react link', () => { 5 | render(); 6 | const linkElement = screen.getByText(/learn react/i); 7 | expect(linkElement).toBeInTheDocument(); 8 | }); 9 | -------------------------------------------------------------------------------- /spring-react-file-upload/react-fileupload-frontend/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /spring-react-file-upload/react-fileupload-frontend/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom/client'; 3 | import './index.css'; 4 | import App from './App'; 5 | import reportWebVitals from './reportWebVitals'; 6 | import 'bootstrap/dist/css/bootstrap.min.css' 7 | 8 | const root = ReactDOM.createRoot(document.getElementById('root')); 9 | root.render( 10 | 11 | 12 | 13 | ); 14 | 15 | // If you want to start measuring performance in your app, pass a function 16 | // to log results (for example: reportWebVitals(console.log)) 17 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 18 | reportWebVitals(); 19 | -------------------------------------------------------------------------------- /spring-react-file-upload/react-fileupload-frontend/src/reportWebVitals.js: -------------------------------------------------------------------------------- 1 | const reportWebVitals = onPerfEntry => { 2 | if (onPerfEntry && onPerfEntry instanceof Function) { 3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 4 | getCLS(onPerfEntry); 5 | getFID(onPerfEntry); 6 | getFCP(onPerfEntry); 7 | getLCP(onPerfEntry); 8 | getTTFB(onPerfEntry); 9 | }); 10 | } 11 | }; 12 | 13 | export default reportWebVitals; 14 | -------------------------------------------------------------------------------- /spring-react-file-upload/react-fileupload-frontend/src/services/FileService.js: -------------------------------------------------------------------------------- 1 | import axios from "axios" 2 | 3 | const BASE_URL = "http://localhost:8080/file" 4 | 5 | class FileService { 6 | getAllImages() { 7 | return axios.get(BASE_URL); 8 | } 9 | 10 | uploadImage(fileFormData){ 11 | return axios.post(BASE_URL+'/upload', fileFormData); 12 | } 13 | } 14 | 15 | export default new FileService(); -------------------------------------------------------------------------------- /spring-react-file-upload/react-fileupload-frontend/src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | -------------------------------------------------------------------------------- /spring-redis-pubsub/common-events-model/src/main/java/com/howtodoinjava/demo/model/OrderEvent.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | import java.io.Serializable; 9 | 10 | @Data 11 | @NoArgsConstructor 12 | @AllArgsConstructor 13 | @Builder 14 | public class OrderEvent implements Serializable { 15 | 16 | private String orderId; 17 | private String userId; 18 | private String productName; 19 | private int price; 20 | private int quantity; 21 | } 22 | -------------------------------------------------------------------------------- /spring-redis-pubsub/order-events-publisher/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | !**/src/main/**/target/ 4 | !**/src/test/**/target/ 5 | 6 | ### IntelliJ IDEA ### 7 | .idea/modules.xml 8 | .idea/jarRepositories.xml 9 | .idea/compiler.xml 10 | .idea/libraries/ 11 | *.iws 12 | *.iml 13 | *.ipr 14 | 15 | ### Eclipse ### 16 | .apt_generated 17 | .classpath 18 | .factorypath 19 | .project 20 | .settings 21 | .springBeans 22 | .sts4-cache 23 | 24 | ### NetBeans ### 25 | /nbproject/private/ 26 | /nbbuild/ 27 | /dist/ 28 | /nbdist/ 29 | /.nb-gradle/ 30 | build/ 31 | !**/src/main/**/build/ 32 | !**/src/test/**/build/ 33 | 34 | ### VS Code ### 35 | .vscode/ 36 | 37 | ### Mac OS ### 38 | .DS_Store -------------------------------------------------------------------------------- /spring-redis-pubsub/order-events-publisher/src/main/java/com/howtodoinjava/demo/publisher/OrderEventsPublisherApplication.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.publisher; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class OrderEventsPublisherApplication { 8 | public static void main(String[] args) { 9 | SpringApplication.run(OrderEventsPublisherApplication.class, args); 10 | } 11 | } -------------------------------------------------------------------------------- /spring-redis-pubsub/order-events-publisher/src/main/java/com/howtodoinjava/demo/publisher/pubsub/config/RedisConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.publisher.pubsub.config; 2 | 3 | import org.springframework.beans.factory.annotation.Value; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.data.redis.listener.ChannelTopic; 7 | 8 | @Configuration 9 | public class RedisConfiguration { 10 | 11 | @Value("${redis.pubsub.topic}") 12 | private String redisPubSubTopic; 13 | 14 | @Bean 15 | public ChannelTopic topic() { 16 | return new ChannelTopic(redisPubSubTopic); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /spring-redis-pubsub/order-events-publisher/src/main/java/com/howtodoinjava/demo/publisher/pubsub/service/OrderService.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.publisher.pubsub.service; 2 | 3 | import com.howtodoinjava.demo.model.OrderEvent; 4 | 5 | public interface OrderService { 6 | 7 | Long publish(OrderEvent orderEvent); 8 | } 9 | -------------------------------------------------------------------------------- /spring-redis-pubsub/order-events-publisher/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8080 2 | redis.pubsub.topic=order-events 3 | redis.pubsub.topic.reactive=order-events-reactive 4 | stream.key=purchase-events 5 | 6 | spring.data.redis.host=localhost 7 | spring.data.redis.port=6379 8 | -------------------------------------------------------------------------------- /spring-redis-pubsub/order-events-subscriber/src/main/java/com/howtodoinjava/demo/subscriber/Main.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.subscriber; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | public static void main(String[] args) { 9 | SpringApplication.run(Main.class, args); 10 | } 11 | } -------------------------------------------------------------------------------- /spring-redis-pubsub/order-events-subscriber/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8082 2 | redis.pubsub.topic=order-events 3 | 4 | spring.data.redis.host=localhost 5 | spring.data.redis.port=6379 6 | -------------------------------------------------------------------------------- /spring-redis-streams/README.md: -------------------------------------------------------------------------------- 1 | # Related Tutorials 2 | 3 | * [Stream Processing with Redis and Spring Boot Data](https://howtodoinjava.com/spring-data/redis-streams-processing/) -------------------------------------------------------------------------------- /spring-redis-streams/common-event-model/src/main/java/com/howtodoinjava/demo/redis/streams/model/PurchaseEvent.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.redis.streams.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | @Data 9 | @AllArgsConstructor 10 | @NoArgsConstructor 11 | @Builder 12 | public class PurchaseEvent { 13 | 14 | private String purchaseId; 15 | private String productId; 16 | private String productName; 17 | private int price; 18 | private int quantity; 19 | } 20 | -------------------------------------------------------------------------------- /spring-redis-streams/stream-event-consumer/src/main/java/com/howtodoinjava/demo/redis/streams/consumer/RedisStreamEventConsumer.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.redis.streams.consumer; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class RedisStreamEventConsumer { 8 | public static void main(String[] args) { 9 | SpringApplication.run(RedisStreamEventConsumer.class, args); 10 | } 11 | } -------------------------------------------------------------------------------- /spring-redis-streams/stream-event-consumer/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8082 2 | stream.key=purchase-events 3 | -------------------------------------------------------------------------------- /spring-redis-streams/stream-event-producer/src/main/java/com/howtodoinjava/demo/redis/streams/producer/RedisStreamEventProducer.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.demo.redis.streams.producer; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class RedisStreamEventProducer { 8 | public static void main(String[] args) { 9 | SpringApplication.run(RedisStreamEventProducer.class, args); 10 | } 11 | } -------------------------------------------------------------------------------- /spring-redis-streams/stream-event-producer/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | stream.key=purchase-events -------------------------------------------------------------------------------- /spring-security-authentication-aws-cognito/AWSCognitoBasicAuthentication/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/spring-security-authentication-aws-cognito/AWSCognitoBasicAuthentication/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /spring-security-authentication-aws-cognito/AWSCognitoBasicAuthentication/src/main/java/com/oauth2/cognito/demo/base/AwsCognitoBasicAuthenticationApplication.java: -------------------------------------------------------------------------------- 1 | package com.oauth2.cognito.demo.base; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class AwsCognitoBasicAuthenticationApplication { 8 | public static void main(String[] args) { 9 | SpringApplication.run(AwsCognitoBasicAuthenticationApplication.class, args); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /spring-security-authentication-aws-cognito/AWSCognitoBasicAuthentication/src/main/resources/templates/greeting.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Greeting 7 | 12 | 13 | 14 |

15 |
16 | 17 |
18 | 19 | -------------------------------------------------------------------------------- /spring-security-authentication-aws-cognito/AWSCognitoBasicAuthentication/src/main/resources/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Index 7 | 12 | 13 | 14 |

15 |
16 | 17 |
18 | 19 | -------------------------------------------------------------------------------- /spring-security-authentication-aws-cognito/AWSCognitoBasicAuthentication/src/test/java/com/oauth2/cognito/demo/base/AwsCognitoBasicAuthenticationApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.oauth2.cognito.demo.base; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class AwsCognitoBasicAuthenticationApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-security-authentication-aws-cognito/AddUserToUserGroup/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/spring-security-authentication-aws-cognito/AddUserToUserGroup/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /spring_boot_elastic-beanstalk-aws/.elasticbeanstalk/config.yml: -------------------------------------------------------------------------------- 1 | branch-defaults: 2 | default: 3 | environment: spring-boot-app-qa-env 4 | group_suffix: null 5 | deploy: 6 | artifact: target/spring_boot_elastic-beanstalk-aws.jar 7 | global: 8 | application_name: spring_boot_elastic-beanstalk-aws 9 | branch: null 10 | default_ec2_keyname: eb-howtodoinjava 11 | default_platform: Corretto 17 running on 64bit Amazon Linux 2 12 | default_region: us-east-1 13 | include_git_submodules: true 14 | instance_profile: null 15 | platform_name: null 16 | platform_version: null 17 | profile: eb-cli 18 | repository: null 19 | sc: null 20 | workspace_type: Application 21 | option_settings: 22 | aws:autoscaling:asg: 23 | MinSize: '2' 24 | MaxSize: '4' 25 | -------------------------------------------------------------------------------- /spring_boot_elastic-beanstalk-aws/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /spring_boot_elastic-beanstalk-aws/src/main/java/com/howtodoinjava/app/entity/Employee.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app.entity; 2 | 3 | import jakarta.persistence.Entity; 4 | import jakarta.persistence.GeneratedValue; 5 | import jakarta.persistence.GenerationType; 6 | import jakarta.persistence.Id; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Getter; 9 | import lombok.NoArgsConstructor; 10 | import lombok.Setter; 11 | 12 | @Entity 13 | @Getter 14 | @Setter 15 | @AllArgsConstructor 16 | @NoArgsConstructor 17 | public class Employee { 18 | @Id 19 | @GeneratedValue(strategy = GenerationType.IDENTITY) 20 | private Long id ; 21 | private String name ; 22 | 23 | private String job ; 24 | } 25 | -------------------------------------------------------------------------------- /spring_boot_elastic-beanstalk-aws/src/main/java/com/howtodoinjava/app/repo/EmployeeRepo.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app.repo; 2 | 3 | import com.howtodoinjava.app.entity.Employee; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | @Repository 8 | public interface EmployeeRepo extends JpaRepository { 9 | } 10 | -------------------------------------------------------------------------------- /spring_boot_elastic-beanstalk-aws/src/main/java/com/howtodoinjava/app/service/EmployeeService.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app.service; 2 | 3 | import com.howtodoinjava.app.entity.Employee; 4 | import com.howtodoinjava.app.repo.EmployeeRepo; 5 | import java.util.List; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | 10 | @Service 11 | public class EmployeeService { 12 | 13 | @Autowired 14 | private EmployeeRepo employeeRepository; 15 | 16 | public List getAllEmployees() { 17 | return employeeRepository.findAll(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /spring_boot_elastic-beanstalk-aws/src/main/resources/application-dev.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=jdbc:h2:mem:testdb 2 | spring.datasource.driverClassName=org.h2.Driver 3 | spring.datasource.username=sa 4 | spring.datasource.password= 5 | spring.jpa.database-platform=org.hibernate.dialect.H2Dialect -------------------------------------------------------------------------------- /spring_boot_elastic-beanstalk-aws/src/main/resources/application-prod.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=jdbc:postgresql://database-1.cyajlbwfvrqi.us-east-1.rds.amazonaws.com:5432/howtodoinjava 2 | spring.datasource.username=postgres 3 | spring.datasource.password=Hnas2018 4 | spring.datasource.driver-class-name=org.postgresql.Driver 5 | spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect 6 | spring.jpa.hibernate.ddl-auto=create -------------------------------------------------------------------------------- /spring_boot_elastic-beanstalk-aws/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.profiles.active=dev -------------------------------------------------------------------------------- /spring_boot_elastic-beanstalk-aws/src/test/java/com/howtodoinjava/app/SpringBootElasticBeanstalkAwsApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.app; 2 | 3 | import org.junit.jupiter.api.Disabled; 4 | import org.junit.jupiter.api.Test; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | 7 | @SpringBootTest 8 | class SpringBootElasticBeanstalkAwsApplicationTests { 9 | 10 | @Disabled 11 | @Test 12 | void contextLoads() { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /springboot-graphql-main/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-graphql-main/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/springboot-graphql-main/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /springboot-graphql-main/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar 3 | -------------------------------------------------------------------------------- /springboot-graphql-main/src/main/java/com/howtodoinjava/graphql/GraphqlApplication.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.graphql; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class GraphqlApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(GraphqlApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-graphql-main/src/main/java/com/howtodoinjava/graphql/dto/Author.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.graphql.dto; 2 | 3 | public class Author { 4 | 5 | String name; 6 | 7 | public Author(String name) { 8 | super(); 9 | this.name = name; 10 | } 11 | 12 | public Author() { 13 | super(); 14 | } 15 | 16 | public String getName() { 17 | return name; 18 | } 19 | 20 | public void setName(String name) { 21 | this.name = name; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /springboot-graphql-main/src/main/java/com/howtodoinjava/graphql/repository/GraphQLBookRepository.java: -------------------------------------------------------------------------------- 1 | 2 | package com.howtodoinjava.graphql.repository; 3 | 4 | //@GraphQlRepository 5 | public interface GraphQLBookRepository /* extends CrudRepository, QuerydslPredicateExecutor */{ 6 | 7 | 8 | 9 | } 10 | -------------------------------------------------------------------------------- /springboot-graphql-main/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.graphql.graphiql.enabled=true 2 | 3 | -------------------------------------------------------------------------------- /springboot-graphql-main/src/main/resources/graphql/schema.graphqls: -------------------------------------------------------------------------------- 1 | type Book { 2 | id: ID! 3 | title: String 4 | pages: Int 5 | author: Author 6 | } 7 | 8 | type Author { 9 | name: String 10 | } 11 | 12 | type Query { 13 | allBooks: [Book] 14 | bookById(id: ID!): Book 15 | } 16 | 17 | type Mutation{ 18 | updateBook(id: ID!, title: String): Book 19 | } -------------------------------------------------------------------------------- /springboot-graphql-main/src/test/java/com/howtodoinjava/graphql/GraphqlApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.graphql; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class GraphqlApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /thymeleaf-upload-display-images/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /thymeleaf-upload-display-images/src/main/java/com/howtodoinjava/Application.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Application.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /thymeleaf-upload-display-images/src/main/java/com/howtodoinjava/ServletInitializer.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava; 2 | 3 | import org.springframework.boot.builder.SpringApplicationBuilder; 4 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; 5 | 6 | public class ServletInitializer extends SpringBootServletInitializer { 7 | 8 | @Override 9 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { 10 | return application.sources(Application.class); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /thymeleaf-upload-display-images/src/main/java/com/howtodoinjava/exceptions/HandleSizeLimitExceededException.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.exceptions; 2 | 3 | import org.apache.tomcat.util.http.fileupload.impl.SizeLimitExceededException; 4 | import org.springframework.ui.Model; 5 | import org.springframework.web.bind.annotation.ControllerAdvice; 6 | import org.springframework.web.bind.annotation.ExceptionHandler; 7 | 8 | @ControllerAdvice 9 | public class HandleSizeLimitExceededException { 10 | 11 | @ExceptionHandler(SizeLimitExceededException.class) 12 | public String handle(Model model, SizeLimitExceededException exception) { 13 | 14 | model.addAttribute("message", "File size limit exceeded!"); 15 | return "upload"; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /thymeleaf-upload-display-images/src/main/java/com/howtodoinjava/repository/ProfileRepository.java: -------------------------------------------------------------------------------- 1 | package com.howtodoinjava.repository; 2 | 3 | import com.howtodoinjava.model.Profile; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | 6 | public interface ProfileRepository extends JpaRepository { 7 | } 8 | -------------------------------------------------------------------------------- /thymeleaf-upload-display-images/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8080 2 | 3 | spring.datasource.driver-class-name=org.postgresql.Driver 4 | spring.datasource.url=jdbc:postgresql://localhost:5432/profilesdb 5 | spring.datasource.username=postgres 6 | spring.datasource.password=root 7 | spring.jpa.hibernate.ddl-auto=update 8 | spring.jpa.show-sql=true 9 | spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect 10 | 11 | logging.level.org.springframework=info 12 | logging.level.org.hibernate=info 13 | 14 | spring.servlet.multipart.max-file-size=2MB 15 | spring.servlet.multipart.max-request-size=2MB -------------------------------------------------------------------------------- /thymeleaf-upload-display-images/src/main/resources/static/images/email.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /thymeleaf-upload-display-images/src/main/resources/static/images/link.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /thymeleaf-upload-display-images/src/main/resources/static/images/tick.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /thymeleaf-upload-display-images/src/main/resources/static/private/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lokeshgupta1981/Spring-Boot-Examples/a555a4a912f005387e58ada4530cff9f327bbbc3/thymeleaf-upload-display-images/src/main/resources/static/private/logo.png -------------------------------------------------------------------------------- /thymeleaf-upload-display-images/src/main/resources/templates/fragments/footer.html: -------------------------------------------------------------------------------- 1 | --------------------------------------------------------------------------------