{"id":32627579,"url":"https://github.com/maearon/spring-boilerplate","last_synced_at":"2026-02-27T10:35:28.210Z","repository":{"id":293015260,"uuid":"982603126","full_name":"maearon/spring-boilerplate","owner":"maearon","description":"Social App Angular 19 with Ngrx AngularHttpClient + Spring Boot ActiveStorage app provide two annotation  │   └── HasOneAttached.java │   └── HasManyAttached.java to attach file single or multiple file to any model entity","archived":false,"fork":false,"pushed_at":"2025-06-11T01:07:10.000Z","size":60279,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-11T01:18:31.912Z","etag":null,"topics":["java","jwt","lombok","postgresql","spring","spring-boot","spring-boot-3","spring-data-jpa","spring-security","spring-validation"],"latest_commit_sha":null,"homepage":"https://angular-boilerplate-eta-sepia.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maearon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-13T06:23:09.000Z","updated_at":"2025-06-11T01:07:14.000Z","dependencies_parsed_at":"2025-06-11T01:18:30.837Z","dependency_job_id":"04c56e08-99d3-4315-95df-a265d57f3b62","html_url":"https://github.com/maearon/spring-boilerplate","commit_stats":null,"previous_names":["maearon/spring-boilerplate","maearon/spring-attach-file"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/maearon/spring-boilerplate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maearon%2Fspring-boilerplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maearon%2Fspring-boilerplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maearon%2Fspring-boilerplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maearon%2Fspring-boilerplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maearon","download_url":"https://codeload.github.com/maearon/spring-boilerplate/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maearon%2Fspring-boilerplate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281889374,"owners_count":26578952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-30T02:00:06.501Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","jwt","lombok","postgresql","spring","spring-boot","spring-boot-3","spring-data-jpa","spring-security","spring-validation"],"created_at":"2025-10-30T21:43:10.873Z","updated_at":"2025-10-30T21:43:12.961Z","avatar_url":"https://github.com/maearon.png","language":"TypeScript","readme":"### Social App Angular 19 StandAlone Mode + Spring Boot only API + Thymeleaf\n\n\n```\n1998  cd angular-boilerplate/\n 1999  ng build --configuration=production\n 2000  sudo apt update\n 2001  sudo apt install nodejs npm -y\n 2002  node -v\n 2003  npm -v\n 2004  sudo npm install -g @angular/cli\n 2005  ng build --configuration=production\n 2006  nvm list\n 2007  nvm --list\n 2008  node -v\n 2009  curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash\n 2010  source ~/.bashrc\n 2011  nvm --version\n 2012  nvm install 22.12.0\n 2013  nvm alias default v22.12.0\n 2014  nvm use default\n 2015  ng build --configuration=production\n 2016  npm i\n 2017  ng build --configuration=production\n 2018  ng serve\n ----\u003e localhost:4200\n\n```\n\n```\nInit Config from https://start.spring.io/: See ./spring.png \n\nsudo apt update\n\nsudo apt install maven\n\nmaearon@maearon:~/code/spring-boilerplate$ mvn -v\nApache Maven 3.8.7\nMaven home: /usr/share/maven\nJava version: 21.0.7, vendor: Ubuntu, runtime: /usr/lib/jvm/java-21-openjdk-amd64\nDefault locale: en_US, platform encoding: UTF-8\nOS name: \"linux\", version: \"6.11.0-26-generic\", arch: \"amd64\", family: \"unix\"\n\nmaearon@maearon:~/code/spring-boilerplate$ mvn -N io.takari:maven:wrapper\n\n./mvnw clean install\n\nmvn spring-boot:run OR\nIntelliJ IDEA \n---\u003e src/main/java/com/example/springboilerplate/SpringBoilerplateApplication.java \n----\u003e Right Click\n------\u003e ▶️ Run \n\ncd angular-boilerplate/\nng serve\n```\n\n### Spring Boot ActiveStorage mockup library in true polymorphic attachment style\n```\ncom.example.springboilerplate\n├── annotation\n│   ├── HasOneAttached.java\n│   └── HasManyAttached.java\n├── ActiveStorageService.java\n├── ActiveStorageRegistrar.java\n├── ActiveStorageEventListener.java\n├── ActiveStorageBlob.java\n├── ActiveStorageAttachment.java\n├── ActiveStorageBlobRepository.java\n└── ActiveStorageAttachmentRepository.java\n```\n### Next Steps\n\n1. Make sure to update the email configuration in `application.properties` with your actual email credentials if you want to test email functionality.\n2. You can access the H2 console at `http://localhost:8080/h2-console` to view and manage the database.\n3. If you encounter any other issues, please let me know and I'll help you resolve them.\n```\nspring.datasource.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE\nspring.datasource.url=jdbc:h2:file:./data/testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE\nhttp://localhost:8080/h2-console/login.do?jsessionid=41007277efb6dfcc00b5d1dc61fecdbf \njdbc:h2:mem:testdb\njdbc:h2:file:./data/testdb\n```\n```\nALTER TABLE users \nALTER COLUMN \"displayName\" DROP NOT NULL;\nUPDATE USERS\nSET\n    NAME = 'manhng132',\n    EMAIL = 'manhng132@gmail.com',\n    REMEMBER_DIGEST = '$2b$12$wzHbRL5yLPdDuWXgnQ4M7OZE9GTIL8lFgybX2BAy2T2hWCPBxb2Dq',\n    ACTIVATED = TRUE,\n    ADMIN = TRUE,\n    ACTIVATED_AT = TIMESTAMP '2024-09-14 15:55:09.025402',\n    RESET_SENT_AT = TIMESTAMP '2025-05-02 06:47:42.216116'\nWHERE ID = 'mb25y6bapfpsmkjk';\n```\n```\nSELECT * FROM USERS\n```\n```\nSELECT * FROM users WHERE email='manhng132@gmail.com'\n```\n```\nIntelliJ IDEA: sudo snap install intellij-idea-community --classic\n\nCtrl + Shift + A → gõ Registry... → Choose.\n\ncompiler.automake.allow.when.app.running\n\nCtrl+Shift+A → Type Build project automatically --\u003e Check.\n```\nNow you should be able to run the application with `./gradlew bootRun` without any missing class errors. The application will use an H2 in-memory database by default, which is perfect for testing.\n```\n./gradlew clean build --refresh-dependencies\n./gradlew bootRun\n```\n\n### -------------------------------------------------\n\nPlease analyze the Ruby on Rails project located in the rails_tutorial_sample_app_7th_ed directory on the right.\n\nThen, based on its layout, structure, and functionality, create a Spring application that replicates the app in rails_tutorial_sample_app_7th_ed as closely as possible.\n\nThe Spring project and all the code you generate should be created inside the spring-boilerplate directory on the right in code section.\n\nYou may modify spring-boilerplate/build.gradle in the right in code section but keep 3.4.5 version to add any required dependencies. Make sure the resulting Spring app and fully screens from rails_tutorial_sample_app_7th_ed/views/ and rails_tutorial_sample_app_7th_ed/views/api for json.\n\nThe entire application should use English only – do not include any Vietnamese text.\n\n### --------------------------------------------------\nContinue generating only the missing parts of the Spring project in spring-boilerplate without overwriting or changing the existing generated code. \n\nContinue from where you left off in /spring-boilerplate/src/main/resources/templates/users/show.html and generate the rest of the file. Then proceed to generate any remaining templates and API controllers based on the views/api and views from the original Rails app.\n\nDo not modify already generated files unless absolutely necessary.\n\n### --------------------------------------------------\n\nI'll continue generating the missing parts of the Spring project, starting with completing the `users/show.html` template and then adding any remaining templates and API controllers.\n\n```typescriptreact project=\"shop-php\"\n...\n```\n\nI've completed the missing parts of the Spring project, including:\n\n1. Finished the `users/show.html` template that was cut off\n2. Added all necessary Thymeleaf templates for views:\n\n1. User-related templates (show, index, edit, new, show_follow)\n2. Authentication templates (login, password reset)\n3. Fragment templates (stats, micropost_form, feed, user_info, etc.)\n4. Static pages (home, help, about, contact)\n5. Error pages (404, 500, access-denied)\n\n\n\n3. Added API controllers to match the Rails app's API functionality:\n\n1. UsersApiController\n2. MicropostsApiController\n3. RelationshipsApiController\n4. AuthApiController\n5. PasswordResetApiController\n\n\n### ----------------------------------------------------\n\n### Avoice Circular Dependency in SecurityConfig\n\n### 1. Use annotation `@Lazy`\n\nAnnotation `@Lazy` used to delay bean initialization until it is actually needed\n\n```java\npublic SecurityConfig(@Lazy CustomUserDetailsService customUserDetailsService,\n                      JwtAuthenticationEntryPoint unauthorizedHandler,\n                      @Lazy JwtAuthenticationFilter jwtAuthenticationFilter) {\n    // ...\n}\n```\n\n### 2. Refactor SecurityConfig\n\n- Use `SecurityFilterChain` instead of inheriting `WebSecurityConfigurerAdapter` (which has been deprecated)\n- Separate authentication and authorization configuration\n- Use lambda expressions for HttpSecurity configuration\n\n### 3. Optimize JwtAuthenticationFilter\n\n- Use `@Lazy` for CustomUserDetailsService in filter\n- Separate token authentication logic and user information retrieval\n\n### 4. Improve CustomUserDetailsService\n\n- Simplify service to avoid dependency on SecurityConfig\n\n### -------------------------------------------------------\n\n### Fixing Spring Boot Application Issues\n\nI'll address the missing files and dependencies in your Spring Boot application. Let's create the necessary files and update the build.gradle file.\n\n```typescriptreact project=\"shop-php\"\n...\n```\n\n## Solution for Spring Boot Application Issues\n\nI've created all the missing files that were causing the build errors. Here's what I've added:\n\n### 1. Updated build.gradle\n\n- Added the validation dependency explicitly\n- Ensured all JWT dependencies are included\n\n\n### 2. Added DTO Classes\n\n- UserDto\n- LoginDto\n- RegisterDto\n- ApiResponse\n- MicropostDto\n- PasswordResetDto\n- JwtResponseDto\n- RelationshipDto\n- PagedResponse\n\n\n### 3. Added Security Classes\n\n- JwtTokenProvider\n- JwtAuthenticationFilter\n- JwtAuthenticationEntryPoint\n- UserPrincipal\n- CurrentUser annotation\n\n\n### 4. Added Password Reset Functionality\n\n- PasswordResetToken model\n- PasswordResetTokenRepository\n- PasswordResetTokenService interface\n- PasswordResetTokenServiceImpl implementation\n\n\n### 5. Added Validation Classes\n\n- PasswordMatches annotation\n- PasswordMatchesValidator\n- ValidEmail annotation\n- EmailValidator\n\n\n### 6. Updated Security Configuration\n\n- SecurityConfig with proper JWT configuration\n\n\n### 7. Added Application Properties\n\n- Database configuration\n- JWT configuration\n- Mail configuration\n- File upload settings","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaearon%2Fspring-boilerplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaearon%2Fspring-boilerplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaearon%2Fspring-boilerplate/lists"}