├── Demo-Project ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ └── demo │ │ │ ├── DemoProjectApplication.java │ │ │ ├── controller │ │ │ └── EmployeeController.java │ │ │ ├── dao │ │ │ ├── EmployeeDAO.java │ │ │ └── EmployeeDAOImpl.java │ │ │ ├── model │ │ │ └── Employee.java │ │ │ └── service │ │ │ └── EmployeeService.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── demo │ └── DemoProjectApplicationTests.java ├── Docker-Compose-Demo ├── department-service │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── Dockerfile │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── dailycodebuffer │ │ │ │ └── departmentservice │ │ │ │ ├── Department.java │ │ │ │ ├── DepartmentController.java │ │ │ │ ├── DepartmentServiceApplication.java │ │ │ │ └── User.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── dailycodebuffer │ │ └── departmentservice │ │ └── DepartmentServiceApplicationTests.java ├── docker-compose.override.yml ├── docker-compose.yml └── user-service │ ├── .gitignore │ ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties │ ├── Dockerfile │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ ├── Initializer.java │ │ │ ├── User.java │ │ │ ├── UserController.java │ │ │ ├── UserRepository.java │ │ │ └── UserServiceApplication.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── UserServiceApplicationTests.java ├── DynanoDb-SpringBoot-Demo ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ ├── DynanoDbSpringBootDemoApplication.java │ │ │ ├── config │ │ │ └── DynamoDbConfiguration.java │ │ │ ├── controller │ │ │ └── EmployeeController.java │ │ │ ├── entity │ │ │ ├── Department.java │ │ │ └── Employee.java │ │ │ └── repository │ │ │ └── EmployeeRepository.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── DynanoDbSpringBootDemoApplicationTests.java ├── Eureka HA ├── eureka-client-app │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── dailycodebuffer │ │ │ │ └── eurekaclientapp │ │ │ │ └── EurekaClientAppApplication.java │ │ └── resources │ │ │ ├── application.properties │ │ │ └── application.yml │ │ └── test │ │ └── java │ │ └── com │ │ └── dailycodebuffer │ │ └── eurekaclientapp │ │ └── EurekaClientAppApplicationTests.java └── spring-registry-server │ ├── .gitignore │ ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ └── springregistryserver │ │ │ └── SpringRegistryServerApplication.java │ └── resources │ │ ├── application.properties │ │ └── application.yml │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── springregistryserver │ └── SpringRegistryServerApplicationTests.java ├── JWT-Demo ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ └── jwt │ │ │ ├── JwtDemoApplication.java │ │ │ ├── config │ │ │ └── SecurityConfiguration.java │ │ │ ├── controller │ │ │ └── HomeController.java │ │ │ ├── filter │ │ │ └── JwtFilter.java │ │ │ ├── model │ │ │ ├── JwtRequest.java │ │ │ └── JwtResponse.java │ │ │ ├── service │ │ │ └── UserService.java │ │ │ └── utility │ │ │ └── JWTUtility.java │ └── resources │ │ ├── application.properties │ │ └── application.yml │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── jwt │ └── JwtDemoApplicationTests.java ├── JaCoCo-Demo ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ ├── JaCoCoDemoApplication.java │ │ │ └── Messages.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── dailycodebuffer │ ├── JaCoCoDemoApplicationTests.java │ └── TestMessages.java ├── Jenkins-PIpeline-Demo ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── Dockerfile ├── Jenkinsfile ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ ├── Book.java │ │ │ ├── BookController.java │ │ │ ├── BookIdMismatchException.java │ │ │ ├── BookNotFoundException.java │ │ │ ├── BookRepository.java │ │ │ ├── JenkinsPIpelineDemoApplication.java │ │ │ ├── RestExceptionHandler.java │ │ │ └── SimpleController.java │ └── resources │ │ ├── application.properties │ │ └── templates │ │ ├── error.html │ │ └── home.html │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── JenkinsPIpelineDemoApplicationTests.java ├── Kotlin Demo └── Kotlin-Demo │ ├── .gitignore │ ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ ├── main │ ├── kotlin │ │ └── com │ │ │ └── dailycodebuffer │ │ │ ├── Controller.kt │ │ │ ├── Entities.kt │ │ │ ├── KotlinDemoApplication.kt │ │ │ └── Repositories.kt │ └── resources │ │ └── application.properties │ └── test │ └── kotlin │ └── com │ └── dailycodebuffer │ ├── IntegrationTest.kt │ └── KotlinDemoApplicationTests.kt ├── LICENSE ├── README.md ├── SQS-SpringBoot ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ ├── SqsSpringBootApplication.java │ │ │ └── configuration │ │ │ ├── AmazonSQSConfiguration.java │ │ │ └── controller │ │ │ └── SQSController.java │ └── resources │ │ ├── application.properties │ │ └── application.yml │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── SqsSpringBootApplicationTests.java ├── Spring-Boot-Custom-Banner ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ └── example │ │ │ └── SpringBootCustomBanner │ │ │ ├── MyCustomBanner.java │ │ │ └── SpringBootCustomBannerApplication.java │ └── resources │ │ ├── application.properties │ │ ├── banner.png │ │ └── banner.txt │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── example │ └── SpringBootCustomBanner │ └── SpringBootCustomBannerApplicationTests.java ├── Spring-Boot-Custom-Parent ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ └── example │ │ │ └── SpringBootCustomParent │ │ │ └── SpringBootCustomParentApplication.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── example │ └── SpringBootCustomParent │ └── SpringBootCustomParentApplicationTests.java ├── Spring-Boot-Dev-Tools ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ ├── HomeController.java │ │ │ └── SpringBootDevToolsApplication.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── SpringBootDevToolsApplicationTests.java ├── Spring-Boot-Error-Handle ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ └── example │ │ │ └── SpringBootErrorHandle │ │ │ ├── SpringBootErrorHandleApplication.java │ │ │ └── controller │ │ │ ├── CustomErrorController.java │ │ │ └── MyController.java │ └── resources │ │ ├── application.properties │ │ └── templates │ │ ├── customError.html │ │ ├── error.html │ │ └── homePage.html │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── example │ └── SpringBootErrorHandle │ └── SpringBootErrorHandleApplicationTests.java ├── Spring-Boot-Exit-Code ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ └── example │ │ │ └── SpringBootExitCode │ │ │ └── SpringBootExitCodeApplication.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── example │ └── SpringBootExitCode │ └── SpringBootExitCodeApplicationTests.java ├── Spring-Boot-Main-Class ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebufffer │ │ │ └── example │ │ │ └── SpringBootMainClass │ │ │ ├── SpringBootMainClassApplication.java │ │ │ ├── SpringBootMainClassApplication2.java │ │ │ ├── configuration │ │ │ └── ApplicationConfig.java │ │ │ ├── controller │ │ │ ├── FilterExampleController.java │ │ │ └── HomeController.java │ │ │ └── filter │ │ │ ├── CustomFilter.java │ │ │ └── MyCustomFilter.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── dailycodebufffer │ └── example │ └── SpringBootMainClass │ └── SpringBootMainClassApplicationTests.java ├── Spring-Boot-Maven-Deploy ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ ├── HomeController.java │ │ │ ├── ServletInitializer.java │ │ │ └── SpringBootMavenDeployApplication.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── SpringBootMavenDeployApplicationTests.java ├── Spring-Boot-Mustache-Demo ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ ├── SpringBootMustacheDemoApplication.java │ │ │ ├── controller │ │ │ └── BookController.java │ │ │ └── model │ │ │ └── Book.java │ └── resources │ │ ├── application.properties │ │ └── templates │ │ ├── book.mustache │ │ ├── footer.mustache │ │ └── header.mustache │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── SpringBootMustacheDemoApplicationTests.java ├── Spring-Boot-Servlet ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ └── example │ │ │ └── SpringBootServlet │ │ │ └── SpringBootServletApplication.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── example │ └── SpringBootServlet │ └── SpringBootServletApplicationTests.java ├── Spring-Boot-Shutdown ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ └── example │ │ │ └── SpringBootShutdown │ │ │ ├── SpringBootShutdownApplication.java │ │ │ └── config │ │ │ └── ApplicationConfig.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── example │ └── SpringBootShutdown │ └── SpringBootShutdownApplicationTests.java ├── Spring-Boot-Tutorial ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ └── examples │ │ │ └── SpringBootTutorial │ │ │ ├── ConfigurationProperties │ │ │ ├── SpringBootConfigurationPropertiesApplication.java │ │ │ ├── properties │ │ │ │ ├── ApplicationProperties.java │ │ │ │ ├── BeanConfigProperties.java │ │ │ │ ├── BookConverter.java │ │ │ │ ├── GenericConfigProperties.java │ │ │ │ ├── GenericProperties.java │ │ │ │ ├── GlobalApplicationProperties.java │ │ │ │ ├── NestedProperties.java │ │ │ │ └── PropertyConversion.java │ │ │ └── util │ │ │ │ ├── Book.java │ │ │ │ └── Credential.java │ │ │ ├── PropertyExpansion │ │ │ └── PropertyExpansionSpringApplication.java │ │ │ ├── SpringBootTutorialApplication.java │ │ │ ├── config │ │ │ ├── ActuatorEndPointSecurityConfig.java │ │ │ ├── MyHealthIndicator.java │ │ │ ├── ReleaseNotesEndpoint.java │ │ │ └── SecurityConfig.java │ │ │ ├── controller │ │ │ ├── BookController.java │ │ │ ├── EmployeeController.java │ │ │ └── HomeController.java │ │ │ ├── entity │ │ │ ├── Book.java │ │ │ └── Employee.java │ │ │ ├── exception │ │ │ ├── CustomExceptioHandler.java │ │ │ ├── EmployeeIdMismatchException.java │ │ │ └── EmployeeNotFoundException.java │ │ │ └── repository │ │ │ ├── BookRepository.java │ │ │ └── EmployeeRepository.java │ └── resources │ │ ├── GlobalApplication.properties │ │ ├── application-dev.properties │ │ ├── application-prod.properties │ │ ├── application-stagging.properties │ │ ├── application.properties │ │ ├── banner.txt │ │ ├── generic.properties │ │ └── templates │ │ ├── errorPage.html │ │ └── homePage.html │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── examples │ └── SpringBootTutorial │ ├── BookRepositoryJPATest.java │ ├── SpringBootApplicationIntegrationTest.java │ ├── SpringBootMailTest.java │ └── SpringBootTutorialApplicationTests.java ├── Spring-Boot-Upload-File ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ └── example │ │ │ └── SpringBootUploadFile │ │ │ ├── CustomExceptionHandler.java │ │ │ ├── FileController.java │ │ │ ├── FileService.java │ │ │ ├── FileStorageException.java │ │ │ └── SpringBootUploadFileApplication.java │ └── resources │ │ ├── application.properties │ │ └── templates │ │ ├── error.html │ │ └── upload.html │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── example │ └── SpringBootUploadFile │ └── SpringBootUploadFileApplicationTests.java ├── Spring-Boot-Web-App ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ └── examples │ │ │ └── SpringBootWebApp │ │ │ ├── CustomErrorController.java │ │ │ ├── SpringBootWebAppApplication.java │ │ │ └── config │ │ │ └── CustomContextPath.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── examples │ └── SpringBootWebApp │ └── SpringBootWebAppApplicationTests.java ├── Spring-Boot-and-Kotlin-Demo ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── kotlin │ │ └── com │ │ │ └── dailycodebuffer │ │ │ └── example │ │ │ └── SpringBootandKotlinDemo │ │ │ ├── SpringBootAndKotlinDemoApplication.kt │ │ │ └── blog │ │ │ ├── BlogConfiguration.kt │ │ │ ├── BlogProperties.kt │ │ │ ├── Entities.kt │ │ │ ├── Extensions.kt │ │ │ ├── HtmlController.kt │ │ │ ├── HttpControllers.kt │ │ │ └── Repositories.kt │ └── resources │ │ ├── application.properties │ │ └── templates │ │ ├── article.mustache │ │ ├── blog.mustache │ │ ├── footer.mustache │ │ └── header.mustache │ └── test │ ├── kotlin │ └── com │ │ └── dailycodebuffer │ │ └── example │ │ └── SpringBootandKotlinDemo │ │ ├── SpringBootAndKotlinDemoApplicationTests.kt │ │ └── blog │ │ ├── HttpControllersTests.kt │ │ ├── IntegrationTests.kt │ │ └── RepositoriesTests.kt │ └── resources │ └── junit-platform.properties ├── Spring-Email-Client ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ └── springemailclient │ │ │ ├── EmailSenderService.java │ │ │ └── SpringEmailClientApplication.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── springemailclient │ └── SpringEmailClientApplicationTests.java ├── Spring-Security-Demo ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ └── springsecuritydemo │ │ │ ├── CustomUserDetails.java │ │ │ ├── CustomUserDetailsService.java │ │ │ ├── HomeController.java │ │ │ ├── SpringSecurityDemoApplication.java │ │ │ ├── User.java │ │ │ ├── UserRepository.java │ │ │ └── WebSecurityConfiguration.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── springsecuritydemo │ └── SpringSecurityDemoApplicationTests.java ├── Spring-Transactional ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ └── transaction │ │ │ ├── SpringTransactionalApplication.java │ │ │ ├── controller │ │ │ └── EmployeeController.java │ │ │ ├── entity │ │ │ ├── Department.java │ │ │ └── Employee.java │ │ │ ├── repository │ │ │ ├── DepartmentRepository.java │ │ │ └── EmployeeRepository.java │ │ │ ├── service │ │ │ └── EmployeeService.java │ │ │ └── vo │ │ │ └── EmployeeRequestVO.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── transaction │ └── SpringTransactionalApplicationTests.java ├── Spring-boot-custom-JSON ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ └── example │ │ │ └── SpringBootCustomJSON │ │ │ ├── SpringBootCustomJsonApplication.java │ │ │ ├── controller │ │ │ └── EmployeeController.java │ │ │ ├── json │ │ │ └── DateConverter.java │ │ │ └── model │ │ │ └── Employee.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── example │ └── SpringBootCustomJSON │ └── SpringBootCustomJsonApplicationTests.java ├── SpringBoot-MySQLDemo ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ ├── SpringBootMySQlDemoApplication.java │ │ │ ├── User.java │ │ │ ├── UserController.java │ │ │ └── UserRepository.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── SpringBootMySQlDemoApplicationTests.java ├── SpringBoot-Redis-Demo ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ ├── SpringBootRedisDemoApplication.java │ │ │ ├── config │ │ │ └── RedisConfig.java │ │ │ ├── controller │ │ │ └── UserController.java │ │ │ ├── model │ │ │ └── User.java │ │ │ ├── repository │ │ │ ├── UserDao.java │ │ │ └── UserDaoImpl.java │ │ │ └── service │ │ │ ├── UserService.java │ │ │ └── UserServiceImpl.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── SpringBootRedisDemoApplicationTests.java ├── SpringLogging ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── appLog.log ├── logs │ ├── app.log │ └── archived │ │ └── app.2020-02-21.0.log ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ ├── HomeController.java │ │ │ └── SpringLoggingApplication.java │ └── resources │ │ ├── application.properties │ │ └── logback.xml │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── SpringLoggingApplicationTests.java ├── apache-kafka-consumer-demo ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ └── kafka │ │ │ ├── ApacheKafkaConsumerDemoApplication.java │ │ │ ├── config │ │ │ └── KafkaConfig.java │ │ │ └── consumer │ │ │ └── KafkaConsumer.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── kafka │ └── ApacheKafkaConsumerDemoApplicationTests.java ├── apache-kafka-producer-demo ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ └── kafka │ │ │ ├── ApacheKafkaProducerDemoApplication.java │ │ │ ├── Book.java │ │ │ ├── DemoController.java │ │ │ └── KafkaConfig.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── kafka │ └── ApacheKafkaProducerDemoApplicationTests.java ├── buildpackdemo ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ └── buildpackdemo │ │ │ ├── BuildpackdemoApplication.java │ │ │ └── HomeController.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── buildpackdemo │ └── BuildpackdemoApplicationTests.java ├── dekorate ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml ├── skaffold.yml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ └── dekorate │ │ │ ├── DekorateApplication.java │ │ │ └── HelloController.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── dekorate │ └── DekorateApplicationTests.java ├── dockerpublish ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── Dockerfile ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ └── dockerpublish │ │ │ ├── DockerpublishApplication.java │ │ │ └── HomeController.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── dockerpublish │ └── DockerpublishApplicationTests.java ├── openapi-documentation ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ ├── OpenapiDocumentationApplication.java │ │ │ ├── controller │ │ │ └── BookController.java │ │ │ ├── entity │ │ │ └── Book.java │ │ │ ├── exception │ │ │ ├── BookIdMismatchException.java │ │ │ ├── BookNotFoundException.java │ │ │ └── CustomExceptionHandler.java │ │ │ └── repository │ │ │ └── BookRepository.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── OpenapiDocumentationApplicationTests.java ├── skaffold-demo ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── k8s-deploy.yml ├── k8s-svc.yml ├── mvnw ├── mvnw.cmd ├── pom.xml ├── skaffold.yml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ └── skaffold │ │ │ ├── MainController.java │ │ │ └── SkaffoldDemoApplication.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── skaffold │ └── SkaffoldDemoApplicationTests.java ├── sns-springboot-demo ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ └── sns │ │ │ ├── SnsSpringbootDemoApplication.java │ │ │ ├── configuration │ │ │ └── AmazonSNSConfiguration.java │ │ │ └── controller │ │ │ └── SNSController.java │ └── resources │ │ ├── application.properties │ │ └── application.yml │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── sns │ └── SnsSpringbootDemoApplicationTests.java ├── spring-boot-aws ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ └── aws │ │ │ ├── BasicController.java │ │ │ └── SpringBootAwsApplication.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── aws │ └── SpringBootAwsApplicationTests.java ├── spring-boot-facebook-oauth-demo ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ ├── BasicController.java │ │ │ └── SpringBootFacebookOauthDemoApplication.java │ └── resources │ │ ├── application.properties │ │ └── application.yml │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── SpringBootFacebookOauthDemoApplicationTests.java ├── spring-boot-http-converter ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ └── examples │ │ │ └── springboothttpconverter │ │ │ ├── Controller │ │ │ └── EmployeeController.java │ │ │ ├── Entity │ │ │ └── Employee.java │ │ │ ├── Repository │ │ │ └── EmployeeRepository.java │ │ │ └── SpringBootHttpConverterApplication.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── examples │ └── springboothttpconverter │ └── SpringBootHttpConverterApplicationTests.java ├── spring-cloud-functions ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ └── spring │ │ │ └── function │ │ │ ├── Employee.java │ │ │ ├── EmployeeData.java │ │ │ ├── GetEmployees.java │ │ │ ├── SpringCloudFunctionsApplication.java │ │ │ └── ToLowerCase.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── spring │ └── function │ └── SpringCloudFunctionsApplicationTests.java ├── spring-rabbitmq-consumer ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ └── mq │ │ │ ├── CustomMessage.java │ │ │ ├── MQConfig.java │ │ │ ├── MessageListener.java │ │ │ └── SpringRabbitmqConsumerApplication.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── mq │ └── SpringRabbitmqConsumerApplicationTests.java ├── spring-rabbitmq-producer ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── dailycodebuffer │ │ │ └── mq │ │ │ ├── CustomMessage.java │ │ │ ├── MQConfig.java │ │ │ ├── MessagePublisher.java │ │ │ └── SpringRabbitmqProducerApplication.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── dailycodebuffer │ └── mq │ └── SpringRabbitmqProducerApplicationTests.java └── spring-websocket ├── .gitignore ├── .mvn └── wrapper │ ├── MavenWrapperDownloader.java │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src ├── main ├── java │ └── com │ │ └── dailycodebuffer │ │ └── websocket │ │ ├── Greeting.java │ │ ├── GreetingController.java │ │ ├── HelloMessage.java │ │ ├── SpringWebsocketApplication.java │ │ └── WebSocketConfiguration.java └── resources │ ├── application.properties │ └── static │ ├── app.js │ ├── index.html │ └── main.css └── test └── java └── com └── dailycodebuffer └── websocket └── SpringWebsocketApplicationTests.java /Demo-Project/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 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 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /Demo-Project/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/Demo-Project/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /Demo-Project/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /Demo-Project/src/main/java/com/dailycodebuffer/demo/DemoProjectApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class DemoProjectApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(DemoProjectApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Demo-Project/src/main/java/com/dailycodebuffer/demo/dao/EmployeeDAO.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.demo.dao; 2 | 3 | import com.dailycodebuffer.demo.model.Employee; 4 | 5 | import java.util.List; 6 | 7 | public interface EmployeeDAO { 8 | 9 | int addEmployee(Employee emp); 10 | 11 | List getAllEmployees(); 12 | 13 | Employee getEmployee(int id); 14 | 15 | int deleteEmployee(int id); 16 | 17 | int updateEmployee(int id, Employee emp); 18 | } 19 | -------------------------------------------------------------------------------- /Demo-Project/src/main/java/com/dailycodebuffer/demo/model/Employee.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.demo.model; 2 | 3 | public class Employee { 4 | 5 | private int empId; 6 | private String empName; 7 | 8 | public int getEmpId() { 9 | return empId; 10 | } 11 | 12 | public void setEmpId(int empId) { 13 | this.empId = empId; 14 | } 15 | 16 | public String getEmpName() { 17 | return empName; 18 | } 19 | 20 | public void setEmpName(String empName) { 21 | this.empName = empName; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Demo-Project/src/main/java/com/dailycodebuffer/demo/service/EmployeeService.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.demo.service; 2 | 3 | import com.dailycodebuffer.demo.dao.EmployeeDAO; 4 | import com.dailycodebuffer.demo.model.Employee; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import java.util.List; 9 | 10 | @Service 11 | public class EmployeeService { 12 | 13 | @Autowired 14 | private EmployeeDAO employeeDAO; 15 | 16 | public int addEmployee(Employee emp) 17 | { 18 | return employeeDAO.addEmployee(emp); 19 | } 20 | 21 | public List getAllEmployees() 22 | { 23 | return employeeDAO.getAllEmployees(); 24 | } 25 | 26 | public Employee getEmployee(int id) 27 | { 28 | return employeeDAO.getEmployee(id); 29 | } 30 | 31 | public int deleteEmployee(int id) 32 | { 33 | return employeeDAO.deleteEmployee(id); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Demo-Project/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Demo-Project/src/test/java/com/dailycodebuffer/demo/DemoProjectApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.demo; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class DemoProjectApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Docker-Compose-Demo/department-service/.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 | -------------------------------------------------------------------------------- /Docker-Compose-Demo/department-service/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/Docker-Compose-Demo/department-service/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /Docker-Compose-Demo/department-service/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /Docker-Compose-Demo/department-service/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:11 2 | ARG JAR_FILE=target/*.jar 3 | COPY ${JAR_FILE} department-service.jar 4 | ENTRYPOINT ["java","-jar","/department-service.jar"] -------------------------------------------------------------------------------- /Docker-Compose-Demo/department-service/src/main/java/com/dailycodebuffer/departmentservice/Department.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.departmentservice; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @AllArgsConstructor 9 | @NoArgsConstructor 10 | public class Department { 11 | 12 | private User user; 13 | private String departmentName; 14 | private String departmentCode; 15 | } 16 | -------------------------------------------------------------------------------- /Docker-Compose-Demo/department-service/src/main/java/com/dailycodebuffer/departmentservice/DepartmentServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.departmentservice; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.web.client.RestTemplateBuilder; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.web.client.RestTemplate; 8 | 9 | import java.time.Duration; 10 | 11 | @SpringBootApplication 12 | public class DepartmentServiceApplication { 13 | 14 | public static void main(String[] args) { 15 | SpringApplication.run(DepartmentServiceApplication.class, args); 16 | } 17 | 18 | @Bean 19 | public RestTemplate restTemplate(RestTemplateBuilder builder) { 20 | 21 | return builder 22 | .setConnectTimeout(Duration.ofMillis(3000)) 23 | .setReadTimeout(Duration.ofMillis(3000)) 24 | .build(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Docker-Compose-Demo/department-service/src/main/java/com/dailycodebuffer/departmentservice/User.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.departmentservice; 2 | 3 | import lombok.*; 4 | 5 | @Data 6 | @NoArgsConstructor 7 | @RequiredArgsConstructor 8 | @AllArgsConstructor 9 | public class User { 10 | 11 | private Long id; 12 | 13 | @NonNull 14 | private String name; 15 | 16 | private String email; 17 | } -------------------------------------------------------------------------------- /Docker-Compose-Demo/department-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port = 8082 2 | -------------------------------------------------------------------------------- /Docker-Compose-Demo/department-service/src/test/java/com/dailycodebuffer/departmentservice/DepartmentServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.departmentservice; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class DepartmentServiceApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Docker-Compose-Demo/docker-compose.override.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | department: 4 | container_name: department_service_new 5 | image: dailycodebuffer/department_new 6 | ports: 7 | - 8084:8082 8 | -------------------------------------------------------------------------------- /Docker-Compose-Demo/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | user: 4 | container_name: user_service 5 | build: 6 | context: ./user-service 7 | args: 8 | JDK_VERSION: 11 9 | dockerfile: Dockerfile 10 | image: dailycodebuffer/user 11 | ports: 12 | - 8081:8081 13 | department: 14 | container_name: department_service 15 | build: 16 | context: ./department-service 17 | dockerfile: Dockerfile 18 | image: dailycodebuffer/department 19 | ports: 20 | - 8083:8082 21 | links: 22 | - "user:user_service" -------------------------------------------------------------------------------- /Docker-Compose-Demo/user-service/.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 | -------------------------------------------------------------------------------- /Docker-Compose-Demo/user-service/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/Docker-Compose-Demo/user-service/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /Docker-Compose-Demo/user-service/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /Docker-Compose-Demo/user-service/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG JDK_VERSION 2 | FROM openjdk:${JDK_VERSION} 3 | ARG JAR_FILE=target/*.jar 4 | COPY ${JAR_FILE} user-service.jar 5 | ENTRYPOINT ["java","-jar","/user-service.jar"] -------------------------------------------------------------------------------- /Docker-Compose-Demo/user-service/src/main/java/com/dailycodebuffer/Initializer.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.boot.CommandLineRunner; 5 | import org.springframework.stereotype.Component; 6 | 7 | import java.util.stream.Stream; 8 | 9 | @Component 10 | public class Initializer implements CommandLineRunner { 11 | 12 | @Autowired 13 | UserRepository userRepository; 14 | 15 | @Override 16 | public void run(String... args) throws Exception { 17 | 18 | Stream.of("Shabbir", "Rahul", "Nikhil", 19 | "Shivam").forEach(name -> 20 | userRepository.save(new User(name)) 21 | ); 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Docker-Compose-Demo/user-service/src/main/java/com/dailycodebuffer/User.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import lombok.Data; 4 | import lombok.NoArgsConstructor; 5 | import lombok.NonNull; 6 | import lombok.RequiredArgsConstructor; 7 | 8 | 9 | import javax.persistence.Entity; 10 | import javax.persistence.GeneratedValue; 11 | import javax.persistence.Id; 12 | import javax.persistence.Table; 13 | 14 | @Data 15 | @Entity 16 | @NoArgsConstructor 17 | @RequiredArgsConstructor 18 | @Table(name = "users") 19 | public class User { 20 | 21 | @Id 22 | @GeneratedValue 23 | private Long id; 24 | 25 | @NonNull 26 | private String name; 27 | 28 | private String email; 29 | } 30 | -------------------------------------------------------------------------------- /Docker-Compose-Demo/user-service/src/main/java/com/dailycodebuffer/UserController.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.RestController; 7 | 8 | import java.util.Collection; 9 | import java.util.List; 10 | 11 | @RestController 12 | @RequestMapping("/api") 13 | public class UserController { 14 | 15 | @Autowired 16 | private UserRepository userRepository; 17 | 18 | @GetMapping("/users") 19 | public List users() { 20 | return userRepository.findAll(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Docker-Compose-Demo/user-service/src/main/java/com/dailycodebuffer/UserRepository.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | 5 | public interface UserRepository extends JpaRepository { 6 | 7 | User findByName(String name); 8 | } 9 | -------------------------------------------------------------------------------- /Docker-Compose-Demo/user-service/src/main/java/com/dailycodebuffer/UserServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class UserServiceApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(UserServiceApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Docker-Compose-Demo/user-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port = 8081 2 | -------------------------------------------------------------------------------- /Docker-Compose-Demo/user-service/src/test/java/com/dailycodebuffer/UserServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class UserServiceApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /DynanoDb-SpringBoot-Demo/.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 | -------------------------------------------------------------------------------- /DynanoDb-SpringBoot-Demo/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/DynanoDb-SpringBoot-Demo/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /DynanoDb-SpringBoot-Demo/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /DynanoDb-SpringBoot-Demo/src/main/java/com/dailycodebuffer/DynanoDbSpringBootDemoApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class DynanoDbSpringBootDemoApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(DynanoDbSpringBootDemoApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /DynanoDb-SpringBoot-Demo/src/main/java/com/dailycodebuffer/entity/Department.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.entity; 2 | 3 | import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBAttribute; 4 | import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBDocument; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | @Data 10 | @AllArgsConstructor 11 | @NoArgsConstructor 12 | @DynamoDBDocument 13 | public class Department { 14 | 15 | @DynamoDBAttribute 16 | private String departmentName; 17 | 18 | @DynamoDBAttribute 19 | private String departmentCode; 20 | } 21 | -------------------------------------------------------------------------------- /DynanoDb-SpringBoot-Demo/src/main/java/com/dailycodebuffer/entity/Employee.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.entity; 2 | 3 | import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBAttribute; 4 | import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBAutoGeneratedKey; 5 | import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey; 6 | import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTable; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Data; 9 | import lombok.NoArgsConstructor; 10 | 11 | @Data 12 | @AllArgsConstructor 13 | @NoArgsConstructor 14 | @DynamoDBTable(tableName = "employee") 15 | public class Employee { 16 | 17 | @DynamoDBHashKey 18 | @DynamoDBAutoGeneratedKey 19 | private String employeeId; 20 | 21 | @DynamoDBAttribute 22 | private String firstName; 23 | 24 | @DynamoDBAttribute 25 | private String lastName; 26 | 27 | @DynamoDBAttribute 28 | private String email; 29 | 30 | @DynamoDBAttribute 31 | private Department department; 32 | } 33 | -------------------------------------------------------------------------------- /DynanoDb-SpringBoot-Demo/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port = 8083 -------------------------------------------------------------------------------- /DynanoDb-SpringBoot-Demo/src/test/java/com/dailycodebuffer/DynanoDbSpringBootDemoApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class DynanoDbSpringBootDemoApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Eureka HA/eureka-client-app/.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 | -------------------------------------------------------------------------------- /Eureka HA/eureka-client-app/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/Eureka HA/eureka-client-app/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /Eureka HA/eureka-client-app/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /Eureka HA/eureka-client-app/src/main/java/com/dailycodebuffer/eurekaclientapp/EurekaClientAppApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.eurekaclientapp; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient; 6 | 7 | @SpringBootApplication 8 | @EnableEurekaClient 9 | public class EurekaClientAppApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(EurekaClientAppApplication.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Eureka HA/eureka-client-app/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Eureka HA/eureka-client-app/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: eureka-client-service 4 | 5 | eureka: 6 | client: 7 | serviceUrl: 8 | defaultZone: http://eureka-1-server.com:9001/eureka, http://eureka-2-server.com:9002/eureka, http://eureka-3-server.com:9003/eureka 9 | -------------------------------------------------------------------------------- /Eureka HA/eureka-client-app/src/test/java/com/dailycodebuffer/eurekaclientapp/EurekaClientAppApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.eurekaclientapp; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class EurekaClientAppApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Eureka HA/spring-registry-server/.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 | -------------------------------------------------------------------------------- /Eureka HA/spring-registry-server/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/Eureka HA/spring-registry-server/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /Eureka HA/spring-registry-server/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /Eureka HA/spring-registry-server/src/main/java/com/dailycodebuffer/springregistryserver/SpringRegistryServerApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.springregistryserver; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; 6 | 7 | @SpringBootApplication 8 | @EnableEurekaServer 9 | public class SpringRegistryServerApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(SpringRegistryServerApplication.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Eureka HA/spring-registry-server/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Eureka HA/spring-registry-server/src/test/java/com/dailycodebuffer/springregistryserver/SpringRegistryServerApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.springregistryserver; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringRegistryServerApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /JWT-Demo/.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 | -------------------------------------------------------------------------------- /JWT-Demo/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/JWT-Demo/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /JWT-Demo/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /JWT-Demo/src/main/java/com/dailycodebuffer/jwt/JwtDemoApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.jwt; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.security.crypto.password.NoOpPasswordEncoder; 7 | import org.springframework.security.crypto.password.PasswordEncoder; 8 | 9 | @SpringBootApplication 10 | public class JwtDemoApplication { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(JwtDemoApplication.class, args); 14 | } 15 | 16 | @Bean 17 | public PasswordEncoder passwordEncoder() { 18 | return NoOpPasswordEncoder.getInstance(); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /JWT-Demo/src/main/java/com/dailycodebuffer/jwt/model/JwtRequest.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.jwt.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @AllArgsConstructor 9 | @NoArgsConstructor 10 | public class JwtRequest { 11 | 12 | private String username; 13 | private String password; 14 | } 15 | -------------------------------------------------------------------------------- /JWT-Demo/src/main/java/com/dailycodebuffer/jwt/model/JwtResponse.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.jwt.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @AllArgsConstructor 9 | @NoArgsConstructor 10 | public class JwtResponse { 11 | 12 | private String jwtToken; 13 | } 14 | -------------------------------------------------------------------------------- /JWT-Demo/src/main/java/com/dailycodebuffer/jwt/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.jwt.service; 2 | 3 | import org.springframework.security.core.userdetails.User; 4 | import org.springframework.security.core.userdetails.UserDetails; 5 | import org.springframework.security.core.userdetails.UserDetailsService; 6 | import org.springframework.security.core.userdetails.UsernameNotFoundException; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.ArrayList; 10 | 11 | @Service 12 | public class UserService implements UserDetailsService { 13 | 14 | @Override 15 | public UserDetails loadUserByUsername(String userName) throws UsernameNotFoundException { 16 | 17 | //Logic to get the user form the Database 18 | 19 | return new User("admin","password",new ArrayList<>()); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /JWT-Demo/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /JWT-Demo/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8083 3 | 4 | 5 | 6 | jwt: 7 | secret: secretkey123 -------------------------------------------------------------------------------- /JWT-Demo/src/test/java/com/dailycodebuffer/jwt/JwtDemoApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.jwt; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class JwtDemoApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /JaCoCo-Demo/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 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 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /JaCoCo-Demo/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/JaCoCo-Demo/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /JaCoCo-Demo/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /JaCoCo-Demo/src/main/java/com/dailycodebuffer/JaCoCoDemoApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class JaCoCoDemoApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(JaCoCoDemoApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /JaCoCo-Demo/src/main/java/com/dailycodebuffer/Messages.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | public class Messages { 4 | 5 | public String getMessage(String name) 6 | { 7 | StringBuilder s = new StringBuilder(); 8 | if(name == null || name.trim().length() == 0) 9 | { 10 | s = s.append("Please Provide a name!"); 11 | } 12 | else 13 | { 14 | s.append("Hello " + name + "!"); 15 | } 16 | return s.toString(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /JaCoCo-Demo/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /JaCoCo-Demo/src/test/java/com/dailycodebuffer/JaCoCoDemoApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class JaCoCoDemoApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /JaCoCo-Demo/src/test/java/com/dailycodebuffer/TestMessages.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.junit.jupiter.api.Assertions; 4 | import org.junit.jupiter.api.Test; 5 | 6 | public class TestMessages { 7 | 8 | @Test 9 | public void testNameDailyCodeBuffer() 10 | { 11 | Messages obj = new Messages(); 12 | Assertions.assertEquals("Hello Daily Code Buffer!", obj.getMessage("Daily Code Buffer")); 13 | } 14 | 15 | @Test 16 | public void testNameBlank() 17 | { 18 | Messages obj = new Messages(); 19 | Assertions.assertEquals("Please Provide a name!", obj.getMessage("")); 20 | } 21 | 22 | @Test 23 | public void testNameNull() 24 | { 25 | Messages obj = new Messages(); 26 | Assertions.assertEquals("Please Provide a name!", obj.getMessage(null)); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /Jenkins-PIpeline-Demo/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 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 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /Jenkins-PIpeline-Demo/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/Jenkins-PIpeline-Demo/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /Jenkins-PIpeline-Demo/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /Jenkins-PIpeline-Demo/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8-jdk-alpine 2 | EXPOSE 8083 3 | RUN addgroup -S shabbir && adduser -S shabbir -G shabbir 4 | USER shabbir:shabbir 5 | ARG JAR_FILE=target/*.jar 6 | COPY ${JAR_FILE} spring-boot-jenkins-docker.jar 7 | ENTRYPOINT ["java","-jar","/spring-boot-jenkins-docker.jar"] -------------------------------------------------------------------------------- /Jenkins-PIpeline-Demo/src/main/java/com/dailycodebuffer/Book.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import javax.persistence.*; 4 | 5 | @Entity 6 | public class Book { 7 | 8 | @Id 9 | @GeneratedValue(strategy = GenerationType.AUTO) 10 | private long id; 11 | 12 | @Column(nullable = false, unique = true) 13 | private String title; 14 | 15 | @Column(nullable = false) 16 | private String author; 17 | 18 | public long getId() { 19 | return id; 20 | } 21 | 22 | public void setId(long id) { 23 | this.id = id; 24 | } 25 | 26 | public String getTitle() { 27 | return title; 28 | } 29 | 30 | public void setTitle(String title) { 31 | this.title = title; 32 | } 33 | 34 | public String getAuthor() { 35 | return author; 36 | } 37 | 38 | public void setAuthor(String author) { 39 | this.author = author; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Jenkins-PIpeline-Demo/src/main/java/com/dailycodebuffer/BookIdMismatchException.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | public class BookIdMismatchException extends RuntimeException{ 4 | 5 | public BookIdMismatchException(String message, Throwable cause) { 6 | super(message, cause); 7 | } 8 | 9 | public BookIdMismatchException() { 10 | super(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Jenkins-PIpeline-Demo/src/main/java/com/dailycodebuffer/BookNotFoundException.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | public class BookNotFoundException extends RuntimeException { 4 | 5 | public BookNotFoundException(String message, Throwable cause) { 6 | super(message, cause); 7 | } 8 | 9 | public BookNotFoundException() { 10 | super(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Jenkins-PIpeline-Demo/src/main/java/com/dailycodebuffer/BookRepository.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.springframework.data.repository.CrudRepository; 4 | 5 | import java.util.List; 6 | 7 | public interface BookRepository extends CrudRepository { 8 | List findByTitle(String title); 9 | } 10 | -------------------------------------------------------------------------------- /Jenkins-PIpeline-Demo/src/main/java/com/dailycodebuffer/JenkinsPIpelineDemoApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.autoconfigure.domain.EntityScan; 6 | import org.springframework.data.jpa.repository.config.EnableJpaRepositories; 7 | 8 | @EnableJpaRepositories("com.dailycodebuffer") 9 | @EntityScan("com.dailycodebuffer") 10 | @SpringBootApplication 11 | public class JenkinsPIpelineDemoApplication { 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(JenkinsPIpelineDemoApplication.class, args); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /Jenkins-PIpeline-Demo/src/main/java/com/dailycodebuffer/SimpleController.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.springframework.beans.factory.annotation.Value; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.ui.Model; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | 8 | @Controller 9 | public class SimpleController { 10 | 11 | @Value("${spring.application.name}") 12 | String appName; 13 | 14 | @GetMapping("/") 15 | public String homePage(Model model) { 16 | model.addAttribute("appName", appName); 17 | return "home"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Jenkins-PIpeline-Demo/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8083 2 | 3 | spring.thymeleaf.cache=false 4 | spring.thymeleaf.enabled=true 5 | spring.thymeleaf.prefix=classpath:/templates/ 6 | spring.thymeleaf.suffix=.html 7 | 8 | spring.application.name=Jenkins PipeLine Demo 9 | 10 | 11 | spring.datasource.driver-class-name=org.h2.Driver 12 | spring.datasource.url=jdbc:h2:mem:bootapp;DB_CLOSE_DELAY=-1 13 | spring.datasource.username=sa 14 | spring.datasource.password= -------------------------------------------------------------------------------- /Jenkins-PIpeline-Demo/src/main/resources/templates/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Error Occurred 4 | 5 |

Error Occurred!

6 | [status] 7 | error 8 | 9 |

message

10 | 11 | -------------------------------------------------------------------------------- /Jenkins-PIpeline-Demo/src/main/resources/templates/home.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Home Page 4 | 5 |

Hello !

6 |

Welcome to Our App

7 | 8 | -------------------------------------------------------------------------------- /Jenkins-PIpeline-Demo/src/test/java/com/dailycodebuffer/JenkinsPIpelineDemoApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.junit.jupiter.api.Assertions; 4 | import org.junit.jupiter.api.Test; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | 7 | @SpringBootTest 8 | class JenkinsPIpelineDemoApplicationTests { 9 | 10 | @Test 11 | void contextLoads() { 12 | Assertions.assertTrue(true); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Kotlin Demo/Kotlin-Demo/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 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 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /Kotlin Demo/Kotlin-Demo/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/Kotlin Demo/Kotlin-Demo/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /Kotlin Demo/Kotlin-Demo/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /Kotlin Demo/Kotlin-Demo/src/main/kotlin/com/dailycodebuffer/Controller.kt: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer 2 | 3 | import org.springframework.web.bind.annotation.* 4 | 5 | @RestController 6 | class BookController (val repo : BookRepositories) 7 | { 8 | @PostMapping("/book") 9 | fun addBooks(@RequestBody book : Book) 10 | { 11 | repo.save(book) 12 | } 13 | 14 | @GetMapping("/book") 15 | fun getAllBooks() = repo.findAll().toList(); 16 | 17 | @GetMapping("/book/{title}") 18 | fun getBookByTitle(@PathVariable("title") title : String) = repo.findByTitle(title) 19 | } -------------------------------------------------------------------------------- /Kotlin Demo/Kotlin-Demo/src/main/kotlin/com/dailycodebuffer/Entities.kt: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer 2 | 3 | import javax.persistence.Entity 4 | import javax.persistence.GeneratedValue 5 | import javax.persistence.Id 6 | 7 | @Entity 8 | class Book( 9 | @Id @GeneratedValue var id: Long, 10 | var isbn: String, 11 | var title: String 12 | ) -------------------------------------------------------------------------------- /Kotlin Demo/Kotlin-Demo/src/main/kotlin/com/dailycodebuffer/KotlinDemoApplication.kt: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer 2 | 3 | import org.springframework.boot.autoconfigure.SpringBootApplication 4 | import org.springframework.boot.runApplication 5 | 6 | @SpringBootApplication 7 | class KotlinDemoApplication 8 | 9 | fun main(args: Array) { 10 | runApplication(*args) 11 | } 12 | -------------------------------------------------------------------------------- /Kotlin Demo/Kotlin-Demo/src/main/kotlin/com/dailycodebuffer/Repositories.kt: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer 2 | 3 | import org.springframework.data.repository.CrudRepository 4 | 5 | interface BookRepositories : CrudRepository 6 | { 7 | fun findByTitle(title : String) : Book 8 | } -------------------------------------------------------------------------------- /Kotlin Demo/Kotlin-Demo/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8081 2 | -------------------------------------------------------------------------------- /Kotlin Demo/Kotlin-Demo/src/test/kotlin/com/dailycodebuffer/KotlinDemoApplicationTests.kt: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer 2 | 3 | import org.junit.jupiter.api.Test 4 | import org.springframework.boot.test.context.SpringBootTest 5 | 6 | @SpringBootTest 7 | class KotlinDemoApplicationTests { 8 | 9 | @Test 10 | fun contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Spring-MVC-Tutorials 2 | 3 | Java and Spring Tutorials 4 | ================ 5 | 6 | This project is **a collection of small and focused tutorials** - each covering a single and well defined area of development in the Java ecosystem. 7 | 8 | Building the project 9 | ==================== 10 | To do the full build, do: `mvn clean install` 11 | 12 | 13 | Building a single module 14 | ==================== 15 | To build a specific module run the command: `mvn clean install` in the module directory 16 | 17 | 18 | Running a Spring Boot module 19 | ==================== 20 | To run a Spring Boot module run the command: `mvn spring-boot:run` in the module directory 21 | 22 | 23 | Working with the IDE 24 | ==================== 25 | This repo contains a large number of modules. 26 | When you're working with an individual module, there's no need to import all of them (or build all of them) - you can simply import that particular module in either Eclipse or IntelliJ. 27 | -------------------------------------------------------------------------------- /SQS-SpringBoot/.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 | -------------------------------------------------------------------------------- /SQS-SpringBoot/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/SQS-SpringBoot/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /SQS-SpringBoot/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /SQS-SpringBoot/src/main/java/com/dailycodebuffer/SqsSpringBootApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SqsSpringBootApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SqsSpringBootApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /SQS-SpringBoot/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /SQS-SpringBoot/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | cloud: 2 | aws: 3 | region: 4 | static: us-east-1 5 | auto: false 6 | stack: 7 | auto: false 8 | credentials: 9 | access-key: 10 | secret-key: 11 | end-point: 12 | uri: 13 | 14 | 15 | server: 16 | port: 8083 -------------------------------------------------------------------------------- /SQS-SpringBoot/src/test/java/com/dailycodebuffer/SqsSpringBootApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SqsSpringBootApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Spring-Boot-Custom-Banner/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 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 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /Spring-Boot-Custom-Banner/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/Spring-Boot-Custom-Banner/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /Spring-Boot-Custom-Banner/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /Spring-Boot-Custom-Banner/src/main/java/com/dailycodebuffer/example/SpringBootCustomBanner/MyCustomBanner.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.example.SpringBootCustomBanner; 2 | 3 | import org.springframework.boot.Banner; 4 | import org.springframework.core.env.Environment; 5 | 6 | import java.io.PrintStream; 7 | 8 | public class MyCustomBanner implements Banner { 9 | 10 | @Override 11 | public void printBanner(Environment environment, Class sourceClass, PrintStream out) { 12 | out.println("================================================"); 13 | out.println(" ## I LOVE DAILY CODE BUFFER ## "); 14 | out.println("================================================"); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Spring-Boot-Custom-Banner/src/main/java/com/dailycodebuffer/example/SpringBootCustomBanner/SpringBootCustomBannerApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.example.SpringBootCustomBanner; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringBootCustomBannerApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringBootCustomBannerApplication.class, args); 11 | /*SpringApplication application = new SpringApplication(SpringBootCustomBannerApplication.class); 12 | application.setBanner(new MyCustomBanner()); 13 | application.run(args);*/ 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /Spring-Boot-Custom-Banner/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | #spring.banner.location=classpath:/path/to/banner/bannername.txt 2 | #spring.banner.image.location=classpath:/path/to/banner/bannername.gif 3 | 4 | #spring.banner.image.width=25 5 | #spring.banner.image.height=20 6 | 7 | #spring.main.banner-mode = off -------------------------------------------------------------------------------- /Spring-Boot-Custom-Banner/src/main/resources/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/Spring-Boot-Custom-Banner/src/main/resources/banner.png -------------------------------------------------------------------------------- /Spring-Boot-Custom-Banner/src/test/java/com/dailycodebuffer/example/SpringBootCustomBanner/SpringBootCustomBannerApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.example.SpringBootCustomBanner; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringBootCustomBannerApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Spring-Boot-Custom-Parent/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 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 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /Spring-Boot-Custom-Parent/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/Spring-Boot-Custom-Parent/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /Spring-Boot-Custom-Parent/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /Spring-Boot-Custom-Parent/src/main/java/com/dailycodebuffer/example/SpringBootCustomParent/SpringBootCustomParentApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.example.SpringBootCustomParent; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | 8 | import javax.annotation.PostConstruct; 9 | 10 | @SpringBootApplication 11 | public class SpringBootCustomParentApplication { 12 | 13 | private static Logger log = LoggerFactory.getLogger(SpringBootCustomParentApplication.class); 14 | 15 | public static void main(String[] args) { 16 | SpringApplication.run(SpringBootCustomParentApplication.class, args); 17 | } 18 | 19 | @PostConstruct 20 | private void init(){ 21 | log.info("creating an executable jar/war with spring boot without parent pom"); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Spring-Boot-Custom-Parent/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Spring-Boot-Custom-Parent/src/test/java/com/dailycodebuffer/example/SpringBootCustomParent/SpringBootCustomParentApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.example.SpringBootCustomParent; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringBootCustomParentApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Spring-Boot-Dev-Tools/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 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 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /Spring-Boot-Dev-Tools/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/Spring-Boot-Dev-Tools/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /Spring-Boot-Dev-Tools/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.2/apache-maven-3.6.2-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar 3 | -------------------------------------------------------------------------------- /Spring-Boot-Dev-Tools/src/main/java/com/dailycodebuffer/HomeController.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 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("/") 10 | public String home() 11 | { 12 | return "home page"; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Spring-Boot-Dev-Tools/src/main/java/com/dailycodebuffer/SpringBootDevToolsApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringBootDevToolsApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringBootDevToolsApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Spring-Boot-Dev-Tools/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | spring.devtools.remote.debug.local-port=8010 -------------------------------------------------------------------------------- /Spring-Boot-Dev-Tools/src/test/java/com/dailycodebuffer/SpringBootDevToolsApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringBootDevToolsApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Spring-Boot-Error-Handle/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 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 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /Spring-Boot-Error-Handle/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/Spring-Boot-Error-Handle/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /Spring-Boot-Error-Handle/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /Spring-Boot-Error-Handle/src/main/java/com/dailycodebuffer/example/SpringBootErrorHandle/SpringBootErrorHandleApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.example.SpringBootErrorHandle; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringBootErrorHandleApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringBootErrorHandleApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Spring-Boot-Error-Handle/src/main/java/com/dailycodebuffer/example/SpringBootErrorHandle/controller/CustomErrorController.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.example.SpringBootErrorHandle.controller; 2 | 3 | import org.springframework.boot.web.servlet.error.ErrorController; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | 7 | @Controller 8 | public class CustomErrorController implements ErrorController { 9 | 10 | private static final String PATH = "/error"; 11 | 12 | @RequestMapping(value = PATH) 13 | public String error() { 14 | return "customError"; 15 | } 16 | 17 | @Override 18 | public String getErrorPath() { 19 | return PATH; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /Spring-Boot-Error-Handle/src/main/java/com/dailycodebuffer/example/SpringBootErrorHandle/controller/MyController.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.example.SpringBootErrorHandle.controller; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.ui.Model; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | 7 | @Controller 8 | public class MyController { 9 | 10 | @RequestMapping("/") 11 | public String homePage (Model model) { 12 | model.addAttribute("msg","This is Spring Boot Error Handle Example"); 13 | return "homePage"; 14 | } 15 | 16 | @RequestMapping("/test") 17 | public void handlerTest () { 18 | throw new RuntimeException("exception from handlerTest"); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /Spring-Boot-Error-Handle/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.thymeleaf.cache=false 2 | spring.thymeleaf.enabled=true 3 | spring.thymeleaf.prefix=classpath:/templates/ 4 | spring.thymeleaf.suffix=.html 5 | ### Server port ######### 6 | server.port=8081 7 | spring.application.name=Spring Boot Error Handle Tutorial 8 | 9 | server.error.whitelabel.enabled=false 10 | spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration 11 | -------------------------------------------------------------------------------- /Spring-Boot-Error-Handle/src/main/resources/templates/customError.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

Something went wrong! This is a Custom Error Page

5 |

We are looking into it!

6 | Go Home 7 | 8 | -------------------------------------------------------------------------------- /Spring-Boot-Error-Handle/src/main/resources/templates/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

Something went wrong!

5 |

We are looking into it!

6 | Go Home 7 | 8 | -------------------------------------------------------------------------------- /Spring-Boot-Error-Handle/src/main/resources/templates/homePage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Home 6 | 7 | 8 |

This is Home page

9 | 10 | -------------------------------------------------------------------------------- /Spring-Boot-Error-Handle/src/test/java/com/dailycodebuffer/example/SpringBootErrorHandle/SpringBootErrorHandleApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.example.SpringBootErrorHandle; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class SpringBootErrorHandleApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /Spring-Boot-Exit-Code/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 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 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /Spring-Boot-Exit-Code/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/Spring-Boot-Exit-Code/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /Spring-Boot-Exit-Code/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /Spring-Boot-Exit-Code/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Spring-Boot-Exit-Code/src/test/java/com/dailycodebuffer/example/SpringBootExitCode/SpringBootExitCodeApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.example.SpringBootExitCode; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringBootExitCodeApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Spring-Boot-Main-Class/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 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 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /Spring-Boot-Main-Class/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/Spring-Boot-Main-Class/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /Spring-Boot-Main-Class/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /Spring-Boot-Main-Class/src/main/java/com/dailycodebufffer/example/SpringBootMainClass/SpringBootMainClassApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebufffer.example.SpringBootMainClass; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringBootMainClassApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringBootMainClassApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Spring-Boot-Main-Class/src/main/java/com/dailycodebufffer/example/SpringBootMainClass/SpringBootMainClassApplication2.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebufffer.example.SpringBootMainClass; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringBootMainClassApplication2 { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringBootMainClassApplication2.class, args); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Spring-Boot-Main-Class/src/main/java/com/dailycodebufffer/example/SpringBootMainClass/configuration/ApplicationConfig.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebufffer.example.SpringBootMainClass.configuration; 2 | 3 | import com.dailycodebufffer.example.SpringBootMainClass.filter.MyCustomFilter; 4 | import org.springframework.boot.web.servlet.FilterRegistrationBean; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | @Configuration 9 | public class ApplicationConfig { 10 | 11 | @Bean 12 | public FilterRegistrationBean filterRegistrationBean() { 13 | FilterRegistrationBean < MyCustomFilter > registrationBean = new FilterRegistrationBean(); 14 | MyCustomFilter myCustomFilter = new MyCustomFilter(); 15 | 16 | registrationBean.setFilter(myCustomFilter); 17 | registrationBean.addUrlPatterns("/filterExample/*"); 18 | registrationBean.setOrder(2); //set precedence 19 | return registrationBean; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Spring-Boot-Main-Class/src/main/java/com/dailycodebufffer/example/SpringBootMainClass/controller/FilterExampleController.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebufffer.example.SpringBootMainClass.controller; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | 6 | @Controller 7 | public class FilterExampleController { 8 | 9 | @GetMapping(value = "/filterExample") 10 | public String customGreetings() { 11 | return "Hello From Custom Filter Example"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Spring-Boot-Main-Class/src/main/java/com/dailycodebufffer/example/SpringBootMainClass/controller/HomeController.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebufffer.example.SpringBootMainClass.controller; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.ResponseBody; 6 | 7 | @Controller 8 | public class HomeController { 9 | 10 | @RequestMapping("/") 11 | @ResponseBody 12 | public String goToHomePage () { 13 | return "

This is the Home page

"; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /Spring-Boot-Main-Class/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | spring.application.name=Spring Boot Main Class Tutorial 3 | 4 | ### Server port ######### 5 | server.port=8081 -------------------------------------------------------------------------------- /Spring-Boot-Main-Class/src/test/java/com/dailycodebufffer/example/SpringBootMainClass/SpringBootMainClassApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebufffer.example.SpringBootMainClass; 2 | 3 | import org.junit.Assert; 4 | import org.junit.Test; 5 | import org.junit.runner.RunWith; 6 | import org.springframework.boot.test.context.SpringBootTest; 7 | import org.springframework.test.context.junit4.SpringRunner; 8 | 9 | @RunWith(SpringRunner.class) 10 | @SpringBootTest 11 | public class SpringBootMainClassApplicationTests { 12 | 13 | @Test 14 | public void contextLoads() { 15 | Assert.assertTrue(true); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /Spring-Boot-Maven-Deploy/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 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 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /Spring-Boot-Maven-Deploy/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/Spring-Boot-Maven-Deploy/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /Spring-Boot-Maven-Deploy/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.2/apache-maven-3.6.2-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar 3 | -------------------------------------------------------------------------------- /Spring-Boot-Maven-Deploy/src/main/java/com/dailycodebuffer/HomeController.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | import java.util.Collection; 7 | import java.util.stream.Collectors; 8 | import java.util.stream.IntStream; 9 | 10 | @RestController 11 | public class HomeController { 12 | 13 | @GetMapping("/") 14 | public Collection sayHello() { 15 | return IntStream.range(0, 10) 16 | .mapToObj(i -> "Counter Number " + i) 17 | .collect(Collectors.toList()); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Spring-Boot-Maven-Deploy/src/main/java/com/dailycodebuffer/ServletInitializer.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 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(SpringBootMavenDeployApplication.class); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Spring-Boot-Maven-Deploy/src/main/java/com/dailycodebuffer/SpringBootMavenDeployApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringBootMavenDeployApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringBootMavenDeployApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Spring-Boot-Maven-Deploy/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Spring-Boot-Maven-Deploy/src/test/java/com/dailycodebuffer/SpringBootMavenDeployApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringBootMavenDeployApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Spring-Boot-Mustache-Demo/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 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 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /Spring-Boot-Mustache-Demo/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/Spring-Boot-Mustache-Demo/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /Spring-Boot-Mustache-Demo/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.2/apache-maven-3.6.2-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar 3 | -------------------------------------------------------------------------------- /Spring-Boot-Mustache-Demo/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | spring.mustache.prefix = classpath:/templates/ 3 | spring.mustache.suffix = .mustache -------------------------------------------------------------------------------- /Spring-Boot-Mustache-Demo/src/main/resources/templates/book.mustache: -------------------------------------------------------------------------------- 1 | {{>header}} 2 |

Mustache with Spring Boot

3 |
Book List
4 | {{#bookList}} 5 | Book ID: {{bookid}} 6 | ISBN Number: {{isbn}} 7 | Book Title: {{bookTitle}} 8 | Author: {{author}} 9 | Price: {{price}} 10 |
11 |
12 | {{/bookList}} 13 | {{>footer}} -------------------------------------------------------------------------------- /Spring-Boot-Mustache-Demo/src/main/resources/templates/footer.mustache: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Spring-Boot-Mustache-Demo/src/main/resources/templates/header.mustache: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Sample Spring Boot application with Mustache 6 | 7 | -------------------------------------------------------------------------------- /Spring-Boot-Mustache-Demo/src/test/java/com/dailycodebuffer/SpringBootMustacheDemoApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringBootMustacheDemoApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Spring-Boot-Servlet/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 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 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /Spring-Boot-Servlet/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/Spring-Boot-Servlet/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /Spring-Boot-Servlet/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /Spring-Boot-Servlet/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Spring-Boot-Servlet/src/test/java/com/dailycodebuffer/example/SpringBootServlet/SpringBootServletApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.example.SpringBootServlet; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringBootServletApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Spring-Boot-Shutdown/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 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 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /Spring-Boot-Shutdown/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/Spring-Boot-Shutdown/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /Spring-Boot-Shutdown/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /Spring-Boot-Shutdown/src/main/java/com/dailycodebuffer/example/SpringBootShutdown/config/ApplicationConfig.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.example.SpringBootShutdown.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | 5 | import javax.annotation.PreDestroy; 6 | 7 | @Configuration 8 | public class ApplicationConfig { 9 | 10 | @PreDestroy 11 | public void onShutDown() { 12 | System.out.println("closing application context..let's do the final resource cleanup"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Spring-Boot-Shutdown/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | management.endpoint.shutdown.enabled=true 2 | management.endpoint.info.enabled=true 3 | management.endpoints.web.exposure.include=* 4 | -------------------------------------------------------------------------------- /Spring-Boot-Shutdown/src/test/java/com/dailycodebuffer/example/SpringBootShutdown/SpringBootShutdownApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.example.SpringBootShutdown; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringBootShutdownApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Spring-Boot-Tutorial/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 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 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /Spring-Boot-Tutorial/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/Spring-Boot-Tutorial/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /Spring-Boot-Tutorial/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /Spring-Boot-Tutorial/README.md: -------------------------------------------------------------------------------- 1 | ## Spring Boot Tutorial 2 | 3 | ### Relevant Articles 4 | 5 | - [Spring Boot Tutorial – Bootstrap a Simple Application](http://www.dailycodebuffer.com/spring-boot-tutorial) 6 | - [Intro to Spring Boot Starters](http://www.dailycodebuffer.com/spring-boot-starters) 7 | - [Spring Boot Actuator](http://www.dailycodebuffer.com/spring-boot-actuator/) 8 | - [Create custom Actuator endpoints](http://www.dailycodebuffer.com/create-custom-actuator-endpoints/) 9 | - [Configure a Spring Boot Web Application](http://www.dailycodebuffer.com/configuring-spring-boot-web-app/) 10 | - [Guide to @ConfigurationProperties in Spring Boot](http://www.dailycodebuffer.com/configurationproperties-in-spring-boot/) 11 | - [Automatic Property Expansion with Spring Boot](http://www.dailycodebuffer.com/automatic-property-expansion-with-spring-boot/) 12 | - [Customize Whitelabel Error Page in Spring Boot](http://www.dailycodebuffer.com/customize-whitelabel-error-page-in-spring-boot/) 13 | -------------------------------------------------------------------------------- /Spring-Boot-Tutorial/src/main/java/com/dailycodebuffer/examples/SpringBootTutorial/ConfigurationProperties/SpringBootConfigurationPropertiesApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.examples.SpringBootTutorial.ConfigurationProperties; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringBootConfigurationPropertiesApplication { 8 | 9 | public static void main(String[] args) 10 | { 11 | SpringApplication.run(SpringBootConfigurationPropertiesApplication.class, args); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /Spring-Boot-Tutorial/src/main/java/com/dailycodebuffer/examples/SpringBootTutorial/ConfigurationProperties/properties/ApplicationProperties.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.examples.SpringBootTutorial.ConfigurationProperties.properties; 2 | 3 | public class ApplicationProperties { 4 | } 5 | -------------------------------------------------------------------------------- /Spring-Boot-Tutorial/src/main/java/com/dailycodebuffer/examples/SpringBootTutorial/ConfigurationProperties/properties/BeanConfigProperties.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.examples.SpringBootTutorial.ConfigurationProperties.properties; 2 | 3 | import com.dailycodebuffer.examples.SpringBootTutorial.ConfigurationProperties.util.Book; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | @Configuration 9 | public class BeanConfigProperties { 10 | 11 | @Bean 12 | @ConfigurationProperties(prefix = "book") 13 | public Book book() 14 | { 15 | return new Book(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Spring-Boot-Tutorial/src/main/java/com/dailycodebuffer/examples/SpringBootTutorial/ConfigurationProperties/properties/BookConverter.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.examples.SpringBootTutorial.ConfigurationProperties.properties; 2 | 3 | import com.dailycodebuffer.examples.SpringBootTutorial.ConfigurationProperties.util.Book; 4 | import org.springframework.boot.context.properties.ConfigurationPropertiesBinding; 5 | import org.springframework.core.convert.converter.Converter; 6 | import org.springframework.stereotype.Component; 7 | 8 | @Component 9 | @ConfigurationPropertiesBinding 10 | public class BookConverter implements Converter { 11 | 12 | @Override 13 | public Book convert(String s) { 14 | String[] data = s.split(","); 15 | return new Book(data[0], Double.parseDouble(data[1]), data[2]); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Spring-Boot-Tutorial/src/main/java/com/dailycodebuffer/examples/SpringBootTutorial/ConfigurationProperties/properties/GenericConfigProperties.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.examples.SpringBootTutorial.ConfigurationProperties.properties; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | import org.springframework.context.annotation.PropertySource; 5 | import org.springframework.stereotype.Component; 6 | 7 | @Component 8 | @PropertySource("classpath:generic.properties") 9 | @ConfigurationProperties 10 | 11 | public class GenericConfigProperties { 12 | 13 | private String appName; 14 | 15 | private String email; 16 | 17 | public String getAppName() { 18 | return appName; 19 | } 20 | 21 | public void setAppName(String appName) { 22 | this.appName = appName; 23 | } 24 | 25 | public String getEmail() { 26 | return email; 27 | } 28 | 29 | public void setEmail(String email) { 30 | this.email = email; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Spring-Boot-Tutorial/src/main/java/com/dailycodebuffer/examples/SpringBootTutorial/ConfigurationProperties/util/Credential.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.examples.SpringBootTutorial.ConfigurationProperties.util; 2 | 3 | import javax.validation.constraints.Pattern; 4 | 5 | public class Credential { 6 | 7 | @Pattern(regexp = "^[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,6}$") 8 | private String email; 9 | private String password; 10 | 11 | public String getEmail() { 12 | return email; 13 | } 14 | 15 | public void setEmail(String email) { 16 | this.email = email; 17 | } 18 | 19 | public String getPassword() { 20 | return password; 21 | } 22 | 23 | public void setPassword(String password) { 24 | this.password = password; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Spring-Boot-Tutorial/src/main/java/com/dailycodebuffer/examples/SpringBootTutorial/SpringBootTutorialApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.examples.SpringBootTutorial; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.autoconfigure.domain.EntityScan; 6 | import org.springframework.data.jpa.repository.config.EnableJpaRepositories; 7 | 8 | @EnableJpaRepositories("com.dailycodebuffer.examples.SpringBootTutorial.repository") 9 | @EntityScan("com.dailycodebuffer.examples.SpringBootTutorial.entity") 10 | @SpringBootApplication 11 | public class SpringBootTutorialApplication { 12 | 13 | public static void main(String[] args) 14 | { 15 | SpringApplication.run(SpringBootTutorialApplication.class, args); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /Spring-Boot-Tutorial/src/main/java/com/dailycodebuffer/examples/SpringBootTutorial/config/MyHealthIndicator.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.examples.SpringBootTutorial.config; 2 | 3 | import org.springframework.boot.actuate.health.Health; 4 | import org.springframework.boot.actuate.health.HealthIndicator; 5 | import org.springframework.stereotype.Component; 6 | 7 | @Component 8 | public class MyHealthIndicator implements HealthIndicator { 9 | 10 | @Override 11 | public Health health() { 12 | 13 | int errorCode = check(); // perform some specific health check 14 | if (errorCode != 0) { 15 | return Health.down().withDetail("Error Code", errorCode).build(); 16 | } 17 | return Health.up() 18 | .withDetail("app", "I m Alive and Rocking") 19 | .withDetail("error", "I am suffering from pain !!") 20 | .build(); 21 | } 22 | 23 | public int check() { 24 | // Your Own logic to check health 25 | return 0; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Spring-Boot-Tutorial/src/main/java/com/dailycodebuffer/examples/SpringBootTutorial/config/SecurityConfig.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.examples.SpringBootTutorial.config; 2 | 3 | import org.springframework.beans.factory.annotation.Configurable; 4 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 5 | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; 6 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 7 | 8 | @Configurable 9 | @EnableWebSecurity 10 | public class SecurityConfig extends WebSecurityConfigurerAdapter { 11 | 12 | protected void configure(HttpSecurity httpSecurity) throws Exception 13 | { 14 | httpSecurity.authorizeRequests() 15 | .anyRequest() 16 | .permitAll() 17 | .and() 18 | .csrf() 19 | .disable(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Spring-Boot-Tutorial/src/main/java/com/dailycodebuffer/examples/SpringBootTutorial/controller/HomeController.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.examples.SpringBootTutorial.controller; 2 | 3 | import org.springframework.beans.factory.annotation.Value; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.ui.Model; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | 8 | @Controller 9 | public class HomeController { 10 | 11 | @Value("${spring.application.name}") 12 | String appName; 13 | 14 | @GetMapping("/") 15 | public String homePage (Model model) 16 | { 17 | model.addAttribute("appName", appName); 18 | return "homePage"; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Spring-Boot-Tutorial/src/main/java/com/dailycodebuffer/examples/SpringBootTutorial/entity/Employee.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.examples.SpringBootTutorial.entity; 2 | 3 | import javax.persistence.*; 4 | 5 | @Entity 6 | public class Employee { 7 | 8 | @Id 9 | @GeneratedValue(strategy = GenerationType.AUTO) 10 | private long id; 11 | 12 | @Column(nullable = false) 13 | private String name; 14 | 15 | @Column(nullable = false, unique = true) 16 | private String emailId; 17 | 18 | public long getId() { 19 | return id; 20 | } 21 | 22 | public void setId(long id) { 23 | this.id = id; 24 | } 25 | 26 | public String getName() { 27 | return name; 28 | } 29 | 30 | public void setName(String name) { 31 | this.name = name; 32 | } 33 | 34 | public String getEmailId() { 35 | return emailId; 36 | } 37 | 38 | public void setEmailId(String emailId) { 39 | this.emailId = emailId; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Spring-Boot-Tutorial/src/main/java/com/dailycodebuffer/examples/SpringBootTutorial/exception/EmployeeIdMismatchException.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.examples.SpringBootTutorial.exception; 2 | 3 | public class EmployeeIdMismatchException extends RuntimeException { 4 | 5 | public EmployeeIdMismatchException(String message, Throwable cause) 6 | { 7 | super(message, cause); 8 | } 9 | 10 | public EmployeeIdMismatchException() 11 | { 12 | super(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Spring-Boot-Tutorial/src/main/java/com/dailycodebuffer/examples/SpringBootTutorial/exception/EmployeeNotFoundException.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.examples.SpringBootTutorial.exception; 2 | 3 | public class EmployeeNotFoundException extends RuntimeException { 4 | 5 | public EmployeeNotFoundException(String message, Throwable cause) 6 | { 7 | super(message,cause); 8 | } 9 | 10 | public EmployeeNotFoundException() 11 | { 12 | super(); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Spring-Boot-Tutorial/src/main/java/com/dailycodebuffer/examples/SpringBootTutorial/repository/BookRepository.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.examples.SpringBootTutorial.repository; 2 | 3 | import com.dailycodebuffer.examples.SpringBootTutorial.entity.Book; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | 6 | public interface BookRepository extends JpaRepository { 7 | } 8 | -------------------------------------------------------------------------------- /Spring-Boot-Tutorial/src/main/java/com/dailycodebuffer/examples/SpringBootTutorial/repository/EmployeeRepository.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.examples.SpringBootTutorial.repository; 2 | 3 | import com.dailycodebuffer.examples.SpringBootTutorial.entity.Employee; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | 6 | import java.util.List; 7 | 8 | public interface EmployeeRepository extends JpaRepository { 9 | 10 | List findByEmailId(String emailId); 11 | } 12 | -------------------------------------------------------------------------------- /Spring-Boot-Tutorial/src/main/resources/GlobalApplication.properties: -------------------------------------------------------------------------------- 1 | #App 2 | app.menus[0].title=Home 3 | app.menus[0].name=Home 4 | app.menus[0].path=/ 5 | app.menus[1].title=Login 6 | app.menus[1].name=Login 7 | app.menus[1].path=/login 8 | 9 | app.compiler.timeout=5 10 | app.compiler.output-folder=/temp/ 11 | 12 | app.error=/error/ -------------------------------------------------------------------------------- /Spring-Boot-Tutorial/src/main/resources/application-dev.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=Spring Boot Tutorial - DEVELOPMENT -------------------------------------------------------------------------------- /Spring-Boot-Tutorial/src/main/resources/application-prod.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=Spring Boot Tutorial -------------------------------------------------------------------------------- /Spring-Boot-Tutorial/src/main/resources/application-stagging.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=Spring Boot Tutorial - STAGGING -------------------------------------------------------------------------------- /Spring-Boot-Tutorial/src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | ________ .__ .__ _________ .___ __________ _____ _____ 2 | \______ \ _____ |__|| | ___.__. \_ ___ \ ____ __| _/ ____ \______ \ __ __ _/ ____\_/ ____\ ____ _______ 3 | | | \ \__ \ | || | < | | / \ \/ / _ \ / __ | _/ __ \ | | _/| | \\ __\ \ __\ _/ __ \ \_ __ \ 4 | | ` \ / __ \_| || |__ \___ | \ \____( <_> )/ /_/ | \ ___/ | | \| | / | | | | \ ___/ | | \/ 5 | /_______ /(____ /|__||____/ / ____| \______ / \____/ \____ | \___ > |______ /|____/ |__| |__| \___ > |__| 6 | \/ \/ \/ \/ \/ \/ \/ \/ -------------------------------------------------------------------------------- /Spring-Boot-Tutorial/src/main/resources/generic.properties: -------------------------------------------------------------------------------- 1 | email=support@dailycodebuffer.com 2 | appName= Spring Boot Configuration Properties -------------------------------------------------------------------------------- /Spring-Boot-Tutorial/src/main/resources/templates/errorPage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Error Occured 6 | 7 | 8 |

Error Occurred!

9 | [status] 10 | error 11 | 12 |

message

13 | 14 | -------------------------------------------------------------------------------- /Spring-Boot-Tutorial/src/main/resources/templates/homePage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Home Page 6 | 7 | 8 |

Hello World!

9 |

Welcome to Our App

10 | 11 | -------------------------------------------------------------------------------- /Spring-Boot-Tutorial/src/test/java/com/dailycodebuffer/examples/SpringBootTutorial/SpringBootTutorialApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.examples.SpringBootTutorial; 2 | 3 | import org.junit.Assert; 4 | import org.junit.Test; 5 | import org.junit.runner.RunWith; 6 | import org.springframework.boot.test.context.SpringBootTest; 7 | import org.springframework.test.context.junit4.SpringRunner; 8 | 9 | @RunWith(SpringRunner.class) 10 | @SpringBootTest 11 | public class SpringBootTutorialApplicationTests { 12 | 13 | @Test 14 | public void contextLoads() { 15 | Assert.assertTrue(true); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /Spring-Boot-Upload-File/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 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 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /Spring-Boot-Upload-File/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/Spring-Boot-Upload-File/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /Spring-Boot-Upload-File/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.2/apache-maven-3.6.2-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar 3 | -------------------------------------------------------------------------------- /Spring-Boot-Upload-File/src/main/java/com/dailycodebuffer/example/SpringBootUploadFile/CustomExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.example.SpringBootUploadFile; 2 | 3 | import org.springframework.web.bind.annotation.ControllerAdvice; 4 | import org.springframework.web.bind.annotation.ExceptionHandler; 5 | import org.springframework.web.servlet.ModelAndView; 6 | import org.springframework.web.servlet.mvc.support.RedirectAttributes; 7 | 8 | @ControllerAdvice 9 | public class CustomExceptionHandler { 10 | 11 | @ExceptionHandler(FileStorageException.class) 12 | public ModelAndView handleException(FileStorageException exception, RedirectAttributes redirectAttributes) 13 | { 14 | ModelAndView mv = new ModelAndView(); 15 | mv.addObject("message",exception.getMsg()); 16 | mv.setViewName("error"); 17 | return mv; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Spring-Boot-Upload-File/src/main/java/com/dailycodebuffer/example/SpringBootUploadFile/FileStorageException.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.example.SpringBootUploadFile; 2 | 3 | public class FileStorageException extends RuntimeException { 4 | 5 | private String msg; 6 | 7 | public FileStorageException(String msg) { 8 | this.msg = msg; 9 | } 10 | 11 | public String getMsg() { 12 | return msg; 13 | } 14 | 15 | public void setMsg(String msg) { 16 | this.msg = msg; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Spring-Boot-Upload-File/src/main/java/com/dailycodebuffer/example/SpringBootUploadFile/SpringBootUploadFileApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.example.SpringBootUploadFile; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringBootUploadFileApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringBootUploadFileApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Spring-Boot-Upload-File/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | spring.servlet.multipart.max-file-size = 5MB 3 | spring.servlet.multipart.max-request-size = 5MB -------------------------------------------------------------------------------- /Spring-Boot-Upload-File/src/main/resources/templates/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ERROR 6 | 7 | 8 |

Error!!!

9 |
10 |

11 |

12 | 13 | -------------------------------------------------------------------------------- /Spring-Boot-Upload-File/src/main/resources/templates/upload.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 |

Spring Boot File Upload Example

10 |
11 |

Upload Single File:

12 |
13 |

14 | 15 |
16 |
17 |
18 |

19 |

20 | 21 |

Upload Multiple Files:

22 |
23 |

24 | 25 |
26 | 27 |
28 | 29 | 30 | -------------------------------------------------------------------------------- /Spring-Boot-Upload-File/src/test/java/com/dailycodebuffer/example/SpringBootUploadFile/SpringBootUploadFileApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.example.SpringBootUploadFile; 2 | 3 | import org.junit.jupiter.api.Assertions; 4 | import org.junit.jupiter.api.Test; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | 7 | @SpringBootTest 8 | class SpringBootUploadFileApplicationTests { 9 | 10 | 11 | void contextLoads() { 12 | Assertions.assertTrue(true); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Spring-Boot-Web-App/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 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 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /Spring-Boot-Web-App/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/Spring-Boot-Web-App/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /Spring-Boot-Web-App/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /Spring-Boot-Web-App/src/main/java/com/dailycodebuffer/examples/SpringBootWebApp/CustomErrorController.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.examples.SpringBootWebApp; 2 | 3 | import org.springframework.boot.web.servlet.error.ErrorController; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | 6 | public class CustomErrorController implements ErrorController { 7 | 8 | private static final String ERROR_PATH = "/error"; 9 | 10 | @GetMapping(value=ERROR_PATH) 11 | public String error() { 12 | return "Error Custom"; 13 | } 14 | 15 | @Override 16 | public String getErrorPath() { 17 | return ERROR_PATH; 18 | } 19 | 20 | @GetMapping("/errorCustom") 21 | String errorHeaven() { 22 | return "You have reached the hell of errors!!!"; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Spring-Boot-Web-App/src/main/java/com/dailycodebuffer/examples/SpringBootWebApp/SpringBootWebAppApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.examples.SpringBootWebApp; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringBootWebAppApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringBootWebAppApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Spring-Boot-Web-App/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8088 2 | 3 | spring.application.name=Spring Boot Web App 4 | 5 | #server.servlet.contextPath=/springbootwebapp 6 | 7 | spring.datasource.driver-class-name=org.h2.Driver 8 | spring.datasource.url=jdbc:h2:mem:bootapp;DB_CLOSE_DELAY=-1 9 | spring.datasource.username=sa 10 | spring.datasource.password= 11 | -------------------------------------------------------------------------------- /Spring-Boot-Web-App/src/test/java/com/dailycodebuffer/examples/SpringBootWebApp/SpringBootWebAppApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.examples.SpringBootWebApp; 2 | 3 | import org.junit.Assert; 4 | import org.junit.Test; 5 | import org.junit.runner.RunWith; 6 | import org.springframework.boot.test.context.SpringBootTest; 7 | import org.springframework.test.context.junit4.SpringRunner; 8 | 9 | @RunWith(SpringRunner.class) 10 | @SpringBootTest 11 | public class SpringBootWebAppApplicationTests { 12 | 13 | @Test 14 | public void contextLoads() { 15 | Assert.assertTrue(true); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /Spring-Boot-and-Kotlin-Demo/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 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 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /Spring-Boot-and-Kotlin-Demo/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/Spring-Boot-and-Kotlin-Demo/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /Spring-Boot-and-Kotlin-Demo/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.2/apache-maven-3.6.2-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar 3 | -------------------------------------------------------------------------------- /Spring-Boot-and-Kotlin-Demo/src/main/kotlin/com/dailycodebuffer/example/SpringBootandKotlinDemo/SpringBootAndKotlinDemoApplication.kt: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.example.SpringBootandKotlinDemo 2 | 3 | import com.dailycodebuffer.example.SpringBootandKotlinDemo.blog.BlogProperties 4 | import org.springframework.boot.Banner 5 | import org.springframework.boot.autoconfigure.SpringBootApplication 6 | import org.springframework.boot.context.properties.EnableConfigurationProperties 7 | import org.springframework.boot.runApplication 8 | 9 | @SpringBootApplication 10 | @EnableConfigurationProperties(BlogProperties::class) 11 | class SpringBootAndKotlinDemoApplication 12 | 13 | fun main(args: Array) { 14 | runApplication(*args) 15 | { 16 | setBannerMode(Banner.Mode.OFF) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Spring-Boot-and-Kotlin-Demo/src/main/kotlin/com/dailycodebuffer/example/SpringBootandKotlinDemo/blog/BlogProperties.kt: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.example.SpringBootandKotlinDemo.blog 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties 4 | import org.springframework.boot.context.properties.ConstructorBinding 5 | 6 | @ConstructorBinding 7 | @ConfigurationProperties("blog") 8 | data class BlogProperties(var title: String, val banner: Banner) { 9 | data class Banner(val title: String? = null, val content: String) 10 | } -------------------------------------------------------------------------------- /Spring-Boot-and-Kotlin-Demo/src/main/kotlin/com/dailycodebuffer/example/SpringBootandKotlinDemo/blog/Entities.kt: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.example.SpringBootandKotlinDemo.blog 2 | 3 | import java.time.LocalDateTime 4 | import javax.persistence.Entity 5 | import javax.persistence.GeneratedValue 6 | import javax.persistence.Id 7 | import javax.persistence.ManyToOne 8 | 9 | @Entity 10 | class Article( 11 | var title: String, 12 | var headline: String, 13 | var content: String, 14 | @ManyToOne var author: User, 15 | var slug: String = title.toSlug(), 16 | var addedAt: LocalDateTime = LocalDateTime.now(), 17 | @Id @GeneratedValue var id: Long? = null) 18 | 19 | @Entity 20 | class User( 21 | var login: String, 22 | var firstname: String, 23 | var lastname: String, 24 | var description: String? = null, 25 | @Id @GeneratedValue var id: Long? = null) -------------------------------------------------------------------------------- /Spring-Boot-and-Kotlin-Demo/src/main/kotlin/com/dailycodebuffer/example/SpringBootandKotlinDemo/blog/Repositories.kt: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.example.SpringBootandKotlinDemo.blog 2 | 3 | import org.springframework.data.repository.CrudRepository 4 | 5 | interface ArticleRepository : CrudRepository { 6 | fun findBySlug(slug: String): Article? 7 | fun findAllByOrderByAddedAtDesc(): Iterable
8 | } 9 | 10 | interface UserRepository : CrudRepository { 11 | fun findByLogin(login: String): User? 12 | } -------------------------------------------------------------------------------- /Spring-Boot-and-Kotlin-Demo/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | blog.title=Blog 2 | blog.banner.title=Warning 3 | blog.banner.content=The blog will be down tomorrow. 4 | -------------------------------------------------------------------------------- /Spring-Boot-and-Kotlin-Demo/src/main/resources/templates/article.mustache: -------------------------------------------------------------------------------- 1 | {{> header}} 2 | 3 |
4 |
5 |

{{article.title}}

6 | 7 |
8 | 9 |
10 | {{article.headline}} 11 | 12 | {{article.content}} 13 |
14 |
15 | 16 | {{> footer}} -------------------------------------------------------------------------------- /Spring-Boot-and-Kotlin-Demo/src/main/resources/templates/blog.mustache: -------------------------------------------------------------------------------- 1 | {{> header}} 2 | 3 |
4 | 5 | {{#banner.title}} 6 |
7 | 10 | 13 |
14 | {{/banner.title}} 15 | 16 | ... 17 | 18 |
19 | 20 | {{> footer}} -------------------------------------------------------------------------------- /Spring-Boot-and-Kotlin-Demo/src/main/resources/templates/footer.mustache: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Spring-Boot-and-Kotlin-Demo/src/main/resources/templates/header.mustache: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{title}} 4 | 5 | -------------------------------------------------------------------------------- /Spring-Boot-and-Kotlin-Demo/src/test/kotlin/com/dailycodebuffer/example/SpringBootandKotlinDemo/SpringBootAndKotlinDemoApplicationTests.kt: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.example.SpringBootandKotlinDemo 2 | 3 | import org.junit.jupiter.api.Test 4 | import org.springframework.boot.test.context.SpringBootTest 5 | 6 | @SpringBootTest 7 | class SpringBootAndKotlinDemoApplicationTests { 8 | 9 | @Test 10 | fun contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Spring-Boot-and-Kotlin-Demo/src/test/resources/junit-platform.properties: -------------------------------------------------------------------------------- 1 | junit.jupiter.testinstance.lifecycle.default = per_class -------------------------------------------------------------------------------- /Spring-Email-Client/.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-Email-Client/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/Spring-Email-Client/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /Spring-Email-Client/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /Spring-Email-Client/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.mail.host=smtp.gmail.com 2 | spring.mail.port=587 3 | spring.mail.username= 4 | spring.mail.password= 5 | spring.mail.properties.mail.smtp.auth=true 6 | spring.mail.properties.mail.smtp.starttls.enable=true 7 | -------------------------------------------------------------------------------- /Spring-Email-Client/src/test/java/com/dailycodebuffer/springemailclient/SpringEmailClientApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.springemailclient; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringEmailClientApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Spring-Security-Demo/.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-Security-Demo/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/Spring-Security-Demo/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /Spring-Security-Demo/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /Spring-Security-Demo/src/main/java/com/dailycodebuffer/springsecuritydemo/CustomUserDetailsService.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.springsecuritydemo; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.security.core.userdetails.UserDetails; 5 | import org.springframework.security.core.userdetails.UserDetailsService; 6 | import org.springframework.security.core.userdetails.UsernameNotFoundException; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class CustomUserDetailsService implements UserDetailsService { 11 | 12 | @Autowired 13 | private UserRepository userRepository; 14 | 15 | @Override 16 | public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { 17 | 18 | User user = userRepository.findByUsername(username); 19 | if(user ==null) { 20 | throw new UsernameNotFoundException("User Not Found"); 21 | } 22 | return new CustomUserDetails(user); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Spring-Security-Demo/src/main/java/com/dailycodebuffer/springsecuritydemo/HomeController.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.springsecuritydemo; 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 home(){ 11 | return "This is Home Page"; 12 | } 13 | 14 | @GetMapping("/admin") 15 | public String admin(){ 16 | return "This is Admin Page"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Spring-Security-Demo/src/main/java/com/dailycodebuffer/springsecuritydemo/SpringSecurityDemoApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.springsecuritydemo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringSecurityDemoApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringSecurityDemoApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Spring-Security-Demo/src/main/java/com/dailycodebuffer/springsecuritydemo/UserRepository.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.springsecuritydemo; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import org.springframework.stereotype.Repository; 5 | 6 | @Repository 7 | public interface UserRepository extends JpaRepository { 8 | 9 | User findByUsername(String username); 10 | } 11 | -------------------------------------------------------------------------------- /Spring-Security-Demo/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | spring.datasource.url=jdbc:mysql://localhost:3306/dev 3 | spring.datasource.username=root 4 | spring.datasource.password=admin -------------------------------------------------------------------------------- /Spring-Security-Demo/src/test/java/com/dailycodebuffer/springsecuritydemo/SpringSecurityDemoApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.springsecuritydemo; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringSecurityDemoApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Spring-Transactional/.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-Transactional/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/Spring-Transactional/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /Spring-Transactional/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /Spring-Transactional/src/main/java/com/dailycodebuffer/transaction/SpringTransactionalApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.transaction; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringTransactionalApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringTransactionalApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Spring-Transactional/src/main/java/com/dailycodebuffer/transaction/controller/EmployeeController.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.transaction.controller; 2 | 3 | import com.dailycodebuffer.transaction.service.EmployeeService; 4 | import com.dailycodebuffer.transaction.vo.EmployeeRequestVO; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.PostMapping; 7 | import org.springframework.web.bind.annotation.RequestBody; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | @RestController 11 | public class EmployeeController { 12 | 13 | @Autowired 14 | private EmployeeService employeeService; 15 | 16 | @PostMapping("/employee") 17 | public String saveEmployee(@RequestBody EmployeeRequestVO employeeRequestVO){ 18 | return employeeService.saveEmployee(employeeRequestVO); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Spring-Transactional/src/main/java/com/dailycodebuffer/transaction/entity/Department.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.transaction.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import javax.persistence.Entity; 8 | import javax.persistence.GeneratedValue; 9 | import javax.persistence.GenerationType; 10 | import javax.persistence.Id; 11 | 12 | @Entity 13 | @Data 14 | @AllArgsConstructor 15 | @NoArgsConstructor 16 | public class Department { 17 | 18 | @Id 19 | @GeneratedValue(strategy = GenerationType.AUTO) 20 | private Long departmentId; 21 | private String departmentName; 22 | private String departmentCode; 23 | } 24 | -------------------------------------------------------------------------------- /Spring-Transactional/src/main/java/com/dailycodebuffer/transaction/entity/Employee.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.transaction.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import javax.persistence.Entity; 8 | import javax.persistence.GeneratedValue; 9 | import javax.persistence.GenerationType; 10 | import javax.persistence.Id; 11 | 12 | @Entity 13 | @Data 14 | @NoArgsConstructor 15 | @AllArgsConstructor 16 | public class Employee { 17 | 18 | @Id 19 | @GeneratedValue(strategy = GenerationType.AUTO) 20 | private Long employeeId; 21 | private String empName; 22 | 23 | private String email; 24 | 25 | private Long departmentId; 26 | } 27 | -------------------------------------------------------------------------------- /Spring-Transactional/src/main/java/com/dailycodebuffer/transaction/repository/DepartmentRepository.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.transaction.repository; 2 | 3 | import com.dailycodebuffer.transaction.entity.Department; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | @Repository 8 | public interface DepartmentRepository extends JpaRepository { 9 | } 10 | -------------------------------------------------------------------------------- /Spring-Transactional/src/main/java/com/dailycodebuffer/transaction/repository/EmployeeRepository.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.transaction.repository; 2 | 3 | import com.dailycodebuffer.transaction.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 | -------------------------------------------------------------------------------- /Spring-Transactional/src/main/java/com/dailycodebuffer/transaction/vo/EmployeeRequestVO.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.transaction.vo; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @AllArgsConstructor 9 | @NoArgsConstructor 10 | public class EmployeeRequestVO { 11 | 12 | private String empName; 13 | private String email; 14 | private String departmentName; 15 | } 16 | -------------------------------------------------------------------------------- /Spring-Transactional/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | spring.h2.console.enabled=true 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 | 9 | server.port = 8083 -------------------------------------------------------------------------------- /Spring-Transactional/src/test/java/com/dailycodebuffer/transaction/SpringTransactionalApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.transaction; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringTransactionalApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Spring-boot-custom-JSON/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 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 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /Spring-boot-custom-JSON/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/Spring-boot-custom-JSON/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /Spring-boot-custom-JSON/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.2/apache-maven-3.6.2-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar 3 | -------------------------------------------------------------------------------- /Spring-boot-custom-JSON/src/main/java/com/dailycodebuffer/example/SpringBootCustomJSON/SpringBootCustomJsonApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.example.SpringBootCustomJSON; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringBootCustomJsonApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringBootCustomJsonApplication.class, args); 11 | } 12 | 13 | 14 | } 15 | -------------------------------------------------------------------------------- /Spring-boot-custom-JSON/src/main/java/com/dailycodebuffer/example/SpringBootCustomJSON/controller/EmployeeController.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.example.SpringBootCustomJSON.controller; 2 | 3 | import com.dailycodebuffer.example.SpringBootCustomJSON.model.Employee; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | 7 | import java.util.List; 8 | 9 | @RestController 10 | public class EmployeeController { 11 | 12 | @RequestMapping("/getEmployees") 13 | public List getEmployees() { 14 | return Employee.getEmployee(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Spring-boot-custom-JSON/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Spring-boot-custom-JSON/src/test/java/com/dailycodebuffer/example/SpringBootCustomJSON/SpringBootCustomJsonApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.example.SpringBootCustomJSON; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringBootCustomJsonApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | assert true; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /SpringBoot-MySQLDemo/.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-MySQLDemo/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/SpringBoot-MySQLDemo/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /SpringBoot-MySQLDemo/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /SpringBoot-MySQLDemo/src/main/java/com/dailycodebuffer/SpringBootMySQlDemoApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.data.jpa.repository.config.EnableJpaRepositories; 6 | 7 | @SpringBootApplication 8 | @EnableJpaRepositories 9 | public class SpringBootMySQlDemoApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(SpringBootMySQlDemoApplication.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /SpringBoot-MySQLDemo/src/main/java/com/dailycodebuffer/User.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.*; 6 | 7 | @Entity(name = "tbl_user") 8 | @Data 9 | public class User { 10 | 11 | @Id 12 | @GeneratedValue(strategy = GenerationType.AUTO) 13 | @Column(name = "user_id") 14 | private Integer userId; 15 | 16 | @Column(name = "user_name") 17 | private String userName; 18 | 19 | @Column(name = "email_id") 20 | private String emailId; 21 | 22 | private Integer age; 23 | } 24 | -------------------------------------------------------------------------------- /SpringBoot-MySQLDemo/src/main/java/com/dailycodebuffer/UserController.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | import org.springframework.web.bind.annotation.PostMapping; 6 | import org.springframework.web.bind.annotation.RequestBody; 7 | import org.springframework.web.bind.annotation.RestController; 8 | 9 | import java.util.List; 10 | 11 | @RestController 12 | public class UserController { 13 | 14 | @Autowired 15 | private UserRepository userRepository; 16 | 17 | @PostMapping("/user") 18 | public String createUser(@RequestBody User user) { 19 | userRepository.save(user); 20 | return "User Added Successfully!!"; 21 | } 22 | 23 | @GetMapping("/user") 24 | public List getAllUser() { 25 | return userRepository.findAll(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /SpringBoot-MySQLDemo/src/main/java/com/dailycodebuffer/UserRepository.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | 5 | public interface UserRepository extends JpaRepository { 6 | } 7 | -------------------------------------------------------------------------------- /SpringBoot-MySQLDemo/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port = 8081 2 | 3 | spring.jpa.hibernate.ddl-auto=update 4 | spring.datasource.url=jdbc:mysql://localhost:3306/myapplication 5 | spring.datasource.username=root 6 | spring.datasource.password=root 7 | -------------------------------------------------------------------------------- /SpringBoot-MySQLDemo/src/test/java/com/dailycodebuffer/SpringBootMySQlDemoApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringBootMySQlDemoApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /SpringBoot-Redis-Demo/.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-Redis-Demo/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/SpringBoot-Redis-Demo/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /SpringBoot-Redis-Demo/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /SpringBoot-Redis-Demo/src/main/java/com/dailycodebuffer/SpringBootRedisDemoApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringBootRedisDemoApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringBootRedisDemoApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /SpringBoot-Redis-Demo/src/main/java/com/dailycodebuffer/model/User.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.model; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | @Data 8 | public class User implements Serializable { 9 | 10 | private Long id; 11 | private String firstName; 12 | private String lastName; 13 | private String emailId; 14 | private int age; 15 | } 16 | -------------------------------------------------------------------------------- /SpringBoot-Redis-Demo/src/main/java/com/dailycodebuffer/repository/UserDao.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.repository; 2 | 3 | import com.dailycodebuffer.model.User; 4 | 5 | import java.util.List; 6 | 7 | public interface UserDao { 8 | boolean saveUser(User user); 9 | 10 | List fetchAllUser(); 11 | 12 | User fetchUserById(Long id); 13 | 14 | boolean deleteUser(Long id); 15 | 16 | boolean updateUser(Long id, User user); 17 | } 18 | -------------------------------------------------------------------------------- /SpringBoot-Redis-Demo/src/main/java/com/dailycodebuffer/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.service; 2 | 3 | import com.dailycodebuffer.model.User; 4 | 5 | import java.util.List; 6 | 7 | public interface UserService { 8 | 9 | boolean saveUser(User user); 10 | 11 | List fetchAllUser(); 12 | 13 | User fetchUserById(Long id); 14 | 15 | boolean deleteUser(Long id); 16 | 17 | boolean updateUser(Long id, User user); 18 | } 19 | -------------------------------------------------------------------------------- /SpringBoot-Redis-Demo/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port = 8083 2 | -------------------------------------------------------------------------------- /SpringBoot-Redis-Demo/src/test/java/com/dailycodebuffer/SpringBootRedisDemoApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringBootRedisDemoApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /SpringLogging/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 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 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /SpringLogging/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/SpringLogging/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /SpringLogging/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /SpringLogging/logs/app.log: -------------------------------------------------------------------------------- 1 | 2020-02-21 21:48:05,805 INFO com.dailycodebuffer.HomeController [http-nio-8080-exec-7] FATAL ERROR 2 | -------------------------------------------------------------------------------- /SpringLogging/src/main/java/com/dailycodebuffer/HomeController.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.RestController; 7 | 8 | @RestController 9 | public class HomeController { 10 | 11 | Logger logger = LoggerFactory.getLogger(HomeController.class); 12 | 13 | @GetMapping("/hello") 14 | public String hello() 15 | { 16 | logger.info("FATAL ERROR"); 17 | return "Hello Daily Code Buffer!!"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SpringLogging/src/main/java/com/dailycodebuffer/SpringLoggingApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringLoggingApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringLoggingApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /SpringLogging/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | #logging.level.com.dailycodebuffer = TRACE 2 | # 3 | # 4 | #logging.pattern.console=%d [%level] %c{1.} [%t] %m%n 5 | #logging.file = appLog.log 6 | #logging.pattern.file=%d [%level] %c{1.} [%t] %m%n 7 | -------------------------------------------------------------------------------- /SpringLogging/src/test/java/com/dailycodebuffer/SpringLoggingApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringLoggingApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /apache-kafka-consumer-demo/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 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 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /apache-kafka-consumer-demo/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/apache-kafka-consumer-demo/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /apache-kafka-consumer-demo/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /apache-kafka-consumer-demo/src/main/java/com/dailycodebuffer/kafka/ApacheKafkaConsumerDemoApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.kafka; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class ApacheKafkaConsumerDemoApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(ApacheKafkaConsumerDemoApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /apache-kafka-consumer-demo/src/main/java/com/dailycodebuffer/kafka/consumer/KafkaConsumer.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.kafka.consumer; 2 | 3 | import org.springframework.kafka.annotation.KafkaListener; 4 | import org.springframework.stereotype.Component; 5 | 6 | @Component 7 | public class KafkaConsumer { 8 | 9 | @KafkaListener(topics = "NewTopic", groupId = "group_id") 10 | public void consume(String message) 11 | { 12 | System.out.println("message = " + message); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /apache-kafka-consumer-demo/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | server.port=8081 -------------------------------------------------------------------------------- /apache-kafka-consumer-demo/src/test/java/com/dailycodebuffer/kafka/ApacheKafkaConsumerDemoApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.kafka; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class ApacheKafkaConsumerDemoApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /apache-kafka-producer-demo/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 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 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /apache-kafka-producer-demo/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/apache-kafka-producer-demo/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /apache-kafka-producer-demo/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /apache-kafka-producer-demo/src/main/java/com/dailycodebuffer/kafka/ApacheKafkaProducerDemoApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.kafka; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class ApacheKafkaProducerDemoApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(ApacheKafkaProducerDemoApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /apache-kafka-producer-demo/src/main/java/com/dailycodebuffer/kafka/Book.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.kafka; 2 | 3 | public class Book { 4 | 5 | private String bookName; 6 | private String isbn; 7 | 8 | public String getBookName() { 9 | return bookName; 10 | } 11 | 12 | public void setBookName(String bookName) { 13 | this.bookName = bookName; 14 | } 15 | 16 | public String getIsbn() { 17 | return isbn; 18 | } 19 | 20 | public void setIsbn(String isbn) { 21 | this.isbn = isbn; 22 | } 23 | 24 | public Book(String bookName, String isbn) { 25 | this.bookName = bookName; 26 | this.isbn = isbn; 27 | } 28 | 29 | public Book() { 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /apache-kafka-producer-demo/src/main/java/com/dailycodebuffer/kafka/DemoController.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.kafka; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.kafka.core.KafkaTemplate; 5 | import org.springframework.web.bind.annotation.*; 6 | 7 | @RestController 8 | public class DemoController { 9 | 10 | @Autowired 11 | KafkaTemplate kafkaTemplate; 12 | 13 | private static final String TOPIC = "NewTopic"; 14 | 15 | @PostMapping("/publish") 16 | public String publishMessage(@RequestBody Book book) 17 | { 18 | kafkaTemplate.send(TOPIC, book); 19 | return "Published Successfully!"; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /apache-kafka-producer-demo/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port = 8081 2 | -------------------------------------------------------------------------------- /apache-kafka-producer-demo/src/test/java/com/dailycodebuffer/kafka/ApacheKafkaProducerDemoApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.kafka; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class ApacheKafkaProducerDemoApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /buildpackdemo/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 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 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /buildpackdemo/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/buildpackdemo/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /buildpackdemo/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /buildpackdemo/src/main/java/com/dailycodebuffer/buildpackdemo/BuildpackdemoApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.buildpackdemo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class BuildpackdemoApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(BuildpackdemoApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /buildpackdemo/src/main/java/com/dailycodebuffer/buildpackdemo/HomeController.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.buildpackdemo; 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("/") 10 | public String home() { 11 | return "Welcome to Daily Code Buffer !!"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /buildpackdemo/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8081 2 | -------------------------------------------------------------------------------- /buildpackdemo/src/test/java/com/dailycodebuffer/buildpackdemo/BuildpackdemoApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.buildpackdemo; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class BuildpackdemoApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /dekorate/.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 | -------------------------------------------------------------------------------- /dekorate/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/dekorate/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /dekorate/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /dekorate/skaffold.yml: -------------------------------------------------------------------------------- 1 | apiVersion: skaffold/v2beta10 2 | kind: Config 3 | build: 4 | artifacts: 5 | - image: shabb/dekorate 6 | jib: {} 7 | 8 | deploy: 9 | kubectl: 10 | manifests: 11 | - target/classes/META-INF/dekorate/*.yml -------------------------------------------------------------------------------- /dekorate/src/main/java/com/dailycodebuffer/dekorate/DekorateApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.dekorate; 2 | 3 | import io.dekorate.kubernetes.annotation.KubernetesApplication; 4 | import io.dekorate.kubernetes.annotation.Label; 5 | import io.dekorate.kubernetes.annotation.Port; 6 | import org.springframework.boot.SpringApplication; 7 | import org.springframework.boot.autoconfigure.SpringBootApplication; 8 | 9 | @SpringBootApplication 10 | @KubernetesApplication( 11 | replicas = 4, 12 | ports = @Port(name = "http", containerPort = 9090), 13 | labels = @Label(key = "version", value = "v1"), 14 | expose = false 15 | ) 16 | public class DekorateApplication { 17 | 18 | public static void main(String[] args) { 19 | SpringApplication.run(DekorateApplication.class, args); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /dekorate/src/main/java/com/dailycodebuffer/dekorate/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.dekorate; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class HelloController { 8 | 9 | @GetMapping("/") 10 | public String hello() { 11 | return "Hello!!"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /dekorate/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port = 9090 2 | -------------------------------------------------------------------------------- /dekorate/src/test/java/com/dailycodebuffer/dekorate/DekorateApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.dekorate; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class DekorateApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /dockerpublish/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 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 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /dockerpublish/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/dockerpublish/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /dockerpublish/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /dockerpublish/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:11 2 | ARG JAR_FILE=target/*.jar 3 | COPY ${JAR_FILE} app.jar 4 | ENTRYPOINT ["java","-jar","/app.jar"] -------------------------------------------------------------------------------- /dockerpublish/src/main/java/com/dailycodebuffer/dockerpublish/DockerpublishApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.dockerpublish; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class DockerpublishApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(DockerpublishApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /dockerpublish/src/main/java/com/dailycodebuffer/dockerpublish/HomeController.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.dockerpublish; 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("/") 10 | public String home() { 11 | return "Subscribe to Daily Code Buffer !!"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /dockerpublish/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port = 9091 2 | -------------------------------------------------------------------------------- /dockerpublish/src/test/java/com/dailycodebuffer/dockerpublish/DockerpublishApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.dockerpublish; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class DockerpublishApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /openapi-documentation/.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 | -------------------------------------------------------------------------------- /openapi-documentation/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/openapi-documentation/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /openapi-documentation/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /openapi-documentation/src/main/java/com/dailycodebuffer/OpenapiDocumentationApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import io.swagger.v3.oas.annotations.OpenAPIDefinition; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | @SpringBootApplication 8 | @OpenAPIDefinition 9 | public class OpenapiDocumentationApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(OpenapiDocumentationApplication.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /openapi-documentation/src/main/java/com/dailycodebuffer/entity/Book.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.entity; 2 | 3 | import lombok.*; 4 | 5 | import javax.persistence.*; 6 | 7 | @Entity 8 | @Data 9 | public class Book { 10 | 11 | @Id 12 | @GeneratedValue(strategy = GenerationType.AUTO) 13 | private long id; 14 | 15 | @Column 16 | private String title; 17 | 18 | @Column 19 | private String author; 20 | 21 | @Column 22 | private String price; 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /openapi-documentation/src/main/java/com/dailycodebuffer/exception/BookIdMismatchException.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.exception; 2 | 3 | public class BookIdMismatchException extends RuntimeException { 4 | 5 | public BookIdMismatchException() { 6 | } 7 | 8 | public BookIdMismatchException(String message) { 9 | super(message); 10 | } 11 | 12 | public BookIdMismatchException(String message, Throwable cause) { 13 | super(message, cause); 14 | } 15 | 16 | public BookIdMismatchException(Throwable cause) { 17 | super(cause); 18 | } 19 | 20 | public BookIdMismatchException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 21 | super(message, cause, enableSuppression, writableStackTrace); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /openapi-documentation/src/main/java/com/dailycodebuffer/exception/BookNotFoundException.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.exception; 2 | 3 | public class BookNotFoundException extends RuntimeException { 4 | 5 | public BookNotFoundException() { 6 | } 7 | 8 | public BookNotFoundException(String message) { 9 | super(message); 10 | } 11 | 12 | public BookNotFoundException(String message, Throwable cause) { 13 | super(message, cause); 14 | } 15 | 16 | public BookNotFoundException(Throwable cause) { 17 | super(cause); 18 | } 19 | 20 | public BookNotFoundException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 21 | super(message, cause, enableSuppression, writableStackTrace); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /openapi-documentation/src/main/java/com/dailycodebuffer/exception/CustomExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.exception; 2 | 3 | import org.springframework.http.HttpHeaders; 4 | import org.springframework.http.HttpStatus; 5 | import org.springframework.http.ResponseEntity; 6 | import org.springframework.web.bind.annotation.ExceptionHandler; 7 | import org.springframework.web.bind.annotation.RestControllerAdvice; 8 | import org.springframework.web.context.request.WebRequest; 9 | import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; 10 | 11 | @RestControllerAdvice 12 | public class CustomExceptionHandler extends ResponseEntityExceptionHandler { 13 | 14 | @ExceptionHandler({BookNotFoundException.class}) 15 | protected ResponseEntity handleNotFoundException(Exception ex, WebRequest request) 16 | { 17 | return handleExceptionInternal(ex, "Book Not Found ",new HttpHeaders(), HttpStatus.NOT_FOUND, request); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /openapi-documentation/src/main/java/com/dailycodebuffer/repository/BookRepository.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.repository; 2 | 3 | import com.dailycodebuffer.entity.Book; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Service; 6 | 7 | @Service 8 | public interface BookRepository extends JpaRepository { 9 | } 10 | -------------------------------------------------------------------------------- /openapi-documentation/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | server.port=8081 3 | 4 | spring.datasource.driver-class-name=org.h2.Driver 5 | spring.datasource.url=jdbc:h2:mem:bootapp;DB_CLOSE_DELAY=-1 6 | spring.datasource.username=sa 7 | spring.datasource.password= -------------------------------------------------------------------------------- /openapi-documentation/src/test/java/com/dailycodebuffer/OpenapiDocumentationApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class OpenapiDocumentationApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /skaffold-demo/.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 | -------------------------------------------------------------------------------- /skaffold-demo/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/skaffold-demo/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /skaffold-demo/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /skaffold-demo/k8s-deploy.yml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: skaffold-demo-app 5 | labels: 6 | app: skaffold-demo-app 7 | spec: 8 | replicas: 3 9 | selector: 10 | matchLabels: 11 | app: skaffold-demo-app 12 | template: 13 | metadata: 14 | labels: 15 | app: skaffold-demo-app 16 | spec: 17 | containers: 18 | - name: skaffold-demo-app 19 | image: skaffold-demo 20 | ports: 21 | - containerPort: 8080 -------------------------------------------------------------------------------- /skaffold-demo/k8s-svc.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: skaffold-demo-svc 5 | spec: 6 | type: LoadBalancer 7 | ports: 8 | - port: 8081 9 | targetPort: 8080 10 | protocol: TCP 11 | selector: 12 | app: skaffold-demo-app -------------------------------------------------------------------------------- /skaffold-demo/skaffold.yml: -------------------------------------------------------------------------------- 1 | apiVersion: skaffold/v2beta10 2 | kind: Config 3 | build: 4 | artifacts: 5 | - image: skaffold-demo 6 | jib: {} 7 | 8 | deploy: 9 | kubectl: 10 | manifests: 11 | - k8s-* -------------------------------------------------------------------------------- /skaffold-demo/src/main/java/com/dailycodebuffer/skaffold/MainController.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.skaffold; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class MainController { 8 | 9 | @GetMapping("/main") 10 | public String main() { 11 | return "This app is deployed using Skaffold Dev!!!"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /skaffold-demo/src/main/java/com/dailycodebuffer/skaffold/SkaffoldDemoApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.skaffold; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SkaffoldDemoApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SkaffoldDemoApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /skaffold-demo/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /skaffold-demo/src/test/java/com/dailycodebuffer/skaffold/SkaffoldDemoApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.skaffold; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SkaffoldDemoApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /sns-springboot-demo/.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 | -------------------------------------------------------------------------------- /sns-springboot-demo/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/sns-springboot-demo/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /sns-springboot-demo/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /sns-springboot-demo/src/main/java/com/dailycodebuffer/sns/SnsSpringbootDemoApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.sns; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SnsSpringbootDemoApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SnsSpringbootDemoApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /sns-springboot-demo/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /sns-springboot-demo/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | cloud: 2 | aws: 3 | region: 4 | static: us-east-1 5 | auto: false 6 | stack: 7 | auto: false 8 | 9 | server: 10 | port: 8083 -------------------------------------------------------------------------------- /sns-springboot-demo/src/test/java/com/dailycodebuffer/sns/SnsSpringbootDemoApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.sns; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SnsSpringbootDemoApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-boot-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-aws/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/spring-boot-aws/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /spring-boot-aws/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /spring-boot-aws/src/main/java/com/dailycodebuffer/aws/BasicController.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.aws; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class BasicController { 8 | 9 | @GetMapping("/") 10 | public String home() { 11 | return "This is Deployed to AWS EC2 and S3 !!!"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /spring-boot-aws/src/main/java/com/dailycodebuffer/aws/SpringBootAwsApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.aws; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringBootAwsApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringBootAwsApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-boot-aws/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=9091 2 | -------------------------------------------------------------------------------- /spring-boot-aws/src/test/java/com/dailycodebuffer/aws/SpringBootAwsApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.aws; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringBootAwsApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-boot-facebook-oauth-demo/.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-facebook-oauth-demo/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/spring-boot-facebook-oauth-demo/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /spring-boot-facebook-oauth-demo/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /spring-boot-facebook-oauth-demo/src/main/java/com/dailycodebuffer/BasicController.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.springframework.security.oauth2.provider.OAuth2Authentication; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | 7 | import java.security.Principal; 8 | import java.util.Map; 9 | 10 | @RestController 11 | public class BasicController { 12 | 13 | @GetMapping("/") 14 | public String home(Principal principal) { 15 | Map authDetails = (Map) ((OAuth2Authentication) principal) 16 | .getUserAuthentication() 17 | .getDetails(); 18 | 19 | String userName = (String) authDetails.get("name"); 20 | 21 | return "Hey " + userName + ", Welcome to Daily Code Buffer!!"; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /spring-boot-facebook-oauth-demo/src/main/java/com/dailycodebuffer/SpringBootFacebookOauthDemoApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso; 6 | 7 | @SpringBootApplication 8 | @EnableOAuth2Sso 9 | public class SpringBootFacebookOauthDemoApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(SpringBootFacebookOauthDemoApplication.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /spring-boot-facebook-oauth-demo/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /spring-boot-facebook-oauth-demo/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 9091 3 | 4 | spring: 5 | application: 6 | name: spring-boot-facebook-oauth-demo 7 | 8 | security: 9 | oauth2: 10 | client: 11 | clientId: 12 | clientSecret: 13 | accessTokenUri: https://graph.facebook.com/oauth/access_token 14 | userAuthorizationUri: https://www.facebook.com/dialog/oauth 15 | tokenName: oauth_token 16 | authenticationScheme: query 17 | clientAuthenticationScheme: form 18 | resource: 19 | userInfoUri: https://graph.facebook.com/me -------------------------------------------------------------------------------- /spring-boot-facebook-oauth-demo/src/test/java/com/dailycodebuffer/SpringBootFacebookOauthDemoApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringBootFacebookOauthDemoApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-boot-http-converter/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 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 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /spring-boot-http-converter/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/spring-boot-http-converter/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /spring-boot-http-converter/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /spring-boot-http-converter/README.md: -------------------------------------------------------------------------------- 1 | # Spring-MVC-Tutorial 2 | All Projects related to Spring MVC Tutorial 3 | -------------------------------------------------------------------------------- /spring-boot-http-converter/src/main/java/com/dailycodebuffer/examples/springboothttpconverter/Repository/EmployeeRepository.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.examples.springboothttpconverter.Repository; 2 | 3 | 4 | import com.dailycodebuffer.examples.springboothttpconverter.Entity.Employee; 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | 7 | public interface EmployeeRepository extends JpaRepository { 8 | 9 | 10 | } 11 | -------------------------------------------------------------------------------- /spring-boot-http-converter/src/main/java/com/dailycodebuffer/examples/springboothttpconverter/SpringBootHttpConverterApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.examples.springboothttpconverter; 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 9 | public class SpringBootHttpConverterApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(SpringBootHttpConverterApplication.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /spring-boot-http-converter/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /spring-boot-http-converter/src/test/java/com/dailycodebuffer/examples/springboothttpconverter/SpringBootHttpConverterApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.examples.springboothttpconverter; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class SpringBootHttpConverterApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-cloud-functions/.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-cloud-functions/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/spring-cloud-functions/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /spring-cloud-functions/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /spring-cloud-functions/src/main/java/com/dailycodebuffer/spring/function/EmployeeData.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.spring.function; 2 | 3 | import java.util.List; 4 | 5 | public class EmployeeData { 6 | 7 | private List employees; 8 | 9 | public List getEmployees() { 10 | return employees; 11 | } 12 | 13 | public void setEmployees(List employees) { 14 | this.employees = employees; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /spring-cloud-functions/src/main/java/com/dailycodebuffer/spring/function/GetEmployees.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.spring.function; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.function.Supplier; 6 | 7 | public class GetEmployees implements Supplier { 8 | 9 | 10 | @Override 11 | public EmployeeData get() { 12 | EmployeeData employeeData 13 | = new EmployeeData(); 14 | employeeData.setEmployees(this.employees()); 15 | 16 | return employeeData; 17 | } 18 | 19 | 20 | //Consider getting Data form Database 21 | private List employees() { 22 | return new ArrayList() {{ 23 | add(new Employee("1","Shabbir","shabbir@gmail.com")); 24 | add(new Employee("2","Nikhil","nikhil@gmail.com")); 25 | add(new Employee("3","Shivam","shivam@gmail.com")); 26 | add(new Employee("4","Shankhadeep","Shankhadeep@gmail.com")); 27 | }}; 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /spring-cloud-functions/src/main/java/com/dailycodebuffer/spring/function/ToLowerCase.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.spring.function; 2 | 3 | import java.util.function.Function; 4 | 5 | public class ToLowerCase implements Function { 6 | 7 | 8 | @Override 9 | public String apply(String s) { 10 | return new StringBuilder(s).toString().toLowerCase(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /spring-cloud-functions/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | spring.cloud.function.scan.packages = com.dailycodebuffer.spring.function -------------------------------------------------------------------------------- /spring-cloud-functions/src/test/java/com/dailycodebuffer/spring/function/SpringCloudFunctionsApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.spring.function; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringCloudFunctionsApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-rabbitmq-consumer/.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-rabbitmq-consumer/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/spring-rabbitmq-consumer/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /spring-rabbitmq-consumer/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /spring-rabbitmq-consumer/src/main/java/com/dailycodebuffer/mq/CustomMessage.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.mq; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | import lombok.ToString; 7 | 8 | import java.util.Date; 9 | 10 | @Data 11 | @NoArgsConstructor 12 | @AllArgsConstructor 13 | @ToString 14 | public class CustomMessage { 15 | 16 | private String messageId; 17 | private String message; 18 | private Date messageDate; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /spring-rabbitmq-consumer/src/main/java/com/dailycodebuffer/mq/MessageListener.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.mq; 2 | 3 | import org.springframework.amqp.rabbit.annotation.RabbitListener; 4 | import org.springframework.stereotype.Component; 5 | 6 | @Component 7 | public class MessageListener { 8 | 9 | @RabbitListener(queues = MQConfig.QUEUE) 10 | public void listener(CustomMessage message) { 11 | System.out.println(message); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /spring-rabbitmq-consumer/src/main/java/com/dailycodebuffer/mq/SpringRabbitmqConsumerApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.mq; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringRabbitmqConsumerApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringRabbitmqConsumerApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-rabbitmq-consumer/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port = 9001 2 | spring.rabbitmq.addresses = localhost:5672 -------------------------------------------------------------------------------- /spring-rabbitmq-consumer/src/test/java/com/dailycodebuffer/mq/SpringRabbitmqConsumerApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.mq; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringRabbitmqConsumerApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-rabbitmq-producer/.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-rabbitmq-producer/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/spring-rabbitmq-producer/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /spring-rabbitmq-producer/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /spring-rabbitmq-producer/src/main/java/com/dailycodebuffer/mq/CustomMessage.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.mq; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | import lombok.ToString; 7 | 8 | import java.util.Date; 9 | 10 | @Data 11 | @NoArgsConstructor 12 | @AllArgsConstructor 13 | @ToString 14 | public class CustomMessage { 15 | 16 | private String messageId; 17 | private String message; 18 | private Date messageDate; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /spring-rabbitmq-producer/src/main/java/com/dailycodebuffer/mq/MessagePublisher.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.mq; 2 | 3 | import org.springframework.amqp.rabbit.core.RabbitTemplate; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.web.bind.annotation.PostMapping; 6 | import org.springframework.web.bind.annotation.RequestBody; 7 | import org.springframework.web.bind.annotation.RestController; 8 | 9 | import java.util.Date; 10 | import java.util.UUID; 11 | 12 | @RestController 13 | public class MessagePublisher { 14 | 15 | @Autowired 16 | private RabbitTemplate template; 17 | 18 | @PostMapping("/publish") 19 | public String publishMessage(@RequestBody CustomMessage message) { 20 | message.setMessageId(UUID.randomUUID().toString()); 21 | message.setMessageDate(new Date()); 22 | template.convertAndSend(MQConfig.EXCHANGE, 23 | MQConfig.ROUTING_KEY, message); 24 | 25 | return "Message Published"; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /spring-rabbitmq-producer/src/main/java/com/dailycodebuffer/mq/SpringRabbitmqProducerApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.mq; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringRabbitmqProducerApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringRabbitmqProducerApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-rabbitmq-producer/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port = 9000 2 | spring.rabbitmq.addresses = localhost:5672 -------------------------------------------------------------------------------- /spring-rabbitmq-producer/src/test/java/com/dailycodebuffer/mq/SpringRabbitmqProducerApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.mq; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringRabbitmqProducerApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-websocket/.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-websocket/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dailycodebuffer/Spring-MVC-Tutorials/37893a96936e700fc8b2e7e13cf5e95135cd22e5/spring-websocket/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /spring-websocket/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /spring-websocket/src/main/java/com/dailycodebuffer/websocket/Greeting.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.websocket; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @NoArgsConstructor 9 | @AllArgsConstructor 10 | public class Greeting { 11 | 12 | private String message; 13 | } 14 | -------------------------------------------------------------------------------- /spring-websocket/src/main/java/com/dailycodebuffer/websocket/GreetingController.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.websocket; 2 | 3 | import org.springframework.messaging.handler.annotation.MessageMapping; 4 | import org.springframework.messaging.handler.annotation.SendTo; 5 | import org.springframework.stereotype.Controller; 6 | import org.springframework.web.util.HtmlUtils; 7 | 8 | @Controller 9 | public class GreetingController { 10 | 11 | @MessageMapping("/hello") 12 | @SendTo("/topic/greetings") 13 | public Greeting greet(HelloMessage message) throws InterruptedException { 14 | Thread.sleep(2000); 15 | return new Greeting("Hello, " + 16 | HtmlUtils.htmlEscape(message.getName())); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /spring-websocket/src/main/java/com/dailycodebuffer/websocket/HelloMessage.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.websocket; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @NoArgsConstructor 9 | @AllArgsConstructor 10 | public class HelloMessage { 11 | 12 | private String name; 13 | } 14 | -------------------------------------------------------------------------------- /spring-websocket/src/main/java/com/dailycodebuffer/websocket/SpringWebsocketApplication.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.websocket; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringWebsocketApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringWebsocketApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-websocket/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /spring-websocket/src/main/resources/static/main.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #f5f5f5; 3 | } 4 | 5 | #main-content { 6 | max-width: 940px; 7 | padding: 2em 3em; 8 | margin: 0 auto 20px; 9 | background-color: #fff; 10 | border: 1px solid #e5e5e5; 11 | -webkit-border-radius: 5px; 12 | -moz-border-radius: 5px; 13 | border-radius: 5px; 14 | } -------------------------------------------------------------------------------- /spring-websocket/src/test/java/com/dailycodebuffer/websocket/SpringWebsocketApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.dailycodebuffer.websocket; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringWebsocketApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | --------------------------------------------------------------------------------