workspace-architect 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +1 -0
- package/.gitattributes +1 -0
- package/.github/workflows/manual-publish.yml +36 -0
- package/.github/workflows/sync-and-publish.yml +58 -0
- package/.release-it.json +20 -0
- package/CHANGELOG.md +43 -0
- package/README.md +62 -0
- package/assets/chatmodes/4.1-Beast.chatmode.md +152 -0
- package/assets/chatmodes/Thinking-Beast-Mode.chatmode.md +337 -0
- package/assets/chatmodes/Ultimate-Transparent-Thinking-Beast-Mode.chatmode.md +644 -0
- package/assets/chatmodes/accessibility.chatmode.md +298 -0
- package/assets/chatmodes/address-comments.chatmode.md +59 -0
- package/assets/chatmodes/aem-frontend-specialist.chatmode.md +385 -0
- package/assets/chatmodes/api-architect.chatmode.md +40 -0
- package/assets/chatmodes/atlassian-requirements-to-jira.chatmode.md +444 -0
- package/assets/chatmodes/azure-logic-apps-expert.chatmode.md +100 -0
- package/assets/chatmodes/azure-principal-architect.chatmode.md +58 -0
- package/assets/chatmodes/azure-saas-architect.chatmode.md +118 -0
- package/assets/chatmodes/azure-verified-modules-bicep.chatmode.md +44 -0
- package/assets/chatmodes/azure-verified-modules-terraform.chatmode.md +58 -0
- package/assets/chatmodes/bicep-implement.chatmode.md +40 -0
- package/assets/chatmodes/bicep-plan.chatmode.md +112 -0
- package/assets/chatmodes/blueprint-mode-codex.chatmode.md +110 -0
- package/assets/chatmodes/blueprint-mode.chatmode.md +171 -0
- package/assets/chatmodes/clojure-interactive-programming.chatmode.md +174 -0
- package/assets/chatmodes/code-tour.chatmode.md +205 -0
- package/assets/chatmodes/critical-thinking.chatmode.md +23 -0
- package/assets/chatmodes/csharp-dotnet-janitor.chatmode.md +83 -0
- package/assets/chatmodes/csharp-mcp-expert.chatmode.md +69 -0
- package/assets/chatmodes/debug.chatmode.md +79 -0
- package/assets/chatmodes/declarative-agents-architect.chatmode.md +76 -0
- package/assets/chatmodes/demonstrate-understanding.chatmode.md +60 -0
- package/assets/chatmodes/dotnet-upgrade.chatmode.md +222 -0
- package/assets/chatmodes/drupal-expert.chatmode.md +687 -0
- package/assets/chatmodes/electron-angular-native.chatmode.md +285 -0
- package/assets/chatmodes/expert-cpp-software-engineer.chatmode.md +27 -0
- package/assets/chatmodes/expert-dotnet-software-engineer.chatmode.md +22 -0
- package/assets/chatmodes/expert-nextjs-developer.chatmode.md +477 -0
- package/assets/chatmodes/expert-react-frontend-engineer.chatmode.md +738 -0
- package/assets/chatmodes/gilfoyle.chatmode.md +66 -0
- package/assets/chatmodes/go-mcp-expert.chatmode.md +122 -0
- package/assets/chatmodes/gpt-5-beast-mode.chatmode.md +109 -0
- package/assets/chatmodes/hlbpa.chatmode.md +232 -0
- package/assets/chatmodes/implementation-plan.chatmode.md +159 -0
- package/assets/chatmodes/janitor.chatmode.md +89 -0
- package/assets/chatmodes/java-mcp-expert.chatmode.md +325 -0
- package/assets/chatmodes/kotlin-mcp-expert.chatmode.md +181 -0
- package/assets/chatmodes/kusto-assistant.chatmode.md +143 -0
- package/assets/chatmodes/laravel-expert-agent.chatmode.md +628 -0
- package/assets/chatmodes/mentor.chatmode.md +32 -0
- package/assets/chatmodes/meta-agentic-project-scaffold.chatmode.md +15 -0
- package/assets/chatmodes/microsoft-agent-framework-dotnet.chatmode.md +62 -0
- package/assets/chatmodes/microsoft-agent-framework-python.chatmode.md +62 -0
- package/assets/chatmodes/microsoft-study-mode.chatmode.md +32 -0
- package/assets/chatmodes/microsoft_learn_contributor.chatmode.md +388 -0
- package/assets/chatmodes/ms-sql-dba.chatmode.md +25 -0
- package/assets/chatmodes/php-mcp-expert.chatmode.md +498 -0
- package/assets/chatmodes/pimcore-expert.chatmode.md +869 -0
- package/assets/chatmodes/plan.chatmode.md +114 -0
- package/assets/chatmodes/planner.chatmode.md +14 -0
- package/assets/chatmodes/playwright-tester.chatmode.md +13 -0
- package/assets/chatmodes/postgresql-dba.chatmode.md +17 -0
- package/assets/chatmodes/power-bi-data-modeling-expert.chatmode.md +319 -0
- package/assets/chatmodes/power-bi-dax-expert.chatmode.md +334 -0
- package/assets/chatmodes/power-bi-performance-expert.chatmode.md +533 -0
- package/assets/chatmodes/power-bi-visualization-expert.chatmode.md +549 -0
- package/assets/chatmodes/power-platform-expert.chatmode.md +116 -0
- package/assets/chatmodes/power-platform-mcp-integration-expert.chatmode.md +149 -0
- package/assets/chatmodes/prd.chatmode.md +201 -0
- package/assets/chatmodes/principal-software-engineer.chatmode.md +41 -0
- package/assets/chatmodes/prompt-builder.chatmode.md +352 -0
- package/assets/chatmodes/prompt-engineer.chatmode.md +72 -0
- package/assets/chatmodes/python-mcp-expert.chatmode.md +99 -0
- package/assets/chatmodes/refine-issue.chatmode.md +34 -0
- package/assets/chatmodes/research-technical-spike.chatmode.md +169 -0
- package/assets/chatmodes/ruby-mcp-expert.chatmode.md +346 -0
- package/assets/chatmodes/rust-gpt-4.1-beast-mode.chatmode.md +197 -0
- package/assets/chatmodes/rust-mcp-expert.chatmode.md +465 -0
- package/assets/chatmodes/search-ai-optimization-expert.chatmode.md +227 -0
- package/assets/chatmodes/semantic-kernel-dotnet.chatmode.md +31 -0
- package/assets/chatmodes/semantic-kernel-python.chatmode.md +28 -0
- package/assets/chatmodes/shopify-expert.chatmode.md +681 -0
- package/assets/chatmodes/simple-app-idea-generator.chatmode.md +134 -0
- package/assets/chatmodes/software-engineer-agent-v1.chatmode.md +164 -0
- package/assets/chatmodes/specification.chatmode.md +127 -0
- package/assets/chatmodes/swift-mcp-expert.chatmode.md +240 -0
- package/assets/chatmodes/task-planner.chatmode.md +374 -0
- package/assets/chatmodes/task-researcher.chatmode.md +254 -0
- package/assets/chatmodes/tdd-green.chatmode.md +59 -0
- package/assets/chatmodes/tdd-red.chatmode.md +59 -0
- package/assets/chatmodes/tdd-refactor.chatmode.md +84 -0
- package/assets/chatmodes/tech-debt-remediation-plan.chatmode.md +49 -0
- package/assets/chatmodes/terraform-azure-implement.chatmode.md +104 -0
- package/assets/chatmodes/terraform-azure-planning.chatmode.md +157 -0
- package/assets/chatmodes/typescript-mcp-expert.chatmode.md +91 -0
- package/assets/chatmodes/voidbeast-gpt41enhanced.chatmode.md +230 -0
- package/assets/chatmodes/wg-code-alchemist.chatmode.md +61 -0
- package/assets/chatmodes/wg-code-sentinel.chatmode.md +55 -0
- package/assets/collections/ai-prompt-engineering.json +18 -0
- package/assets/collections/angular-development.json +7 -0
- package/assets/collections/azure-cloud-architect.json +29 -0
- package/assets/collections/cpp-development.json +6 -0
- package/assets/collections/database-administration.json +8 -0
- package/assets/collections/devops-sre.json +11 -0
- package/assets/collections/dotnet-development.json +22 -0
- package/assets/collections/general-productivity.json +9 -0
- package/assets/collections/go-development.json +7 -0
- package/assets/collections/java-spring-developer.json +26 -0
- package/assets/collections/learning-mentoring.json +10 -0
- package/assets/collections/legacy-migration.json +4 -0
- package/assets/collections/mcp-specialist.json +41 -0
- package/assets/collections/mobile-development.json +4 -0
- package/assets/collections/php-cms-development.json +11 -0
- package/assets/collections/power-platform-specialist.json +31 -0
- package/assets/collections/project-management.json +12 -0
- package/assets/collections/python-development.json +13 -0
- package/assets/collections/quality-assurance.json +13 -0
- package/assets/collections/ruby-development.json +9 -0
- package/assets/collections/rust-development.json +10 -0
- package/assets/collections/security-specialist.json +8 -0
- package/assets/collections/software-architect.json +25 -0
- package/assets/collections/technical-writing.json +9 -0
- package/assets/collections/web-frontend-development.json +14 -0
- package/assets/instructions/a11y.instructions.md +369 -0
- package/assets/instructions/ai-prompt-engineering-safety-best-practices.instructions.md +867 -0
- package/assets/instructions/angular.instructions.md +104 -0
- package/assets/instructions/ansible.instructions.md +88 -0
- package/assets/instructions/aspnet-rest-apis.instructions.md +110 -0
- package/assets/instructions/astro.instructions.md +182 -0
- package/assets/instructions/azure-devops-pipelines.instructions.md +185 -0
- package/assets/instructions/azure-functions-typescript.instructions.md +14 -0
- package/assets/instructions/azure-logic-apps-power-automate.instructions.md +1943 -0
- package/assets/instructions/azure-verified-modules-terraform.instructions.md +229 -0
- package/assets/instructions/bicep-code-best-practices.instructions.md +54 -0
- package/assets/instructions/blazor.instructions.md +77 -0
- package/assets/instructions/clojure.instructions.md +349 -0
- package/assets/instructions/cmake-vcpkg.instructions.md +10 -0
- package/assets/instructions/codexer.instructions.md +428 -0
- package/assets/instructions/coldfusion-cfc.instructions.md +30 -0
- package/assets/instructions/coldfusion-cfm.instructions.md +28 -0
- package/assets/instructions/collections.instructions.md +54 -0
- package/assets/instructions/containerization-docker-best-practices.instructions.md +681 -0
- package/assets/instructions/convert-jpa-to-spring-data-cosmos.instructions.md +949 -0
- package/assets/instructions/copilot-thought-logging.instructions.md +62 -0
- package/assets/instructions/csharp-ja.instructions.md +114 -0
- package/assets/instructions/csharp-ko.instructions.md +77 -0
- package/assets/instructions/csharp-mcp-server.instructions.md +95 -0
- package/assets/instructions/csharp.instructions.md +114 -0
- package/assets/instructions/dart-n-flutter.instructions.md +447 -0
- package/assets/instructions/declarative-agents-microsoft365.instructions.md +316 -0
- package/assets/instructions/devbox-image-definition.instructions.md +302 -0
- package/assets/instructions/devops-core-principles.instructions.md +167 -0
- package/assets/instructions/dotnet-architecture-good-practices.instructions.md +279 -0
- package/assets/instructions/dotnet-framework.instructions.md +113 -0
- package/assets/instructions/dotnet-maui-9-to-dotnet-maui-10-upgrade.instructions.md +1922 -0
- package/assets/instructions/dotnet-maui.instructions.md +69 -0
- package/assets/instructions/dotnet-upgrade.instructions.md +287 -0
- package/assets/instructions/dotnet-wpf.instructions.md +79 -0
- package/assets/instructions/genaiscript.instructions.md +21 -0
- package/assets/instructions/generate-modern-terraform-code-for-azure.instructions.md +82 -0
- package/assets/instructions/gilfoyle-code-review.instructions.md +114 -0
- package/assets/instructions/github-actions-ci-cd-best-practices.instructions.md +607 -0
- package/assets/instructions/go-mcp-server.instructions.md +346 -0
- package/assets/instructions/go.instructions.md +373 -0
- package/assets/instructions/instructions.instructions.md +256 -0
- package/assets/instructions/java-11-to-java-17-upgrade.instructions.md +793 -0
- package/assets/instructions/java-17-to-java-21-upgrade.instructions.md +464 -0
- package/assets/instructions/java-21-to-java-25-upgrade.instructions.md +311 -0
- package/assets/instructions/java-mcp-server.instructions.md +553 -0
- package/assets/instructions/java.instructions.md +81 -0
- package/assets/instructions/joyride-user-project.instructions.md +206 -0
- package/assets/instructions/joyride-workspace-automation.instructions.md +46 -0
- package/assets/instructions/kotlin-mcp-server.instructions.md +481 -0
- package/assets/instructions/kubernetes-deployment-best-practices.instructions.md +307 -0
- package/assets/instructions/langchain-python.instructions.md +229 -0
- package/assets/instructions/localization.instructions.md +39 -0
- package/assets/instructions/makefile.instructions.md +410 -0
- package/assets/instructions/markdown.instructions.md +52 -0
- package/assets/instructions/memory-bank.instructions.md +299 -0
- package/assets/instructions/mongo-dba.instructions.md +25 -0
- package/assets/instructions/ms-sql-dba.instructions.md +25 -0
- package/assets/instructions/nestjs.instructions.md +406 -0
- package/assets/instructions/nextjs-tailwind.instructions.md +72 -0
- package/assets/instructions/nextjs.instructions.md +143 -0
- package/assets/instructions/nodejs-javascript-vitest.instructions.md +30 -0
- package/assets/instructions/object-calisthenics.instructions.md +302 -0
- package/assets/instructions/oqtane.instructions.md +86 -0
- package/assets/instructions/performance-optimization.instructions.md +420 -0
- package/assets/instructions/php-mcp-server.instructions.md +809 -0
- package/assets/instructions/playwright-dotnet.instructions.md +101 -0
- package/assets/instructions/playwright-python.instructions.md +62 -0
- package/assets/instructions/playwright-typescript.instructions.md +86 -0
- package/assets/instructions/power-apps-canvas-yaml.instructions.md +827 -0
- package/assets/instructions/power-apps-code-apps.instructions.md +601 -0
- package/assets/instructions/power-bi-custom-visuals-development.instructions.md +810 -0
- package/assets/instructions/power-bi-data-modeling-best-practices.instructions.md +639 -0
- package/assets/instructions/power-bi-dax-best-practices.instructions.md +795 -0
- package/assets/instructions/power-bi-devops-alm-best-practices.instructions.md +623 -0
- package/assets/instructions/power-bi-report-design-best-practices.instructions.md +752 -0
- package/assets/instructions/power-bi-security-rls-best-practices.instructions.md +504 -0
- package/assets/instructions/power-platform-connector.instructions.md +430 -0
- package/assets/instructions/power-platform-mcp-development.instructions.md +88 -0
- package/assets/instructions/powershell-pester-5.instructions.md +197 -0
- package/assets/instructions/powershell.instructions.md +356 -0
- package/assets/instructions/prompt.instructions.md +73 -0
- package/assets/instructions/python-mcp-server.instructions.md +204 -0
- package/assets/instructions/python.instructions.md +56 -0
- package/assets/instructions/quarkus-mcp-server-sse.instructions.md +49 -0
- package/assets/instructions/quarkus.instructions.md +98 -0
- package/assets/instructions/r.instructions.md +116 -0
- package/assets/instructions/reactjs.instructions.md +162 -0
- package/assets/instructions/ruby-mcp-server.instructions.md +629 -0
- package/assets/instructions/ruby-on-rails.instructions.md +124 -0
- package/assets/instructions/rust-mcp-server.instructions.md +715 -0
- package/assets/instructions/rust.instructions.md +135 -0
- package/assets/instructions/security-and-owasp.instructions.md +51 -0
- package/assets/instructions/self-explanatory-code-commenting.instructions.md +162 -0
- package/assets/instructions/shell.instructions.md +132 -0
- package/assets/instructions/spec-driven-workflow-v1.instructions.md +323 -0
- package/assets/instructions/springboot.instructions.md +68 -0
- package/assets/instructions/sql-sp-generation.instructions.md +74 -0
- package/assets/instructions/svelte.instructions.md +161 -0
- package/assets/instructions/swift-mcp-server.instructions.md +498 -0
- package/assets/instructions/taming-copilot.instructions.md +40 -0
- package/assets/instructions/tanstack-start-shadcn-tailwind.instructions.md +212 -0
- package/assets/instructions/task-implementation.instructions.md +190 -0
- package/assets/instructions/tasksync.instructions.md +352 -0
- package/assets/instructions/terraform-azure.instructions.md +254 -0
- package/assets/instructions/terraform-sap-btp.instructions.md +195 -0
- package/assets/instructions/terraform.instructions.md +113 -0
- package/assets/instructions/typescript-5-es2022.instructions.md +114 -0
- package/assets/instructions/typescript-mcp-server.instructions.md +228 -0
- package/assets/instructions/update-code-from-shorthand.instructions.md +130 -0
- package/assets/instructions/vuejs3.instructions.md +153 -0
- package/assets/instructions/wordpress.instructions.md +186 -0
- package/assets/prompts/add-educational-comments.prompt.md +129 -0
- package/assets/prompts/ai-prompt-engineering-safety-review.prompt.md +230 -0
- package/assets/prompts/architecture-blueprint-generator.prompt.md +322 -0
- package/assets/prompts/aspnet-minimal-api-openapi.prompt.md +42 -0
- package/assets/prompts/az-cost-optimize.prompt.md +305 -0
- package/assets/prompts/azure-resource-health-diagnose.prompt.md +290 -0
- package/assets/prompts/boost-prompt.prompt.md +25 -0
- package/assets/prompts/breakdown-epic-arch.prompt.md +66 -0
- package/assets/prompts/breakdown-epic-pm.prompt.md +58 -0
- package/assets/prompts/breakdown-feature-implementation.prompt.md +128 -0
- package/assets/prompts/breakdown-feature-prd.prompt.md +61 -0
- package/assets/prompts/breakdown-plan.prompt.md +509 -0
- package/assets/prompts/breakdown-test.prompt.md +365 -0
- package/assets/prompts/code-exemplars-blueprint-generator.prompt.md +126 -0
- package/assets/prompts/comment-code-generate-a-tutorial.prompt.md +26 -0
- package/assets/prompts/containerize-aspnet-framework.prompt.md +455 -0
- package/assets/prompts/containerize-aspnetcore.prompt.md +393 -0
- package/assets/prompts/conventional-commit.prompt.md +73 -0
- package/assets/prompts/copilot-instructions-blueprint-generator.prompt.md +294 -0
- package/assets/prompts/cosmosdb-datamodeling.prompt.md +1045 -0
- package/assets/prompts/create-agentsmd.prompt.md +249 -0
- package/assets/prompts/create-architectural-decision-record.prompt.md +97 -0
- package/assets/prompts/create-github-action-workflow-specification.prompt.md +276 -0
- package/assets/prompts/create-github-issue-feature-from-specification.prompt.md +28 -0
- package/assets/prompts/create-github-issues-feature-from-implementation-plan.prompt.md +28 -0
- package/assets/prompts/create-github-issues-for-unmet-specification-requirements.prompt.md +35 -0
- package/assets/prompts/create-github-pull-request-from-specification.prompt.md +24 -0
- package/assets/prompts/create-implementation-plan.prompt.md +157 -0
- package/assets/prompts/create-llms.prompt.md +210 -0
- package/assets/prompts/create-oo-component-documentation.prompt.md +193 -0
- package/assets/prompts/create-readme.prompt.md +21 -0
- package/assets/prompts/create-specification.prompt.md +127 -0
- package/assets/prompts/create-spring-boot-java-project.prompt.md +163 -0
- package/assets/prompts/create-spring-boot-kotlin-project.prompt.md +147 -0
- package/assets/prompts/create-technical-spike.prompt.md +231 -0
- package/assets/prompts/csharp-async.prompt.md +50 -0
- package/assets/prompts/csharp-docs.prompt.md +63 -0
- package/assets/prompts/csharp-mcp-server-generator.prompt.md +59 -0
- package/assets/prompts/csharp-mstest.prompt.md +67 -0
- package/assets/prompts/csharp-nunit.prompt.md +72 -0
- package/assets/prompts/csharp-tunit.prompt.md +101 -0
- package/assets/prompts/csharp-xunit.prompt.md +69 -0
- package/assets/prompts/declarative-agents.prompt.md +93 -0
- package/assets/prompts/documentation-writer.prompt.md +46 -0
- package/assets/prompts/dotnet-best-practices.prompt.md +84 -0
- package/assets/prompts/dotnet-design-pattern-review.prompt.md +41 -0
- package/assets/prompts/dotnet-upgrade.prompt.md +116 -0
- package/assets/prompts/editorconfig.prompt.md +64 -0
- package/assets/prompts/ef-core.prompt.md +76 -0
- package/assets/prompts/finalize-agent-prompt.prompt.md +27 -0
- package/assets/prompts/first-ask.prompt.md +29 -0
- package/assets/prompts/folder-structure-blueprint-generator.prompt.md +405 -0
- package/assets/prompts/gen-specs-as-issues.prompt.md +165 -0
- package/assets/prompts/generate-custom-instructions-from-codebase.prompt.md +240 -0
- package/assets/prompts/git-flow-branch-creator.prompt.md +293 -0
- package/assets/prompts/github-copilot-starter.prompt.md +372 -0
- package/assets/prompts/go-mcp-server-generator.prompt.md +334 -0
- package/assets/prompts/java-docs.prompt.md +24 -0
- package/assets/prompts/java-junit.prompt.md +64 -0
- package/assets/prompts/java-mcp-server-generator.prompt.md +756 -0
- package/assets/prompts/java-refactoring-extract-method.prompt.md +105 -0
- package/assets/prompts/java-refactoring-remove-parameter.prompt.md +85 -0
- package/assets/prompts/java-springboot.prompt.md +66 -0
- package/assets/prompts/javascript-typescript-jest.prompt.md +44 -0
- package/assets/prompts/kotlin-mcp-server-generator.prompt.md +449 -0
- package/assets/prompts/kotlin-springboot.prompt.md +71 -0
- package/assets/prompts/mcp-copilot-studio-server-generator.prompt.md +118 -0
- package/assets/prompts/memory-merger.prompt.md +107 -0
- package/assets/prompts/mkdocs-translations.prompt.md +110 -0
- package/assets/prompts/model-recommendation.prompt.md +677 -0
- package/assets/prompts/multi-stage-dockerfile.prompt.md +47 -0
- package/assets/prompts/my-issues.prompt.md +9 -0
- package/assets/prompts/my-pull-requests.prompt.md +15 -0
- package/assets/prompts/next-intl-add-language.prompt.md +20 -0
- package/assets/prompts/php-mcp-server-generator.prompt.md +522 -0
- package/assets/prompts/playwright-automation-fill-in-form.prompt.md +30 -0
- package/assets/prompts/playwright-explore-website.prompt.md +19 -0
- package/assets/prompts/playwright-generate-test.prompt.md +19 -0
- package/assets/prompts/postgresql-code-review.prompt.md +214 -0
- package/assets/prompts/postgresql-optimization.prompt.md +406 -0
- package/assets/prompts/power-apps-code-app-scaffold.prompt.md +150 -0
- package/assets/prompts/power-bi-dax-optimization.prompt.md +175 -0
- package/assets/prompts/power-bi-model-design-review.prompt.md +405 -0
- package/assets/prompts/power-bi-performance-troubleshooting.prompt.md +384 -0
- package/assets/prompts/power-bi-report-design-consultation.prompt.md +353 -0
- package/assets/prompts/power-platform-mcp-connector-suite.prompt.md +156 -0
- package/assets/prompts/project-workflow-analysis-blueprint-generator.prompt.md +294 -0
- package/assets/prompts/prompt-builder.prompt.md +142 -0
- package/assets/prompts/pytest-coverage.prompt.md +28 -0
- package/assets/prompts/python-mcp-server-generator.prompt.md +105 -0
- package/assets/prompts/readme-blueprint-generator.prompt.md +79 -0
- package/assets/prompts/remember-interactive-programming.prompt.md +13 -0
- package/assets/prompts/remember.prompt.md +125 -0
- package/assets/prompts/repo-story-time.prompt.md +156 -0
- package/assets/prompts/review-and-refactor.prompt.md +15 -0
- package/assets/prompts/ruby-mcp-server-generator.prompt.md +660 -0
- package/assets/prompts/rust-mcp-server-generator.prompt.md +578 -0
- package/assets/prompts/shuffle-json-data.prompt.md +151 -0
- package/assets/prompts/sql-code-review.prompt.md +303 -0
- package/assets/prompts/sql-optimization.prompt.md +298 -0
- package/assets/prompts/suggest-awesome-github-copilot-agents.prompt.md +72 -0
- package/assets/prompts/suggest-awesome-github-copilot-chatmodes.prompt.md +71 -0
- package/assets/prompts/suggest-awesome-github-copilot-collections.prompt.md +149 -0
- package/assets/prompts/suggest-awesome-github-copilot-instructions.prompt.md +88 -0
- package/assets/prompts/suggest-awesome-github-copilot-prompts.prompt.md +71 -0
- package/assets/prompts/swift-mcp-server-generator.prompt.md +669 -0
- package/assets/prompts/technology-stack-blueprint-generator.prompt.md +242 -0
- package/assets/prompts/typescript-mcp-server-generator.prompt.md +90 -0
- package/assets/prompts/update-avm-modules-in-bicep.prompt.md +60 -0
- package/assets/prompts/update-implementation-plan.prompt.md +157 -0
- package/assets/prompts/update-llms.prompt.md +216 -0
- package/assets/prompts/update-markdown-file-index.prompt.md +76 -0
- package/assets/prompts/update-oo-component-documentation.prompt.md +162 -0
- package/assets/prompts/update-specification.prompt.md +127 -0
- package/assets/prompts/write-coding-standards-from-file.prompt.md +316 -0
- package/bin/cli.js +200 -0
- package/package.json +53 -0
- package/scripts/sync.js +99 -0
- package/verdaccio/config.yaml +202 -0
|
@@ -0,0 +1,949 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'Step-by-step guide for converting Spring Boot JPA applications to use Azure Cosmos DB with Spring Data Cosmos'
|
|
3
|
+
applyTo: '**/*.java,**/pom.xml,**/build.gradle,**/application*.properties'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Convert Spring JPA project to Spring Data Cosmos
|
|
7
|
+
|
|
8
|
+
This generalized guide applies to any JPA to Spring Data Cosmos DB conversion project.
|
|
9
|
+
|
|
10
|
+
## High-level plan
|
|
11
|
+
|
|
12
|
+
1. Swap build dependencies (remove JPA, add Cosmos + Identity).
|
|
13
|
+
2. Add `cosmos` profile and properties.
|
|
14
|
+
3. Add Cosmos config with proper Azure identity authentication.
|
|
15
|
+
4. Transform entities (ids → `String`, add `@Container` and `@PartitionKey`, remove JPA mappings, adjust relationships).
|
|
16
|
+
5. Convert repositories (`JpaRepository` → `CosmosRepository`).
|
|
17
|
+
6. **Create service layer** for relationship management and template compatibility.
|
|
18
|
+
7. **CRITICAL**: Update ALL test files to work with String IDs and Cosmos repositories.
|
|
19
|
+
8. Seed data via `CommandLineRunner`.
|
|
20
|
+
9. **CRITICAL**: Test runtime functionality and fix template compatibility issues.
|
|
21
|
+
|
|
22
|
+
## Step-by-step
|
|
23
|
+
|
|
24
|
+
### Step 1 — Build dependencies
|
|
25
|
+
|
|
26
|
+
- **Maven** (`pom.xml`):
|
|
27
|
+
- Remove dependency `spring-boot-starter-data-jpa`
|
|
28
|
+
- Remove database-specific dependencies (H2, MySQL, PostgreSQL) unless needed elsewhere
|
|
29
|
+
- Add `com.azure:azure-spring-data-cosmos:5.17.0` (or latest compatible version)
|
|
30
|
+
- Add `com.azure:azure-identity:1.15.4` (required for DefaultAzureCredential)
|
|
31
|
+
- **Gradle**: Apply same dependency changes for Gradle syntax
|
|
32
|
+
- Remove testcontainers and JPA-specific test dependencies
|
|
33
|
+
|
|
34
|
+
### Step 2 — Properties and Configuration
|
|
35
|
+
|
|
36
|
+
- Create `src/main/resources/application-cosmos.properties`:
|
|
37
|
+
```properties
|
|
38
|
+
azure.cosmos.uri=${COSMOS_URI:https://localhost:8081}
|
|
39
|
+
azure.cosmos.database=${COSMOS_DATABASE:petclinic}
|
|
40
|
+
azure.cosmos.populate-query-metrics=false
|
|
41
|
+
azure.cosmos.enable-multiple-write-locations=false
|
|
42
|
+
```
|
|
43
|
+
- Update `src/main/resources/application.properties`:
|
|
44
|
+
```properties
|
|
45
|
+
spring.profiles.active=cosmos
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Step 3 — Configuration class with Azure Identity
|
|
49
|
+
|
|
50
|
+
- Create `src/main/java/<rootpkg>/config/CosmosConfiguration.java`:
|
|
51
|
+
```java
|
|
52
|
+
@Configuration
|
|
53
|
+
@EnableCosmosRepositories(basePackages = "<rootpkg>")
|
|
54
|
+
public class CosmosConfiguration extends AbstractCosmosConfiguration {
|
|
55
|
+
|
|
56
|
+
@Value("${azure.cosmos.uri}")
|
|
57
|
+
private String uri;
|
|
58
|
+
|
|
59
|
+
@Value("${azure.cosmos.database}")
|
|
60
|
+
private String dbName;
|
|
61
|
+
|
|
62
|
+
@Bean
|
|
63
|
+
public CosmosClientBuilder getCosmosClientBuilder() {
|
|
64
|
+
return new CosmosClientBuilder().endpoint(uri).credential(new DefaultAzureCredentialBuilder().build());
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@Override
|
|
68
|
+
protected String getDatabaseName() {
|
|
69
|
+
return dbName;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@Bean
|
|
73
|
+
public CosmosConfig cosmosConfig() {
|
|
74
|
+
return CosmosConfig.builder().enableQueryMetrics(false).build();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
- **IMPORTANT**: Use `DefaultAzureCredentialBuilder().build()` instead of key-based authentication for production security
|
|
80
|
+
|
|
81
|
+
### Step 4 — Entity transformation
|
|
82
|
+
|
|
83
|
+
- Target all classes with JPA annotations (`@Entity`, `@MappedSuperclass`, `@Embeddable`)
|
|
84
|
+
- **Base entity changes**:
|
|
85
|
+
- Change `id` field type from `Integer` to `String`
|
|
86
|
+
- Add `@Id` and `@GeneratedValue` annotations
|
|
87
|
+
- Add `@PartitionKey` field (typically `String partitionKey`)
|
|
88
|
+
- Remove all `jakarta.persistence` imports
|
|
89
|
+
- **CRITICAL - Cosmos DB Serialization Requirements**:
|
|
90
|
+
- **Remove ALL `@JsonIgnore` annotations** from fields that need to be persisted to Cosmos DB
|
|
91
|
+
- **Authentication entities (User, Authority) MUST be fully serializable** - no `@JsonIgnore` on password, authorities, or other persisted fields
|
|
92
|
+
- **Use `@JsonProperty` instead of `@JsonIgnore`** when you need to control JSON field names but still persist the data
|
|
93
|
+
- **Common authentication serialization errors**: `Cannot pass null or empty values to constructor` usually means `@JsonIgnore` is blocking required field serialization
|
|
94
|
+
- **Entity-specific changes**:
|
|
95
|
+
- Replace `@Entity` with `@Container(containerName = "<plural-entity-name>")`
|
|
96
|
+
- Remove `@Table`, `@Column`, `@JoinColumn`, etc.
|
|
97
|
+
- Remove relationship annotations (`@OneToMany`, `@ManyToOne`, `@ManyToMany`)
|
|
98
|
+
- For relationships:
|
|
99
|
+
- Embed collections for one-to-many (e.g., `List<Pet> pets` in Owner)
|
|
100
|
+
- Use reference IDs for many-to-one (e.g., `String ownerId` in Pet)
|
|
101
|
+
- **For complex relationships**: Store IDs but add transient properties for templates
|
|
102
|
+
- Add constructor to set partition key: `setPartitionKey("entityType")`
|
|
103
|
+
- **CRITICAL - Authentication Entity Pattern**:
|
|
104
|
+
- **For User entities with Spring Security**: Store authorities as `Set<String>` instead of `Set<Authority>` objects
|
|
105
|
+
- **Example User entity transformation**:
|
|
106
|
+
```java
|
|
107
|
+
@Container(containerName = "users")
|
|
108
|
+
public class User {
|
|
109
|
+
|
|
110
|
+
@Id
|
|
111
|
+
private String id;
|
|
112
|
+
|
|
113
|
+
@PartitionKey
|
|
114
|
+
private String partitionKey = "user";
|
|
115
|
+
|
|
116
|
+
private String login;
|
|
117
|
+
private String password; // NO @JsonIgnore - must be serializable
|
|
118
|
+
|
|
119
|
+
@JsonProperty("authorities") // Use @JsonProperty, not @JsonIgnore
|
|
120
|
+
private Set<String> authorities = new HashSet<>(); // Store as strings
|
|
121
|
+
|
|
122
|
+
// Add transient property for Spring Security compatibility if needed
|
|
123
|
+
// @JsonIgnore - ONLY for transient properties not persisted to Cosmos
|
|
124
|
+
private Set<Authority> authorityObjects = new HashSet<>();
|
|
125
|
+
|
|
126
|
+
// Conversion methods between string authorities and Authority objects
|
|
127
|
+
public void setAuthorityObjects(Set<Authority> authorities) {
|
|
128
|
+
this.authorityObjects = authorities;
|
|
129
|
+
this.authorities = authorities.stream().map(Authority::getName).collect(Collectors.toSet());
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
- **CRITICAL - Template Compatibility for Relationship Changes**:
|
|
135
|
+
- **When converting relationships to ID references, preserve template access**
|
|
136
|
+
- **Example**: If entity had `List<Specialty> specialties` → convert to:
|
|
137
|
+
- Storage: `List<String> specialtyIds` (persisted to Cosmos)
|
|
138
|
+
- Template: `@JsonIgnore private List<Specialty> specialties = new ArrayList<>()` (transient)
|
|
139
|
+
- Add getters/setters for both properties
|
|
140
|
+
- **Update entity method logic**: `getNrOfSpecialties()` should use the transient list
|
|
141
|
+
- **CRITICAL - Template Compatibility for Thymeleaf/JSP Applications**:
|
|
142
|
+
- **Identify template property access**: Search for `${entity.relationshipProperty}` in `.html` files
|
|
143
|
+
- **For each relationship property accessed in templates**:
|
|
144
|
+
- **Storage**: Keep ID-based storage (e.g., `List<String> specialtyIds`)
|
|
145
|
+
- **Template Access**: Add transient property with `@JsonIgnore` (e.g., `private List<Specialty> specialties = new ArrayList<>()`)
|
|
146
|
+
- **Example**:
|
|
147
|
+
|
|
148
|
+
```java
|
|
149
|
+
// Stored in Cosmos (persisted)
|
|
150
|
+
private List<String> specialtyIds = new ArrayList<>();
|
|
151
|
+
|
|
152
|
+
// For template access (transient)
|
|
153
|
+
@JsonIgnore
|
|
154
|
+
private List<Specialty> specialties = new ArrayList<>();
|
|
155
|
+
|
|
156
|
+
// Getters/setters for both properties
|
|
157
|
+
public List<String> getSpecialtyIds() {
|
|
158
|
+
return specialtyIds;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
public List<Specialty> getSpecialties() {
|
|
162
|
+
return specialties;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
- **Update count methods**: `getNrOfSpecialties()` should use transient list, not ID list
|
|
168
|
+
- **CRITICAL - Method Signature Conflicts**:
|
|
169
|
+
- **When converting ID types from Integer to String, check for method signature conflicts**
|
|
170
|
+
- **Common conflict**: `getPet(String name)` vs `getPet(String id)` - both have same signature
|
|
171
|
+
- **Solution**: Rename methods to be specific:
|
|
172
|
+
- `getPet(String id)` for ID-based lookup
|
|
173
|
+
- `getPetByName(String name)` for name-based lookup
|
|
174
|
+
- `getPetByName(String name, boolean ignoreNew)` for conditional name-based lookup
|
|
175
|
+
- **Update ALL callers** of renamed methods in controllers and tests
|
|
176
|
+
- **Method updates for entities**:
|
|
177
|
+
- Update `addVisit(Integer petId, Visit visit)` to `addVisit(String petId, Visit visit)`
|
|
178
|
+
- Ensure all ID comparison logic uses `.equals()` instead of `==`
|
|
179
|
+
|
|
180
|
+
### Step 5 — Repository conversion
|
|
181
|
+
|
|
182
|
+
- Change all repository interfaces:
|
|
183
|
+
- From: `extends JpaRepository<Entity, Integer>`
|
|
184
|
+
- To: `extends CosmosRepository<Entity, String>`
|
|
185
|
+
- **Query method updates**:
|
|
186
|
+
- Remove pagination parameters from custom queries
|
|
187
|
+
- Change `Page<Entity> findByX(String param, Pageable pageable)` to `List<Entity> findByX(String param)`
|
|
188
|
+
- Update `@Query` annotations to use Cosmos SQL syntax
|
|
189
|
+
- **Replace custom method names**: `findPetTypes()` → `findAllOrderByName()`
|
|
190
|
+
- **Update ALL references** to changed method names in controllers and formatters
|
|
191
|
+
|
|
192
|
+
### Step 6 — **Create service layer** for relationship management and template compatibility
|
|
193
|
+
|
|
194
|
+
- **CRITICAL**: Create service classes to bridge Cosmos document storage with existing template expectations
|
|
195
|
+
- **Purpose**: Handle relationship population and maintain template compatibility
|
|
196
|
+
- **Service pattern for each entity with relationships**:
|
|
197
|
+
```java
|
|
198
|
+
@Service
|
|
199
|
+
public class EntityService {
|
|
200
|
+
|
|
201
|
+
private final EntityRepository entityRepository;
|
|
202
|
+
private final RelatedRepository relatedRepository;
|
|
203
|
+
|
|
204
|
+
public EntityService(EntityRepository entityRepository, RelatedRepository relatedRepository) {
|
|
205
|
+
this.entityRepository = entityRepository;
|
|
206
|
+
this.relatedRepository = relatedRepository;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
public List<Entity> findAll() {
|
|
210
|
+
List<Entity> entities = entityRepository.findAll();
|
|
211
|
+
entities.forEach(this::populateRelationships);
|
|
212
|
+
return entities;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
public Optional<Entity> findById(String id) {
|
|
216
|
+
Optional<Entity> entityOpt = entityRepository.findById(id);
|
|
217
|
+
if (entityOpt.isPresent()) {
|
|
218
|
+
Entity entity = entityOpt.get();
|
|
219
|
+
populateRelationships(entity);
|
|
220
|
+
return Optional.of(entity);
|
|
221
|
+
}
|
|
222
|
+
return Optional.empty();
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
private void populateRelationships(Entity entity) {
|
|
226
|
+
if (entity.getRelatedIds() != null && !entity.getRelatedIds().isEmpty()) {
|
|
227
|
+
List<Related> related = entity
|
|
228
|
+
.getRelatedIds()
|
|
229
|
+
.stream()
|
|
230
|
+
.map(relatedRepository::findById)
|
|
231
|
+
.filter(Optional::isPresent)
|
|
232
|
+
.map(Optional::get)
|
|
233
|
+
.collect(Collectors.toList());
|
|
234
|
+
// Set transient property for template access
|
|
235
|
+
entity.setRelated(related);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Step 6.5 — **Spring Security Integration** (CRITICAL for Authentication)
|
|
243
|
+
|
|
244
|
+
- **UserDetailsService Integration Pattern**:
|
|
245
|
+
```java
|
|
246
|
+
@Service
|
|
247
|
+
@Transactional
|
|
248
|
+
public class DomainUserDetailsService implements UserDetailsService {
|
|
249
|
+
|
|
250
|
+
private final UserRepository userRepository;
|
|
251
|
+
private final AuthorityRepository authorityRepository;
|
|
252
|
+
|
|
253
|
+
@Override
|
|
254
|
+
public UserDetails loadUserByUsername(String login) {
|
|
255
|
+
log.debug("Authenticating user: {}", login);
|
|
256
|
+
|
|
257
|
+
return userRepository
|
|
258
|
+
.findOneByLogin(login)
|
|
259
|
+
.map(user -> createSpringSecurityUser(login, user))
|
|
260
|
+
.orElseThrow(() -> new UsernameNotFoundException("User " + login + " was not found"));
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
private org.springframework.security.core.userdetails.User createSpringSecurityUser(String lowercaseLogin, User user) {
|
|
264
|
+
if (!user.isActivated()) {
|
|
265
|
+
throw new UserNotActivatedException("User " + lowercaseLogin + " was not activated");
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// Convert string authorities back to GrantedAuthority objects
|
|
269
|
+
List<GrantedAuthority> grantedAuthorities = user
|
|
270
|
+
.getAuthorities()
|
|
271
|
+
.stream()
|
|
272
|
+
.map(SimpleGrantedAuthority::new)
|
|
273
|
+
.collect(Collectors.toList());
|
|
274
|
+
|
|
275
|
+
return new org.springframework.security.core.userdetails.User(user.getLogin(), user.getPassword(), grantedAuthorities);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
```
|
|
280
|
+
- **Key Authentication Requirements**:
|
|
281
|
+
- User entity must be fully serializable (no `@JsonIgnore` on password/authorities)
|
|
282
|
+
- Store authorities as `Set<String>` for Cosmos DB compatibility
|
|
283
|
+
- Convert between string authorities and `GrantedAuthority` objects in UserDetailsService
|
|
284
|
+
- Add comprehensive debugging logs to trace authentication flow
|
|
285
|
+
- Handle activated/deactivated user states appropriately
|
|
286
|
+
|
|
287
|
+
#### **Template Relationship Population Pattern**
|
|
288
|
+
|
|
289
|
+
Each service method that returns entities for template rendering MUST populate transient properties:
|
|
290
|
+
|
|
291
|
+
```java
|
|
292
|
+
private void populateRelationships(Entity entity) {
|
|
293
|
+
// For each relationship used in templates
|
|
294
|
+
if (entity.getRelatedIds() != null && !entity.getRelatedIds().isEmpty()) {
|
|
295
|
+
List<Related> relatedObjects = entity
|
|
296
|
+
.getRelatedIds()
|
|
297
|
+
.stream()
|
|
298
|
+
.map(relatedRepository::findById)
|
|
299
|
+
.filter(Optional::isPresent)
|
|
300
|
+
.map(Optional::get)
|
|
301
|
+
.collect(Collectors.toList());
|
|
302
|
+
entity.setRelated(relatedObjects); // Set transient property
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
#### **Critical Service Usage in Controllers**
|
|
309
|
+
|
|
310
|
+
- **Replace ALL direct repository calls** with service calls in controllers
|
|
311
|
+
- **Never return entities from repositories directly** to templates without relationship population
|
|
312
|
+
- **Update controllers** to use service layer instead of repositories directly
|
|
313
|
+
- **Controller pattern change**:
|
|
314
|
+
|
|
315
|
+
```java
|
|
316
|
+
// OLD: Direct repository usage
|
|
317
|
+
@Autowired
|
|
318
|
+
private EntityRepository entityRepository;
|
|
319
|
+
|
|
320
|
+
// NEW: Service layer usage
|
|
321
|
+
@Autowired
|
|
322
|
+
private EntityService entityService;
|
|
323
|
+
// Update method calls
|
|
324
|
+
// OLD: entityRepository.findAll()
|
|
325
|
+
// NEW: entityService.findAll()
|
|
326
|
+
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### Step 7 — Data seeding
|
|
330
|
+
|
|
331
|
+
- Create `@Component` implementing `CommandLineRunner`:
|
|
332
|
+
```java
|
|
333
|
+
@Component
|
|
334
|
+
public class DataSeeder implements CommandLineRunner {
|
|
335
|
+
|
|
336
|
+
@Override
|
|
337
|
+
public void run(String... args) throws Exception {
|
|
338
|
+
if (ownerRepository.count() > 0) {
|
|
339
|
+
return; // Data already exists
|
|
340
|
+
}
|
|
341
|
+
// Seed comprehensive test data with String IDs
|
|
342
|
+
// Use meaningful ID patterns: "owner-1", "pet-1", "pettype-1", etc.
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
```
|
|
347
|
+
- **CRITICAL - BigDecimal Reflection Issues with JDK 17+**:
|
|
348
|
+
- **If using BigDecimal fields**, you may encounter reflection errors during seeding
|
|
349
|
+
- **Error pattern**: `Unable to make field private final java.math.BigInteger java.math.BigDecimal.intVal accessible`
|
|
350
|
+
- **Solutions**:
|
|
351
|
+
1. Use `Double` or `String` instead of `BigDecimal` for monetary values
|
|
352
|
+
2. Add JVM argument: `--add-opens java.base/java.math=ALL-UNNAMED`
|
|
353
|
+
3. Wrap BigDecimal operations in try-catch and handle gracefully
|
|
354
|
+
- **The application will start successfully even if seeding fails** - check logs for seeding errors
|
|
355
|
+
|
|
356
|
+
### Step 8 — Test file conversion (CRITICAL SECTION)
|
|
357
|
+
|
|
358
|
+
**This step is often overlooked but essential for successful conversion**
|
|
359
|
+
|
|
360
|
+
#### A. **COMPILATION CHECK STRATEGY**
|
|
361
|
+
|
|
362
|
+
- **After each major change, run `mvn test-compile` to catch issues early**
|
|
363
|
+
- **Fix compilation errors systematically before proceeding**
|
|
364
|
+
- **Don't rely on IDE - Maven compilation reveals all issues**
|
|
365
|
+
|
|
366
|
+
#### B. **Search and Update ALL test files systematically**
|
|
367
|
+
|
|
368
|
+
**Use search tools to find and update every occurrence:**
|
|
369
|
+
|
|
370
|
+
- Search for: `int.*TEST.*ID` → Replace with: `String.*TEST.*ID = "test-xyz-1"`
|
|
371
|
+
- Search for: `setId\(\d+\)` → Replace with: `setId("test-id-X")`
|
|
372
|
+
- Search for: `findById\(\d+\)` → Replace with: `findById("test-id-X")`
|
|
373
|
+
- Search for: `\.findPetTypes\(\)` → Replace with: `.findAllOrderByName()`
|
|
374
|
+
- Search for: `\.findByLastNameStartingWith\(.*,.*Pageable` → Remove pagination parameter
|
|
375
|
+
|
|
376
|
+
#### C. Update test annotations and imports
|
|
377
|
+
|
|
378
|
+
- Replace `@DataJpaTest` with `@SpringBootTest` or appropriate slice test
|
|
379
|
+
- Remove `@AutoConfigureTestDatabase` annotations
|
|
380
|
+
- Remove `@Transactional` from tests (unless single-partition operations)
|
|
381
|
+
- Remove imports from `org.springframework.orm` package
|
|
382
|
+
|
|
383
|
+
#### D. Fix entity ID usage in ALL test files
|
|
384
|
+
|
|
385
|
+
**Critical files that MUST be updated (search entire test directory):**
|
|
386
|
+
|
|
387
|
+
- `*ControllerTests.java` - Path variables, entity creation, mock setup
|
|
388
|
+
- `*ServiceTests.java` - Repository interactions, entity IDs
|
|
389
|
+
- `EntityUtils.java` - Utility methods for ID handling
|
|
390
|
+
- `*FormatterTests.java` - Repository method calls
|
|
391
|
+
- `*ValidatorTests.java` - Entity creation with String IDs
|
|
392
|
+
- Integration test classes - Test data setup
|
|
393
|
+
|
|
394
|
+
#### E. **Fix Controller and Service classes affected by repository changes**
|
|
395
|
+
|
|
396
|
+
- **Update controllers that call repository methods with changed signatures**
|
|
397
|
+
- **Update formatters/converters that use repository methods**
|
|
398
|
+
- **Common files to check**:
|
|
399
|
+
- `PetTypeFormatter.java` - often calls `findPetTypes()` method
|
|
400
|
+
- `*Controller.java` - may have pagination logic to remove
|
|
401
|
+
- Service classes that use repository methods
|
|
402
|
+
|
|
403
|
+
#### F. Update repository mocking in tests
|
|
404
|
+
|
|
405
|
+
- Remove pagination from repository mocks:
|
|
406
|
+
- `given(repository.findByX(param, pageable)).willReturn(pageResult)`
|
|
407
|
+
- → `given(repository.findByX(param)).willReturn(listResult)`
|
|
408
|
+
- Update method names in mocks:
|
|
409
|
+
- `given(petTypeRepository.findPetTypes()).willReturn(types)`
|
|
410
|
+
- → `given(petTypeRepository.findAllOrderByName()).willReturn(types)`
|
|
411
|
+
|
|
412
|
+
#### G. Fix utility classes used by tests
|
|
413
|
+
|
|
414
|
+
- Update `EntityUtils.java` or similar:
|
|
415
|
+
- Remove JPA-specific exception imports (`ObjectRetrievalFailureException`)
|
|
416
|
+
- Change method signatures from `int id` to `String id`
|
|
417
|
+
- Update ID comparison logic: `entity.getId() == entityId` → `entity.getId().equals(entityId)`
|
|
418
|
+
- Replace JPA exceptions with standard exceptions (`IllegalArgumentException`)
|
|
419
|
+
|
|
420
|
+
#### H. Update assertions for String IDs
|
|
421
|
+
|
|
422
|
+
- Change ID assertions:
|
|
423
|
+
- `assertThat(entity.getId()).isNotZero()` → `assertThat(entity.getId()).isNotEmpty()`
|
|
424
|
+
- `assertThat(entity.getId()).isEqualTo(1)` → `assertThat(entity.getId()).isEqualTo("test-id-1")`
|
|
425
|
+
- JSON path assertions: `jsonPath("$.id").value(1)` → `jsonPath("$.id").value("test-id-1")`
|
|
426
|
+
|
|
427
|
+
### Step 8 — Test file conversion (CRITICAL SECTION)
|
|
428
|
+
|
|
429
|
+
**This step is often overlooked but essential for successful conversion**
|
|
430
|
+
|
|
431
|
+
#### A. **COMPILATION CHECK STRATEGY**
|
|
432
|
+
|
|
433
|
+
- **After each major change, run `mvn test-compile` to catch issues early**
|
|
434
|
+
- **Fix compilation errors systematically before proceeding**
|
|
435
|
+
- **Don't rely on IDE - Maven compilation reveals all issues**
|
|
436
|
+
|
|
437
|
+
#### B. **Search and Update ALL test files systematically**
|
|
438
|
+
|
|
439
|
+
**Use search tools to find and update every occurrence:**
|
|
440
|
+
|
|
441
|
+
- Search for: `setId\(\d+\)` → Replace with: `setId("test-id-X")`
|
|
442
|
+
- Search for: `findById\(\d+\)` → Replace with: `findById("test-id-X")`
|
|
443
|
+
- Search for: `\.findPetTypes\(\)` → Replace with: `.findAllOrderByName()`
|
|
444
|
+
- Search for: `\.findByLastNameStartingWith\(.*,.*Pageable` → Remove pagination parameter
|
|
445
|
+
|
|
446
|
+
#### C. Update test annotations and imports
|
|
447
|
+
|
|
448
|
+
- Replace `@DataJpaTest` with `@SpringBootTest` or appropriate slice test
|
|
449
|
+
- Remove `@AutoConfigureTestDatabase` annotations
|
|
450
|
+
- Remove `@Transactional` from tests (unless single-partition operations)
|
|
451
|
+
- Remove imports from `org.springframework.orm` package
|
|
452
|
+
|
|
453
|
+
#### D. Fix entity ID usage in ALL test files
|
|
454
|
+
|
|
455
|
+
**Critical files that MUST be updated (search entire test directory):**
|
|
456
|
+
|
|
457
|
+
- `*ControllerTests.java` - Path variables, entity creation, mock setup
|
|
458
|
+
- `*ServiceTests.java` - Repository interactions, entity IDs
|
|
459
|
+
- `EntityUtils.java` - Utility methods for ID handling
|
|
460
|
+
- `*FormatterTests.java` - Repository method calls
|
|
461
|
+
- `*ValidatorTests.java` - Entity creation with String IDs
|
|
462
|
+
- Integration test classes - Test data setup
|
|
463
|
+
|
|
464
|
+
#### E. **Fix Controller and Service classes affected by repository changes**
|
|
465
|
+
|
|
466
|
+
- **Update controllers that call repository methods with changed signatures**
|
|
467
|
+
- **Update formatters/converters that use repository methods**
|
|
468
|
+
- **Common files to check**:
|
|
469
|
+
- `PetTypeFormatter.java` - often calls `findPetTypes()` method
|
|
470
|
+
- `*Controller.java` - may have pagination logic to remove
|
|
471
|
+
- Service classes that use repository methods
|
|
472
|
+
|
|
473
|
+
#### F. Update repository mocking in tests
|
|
474
|
+
|
|
475
|
+
- Remove pagination from repository mocks:
|
|
476
|
+
- `given(repository.findByX(param, pageable)).willReturn(pageResult)`
|
|
477
|
+
- → `given(repository.findByX(param)).willReturn(listResult)`
|
|
478
|
+
- Update method names in mocks:
|
|
479
|
+
- `given(petTypeRepository.findPetTypes()).willReturn(types)`
|
|
480
|
+
- → `given(petTypeRepository.findAllOrderByName()).willReturn(types)`
|
|
481
|
+
|
|
482
|
+
#### G. Fix utility classes used by tests
|
|
483
|
+
|
|
484
|
+
- Update `EntityUtils.java` or similar:
|
|
485
|
+
- Remove JPA-specific exception imports (`ObjectRetrievalFailureException`)
|
|
486
|
+
- Change method signatures from `int id` to `String id`
|
|
487
|
+
- Update ID comparison logic: `entity.getId() == entityId` → `entity.getId().equals(entityId)`
|
|
488
|
+
- Replace JPA exceptions with standard exceptions (`IllegalArgumentException`)
|
|
489
|
+
|
|
490
|
+
#### H. Update assertions for String IDs
|
|
491
|
+
|
|
492
|
+
- Change ID assertions:
|
|
493
|
+
- `assertThat(entity.getId()).isNotZero()` → `assertThat(entity.getId()).isNotEmpty()`
|
|
494
|
+
- `assertThat(entity.getId()).isEqualTo(1)` → `assertThat(entity.getId()).isEqualTo("test-id-1")`
|
|
495
|
+
- JSON path assertions: `jsonPath("$.id").value(1)` → `jsonPath("$.id").value("test-id-1")`
|
|
496
|
+
|
|
497
|
+
### Step 9 — **Runtime Testing and Template Compatibility**
|
|
498
|
+
|
|
499
|
+
#### **CRITICAL**: Test the running application after compilation success
|
|
500
|
+
|
|
501
|
+
- **Start the application**: `mvn spring-boot:run`
|
|
502
|
+
- **Navigate through all pages** in the web interface to identify runtime errors
|
|
503
|
+
- **Common runtime issues after conversion**:
|
|
504
|
+
- Templates trying to access properties that no longer exist (e.g., `vet.specialties`)
|
|
505
|
+
- Service layer not populating transient relationship properties
|
|
506
|
+
- Controllers not using service layer for relationship loading
|
|
507
|
+
|
|
508
|
+
#### **Template compatibility fixes**:
|
|
509
|
+
|
|
510
|
+
- **If templates access relationship properties** (e.g., `entity.relatedObjects`):
|
|
511
|
+
- Ensure transient properties exist on entities with proper getters/setters
|
|
512
|
+
- Verify service layer populates these transient properties
|
|
513
|
+
- Update `getNrOfXXX()` methods to use transient lists instead of ID lists
|
|
514
|
+
- **Check for SpEL (Spring Expression Language) errors** in logs:
|
|
515
|
+
- `Property or field 'xxx' cannot be found` → Add missing transient property
|
|
516
|
+
- `EL1008E` errors → Service layer not populating relationships
|
|
517
|
+
|
|
518
|
+
#### **Service layer verification**:
|
|
519
|
+
|
|
520
|
+
- **Ensure all controllers use service layer** instead of direct repository access
|
|
521
|
+
- **Verify service methods populate relationships** before returning entities
|
|
522
|
+
- **Test all CRUD operations** through the web interface
|
|
523
|
+
|
|
524
|
+
### Step 9.5 — **Template Runtime Validation** (CRITICAL)
|
|
525
|
+
|
|
526
|
+
#### **Systematic Template Testing Process**
|
|
527
|
+
|
|
528
|
+
After successful compilation and application startup:
|
|
529
|
+
|
|
530
|
+
1. **Navigate to EVERY page** in the application systematically
|
|
531
|
+
2. **Test each template that displays entity data**:
|
|
532
|
+
- List pages (e.g., `/vets`, `/owners`)
|
|
533
|
+
- Detail pages (e.g., `/owners/{id}`, `/vets/{id}`)
|
|
534
|
+
- Forms and edit pages
|
|
535
|
+
3. **Look for specific template errors**:
|
|
536
|
+
- `Property or field 'relationshipName' cannot be found on object of type 'EntityName'`
|
|
537
|
+
- `EL1008E` Spring Expression Language errors
|
|
538
|
+
- Empty or missing data where relationships should appear
|
|
539
|
+
|
|
540
|
+
#### **Template Error Resolution Checklist**
|
|
541
|
+
|
|
542
|
+
When encountering template errors:
|
|
543
|
+
|
|
544
|
+
- [ ] **Identify the missing property** from error message
|
|
545
|
+
- [ ] **Check if property exists as transient field** in entity
|
|
546
|
+
- [ ] **Verify service layer populates the property** before returning entity
|
|
547
|
+
- [ ] **Ensure controller uses service layer**, not direct repository access
|
|
548
|
+
- [ ] **Test the specific page again** after fixes
|
|
549
|
+
|
|
550
|
+
#### **Common Template Error Patterns**
|
|
551
|
+
|
|
552
|
+
- `Property or field 'specialties' cannot be found` → Add `@JsonIgnore private List<Specialty> specialties` to Vet entity
|
|
553
|
+
- `Property or field 'pets' cannot be found` → Add `@JsonIgnore private List<Pet> pets` to Owner entity
|
|
554
|
+
- Empty relationship data displayed → Service not populating transient properties
|
|
555
|
+
|
|
556
|
+
### Step 10 — **Systematic Error Resolution Process**
|
|
557
|
+
|
|
558
|
+
#### When compilation fails:
|
|
559
|
+
|
|
560
|
+
1. **Run `mvn compile` first** - fix main source issues before tests
|
|
561
|
+
2. **Run `mvn test-compile`** - systematically fix each test compilation error
|
|
562
|
+
3. **Focus on most frequent error patterns**:
|
|
563
|
+
- `int cannot be converted to String` → Change test constants and entity setters
|
|
564
|
+
- `method X cannot be applied to given types` → Remove pagination parameters
|
|
565
|
+
- `cannot find symbol: method Y()` → Update to new repository method names
|
|
566
|
+
- Method signature conflicts → Rename conflicting methods
|
|
567
|
+
|
|
568
|
+
### Step 10 — **Systematic Error Resolution Process**
|
|
569
|
+
|
|
570
|
+
#### When compilation fails:
|
|
571
|
+
|
|
572
|
+
1. **Run `mvn compile` first** - fix main source issues before tests
|
|
573
|
+
2. **Run `mvn test-compile`** - systematically fix each test compilation error
|
|
574
|
+
3. **Focus on most frequent error patterns**:
|
|
575
|
+
- `int cannot be converted to String` → Change test constants and entity setters
|
|
576
|
+
- `method X cannot be applied to given types` → Remove pagination parameters
|
|
577
|
+
- `cannot find symbol: method Y()` → Update to new repository method names
|
|
578
|
+
- Method signature conflicts → Rename conflicting methods
|
|
579
|
+
#### When runtime fails:
|
|
580
|
+
|
|
581
|
+
1. **Check application logs** for specific error messages
|
|
582
|
+
2. **Look for template/SpEL errors**:
|
|
583
|
+
- `Property or field 'xxx' cannot be found` → Add transient property to entity
|
|
584
|
+
- Missing relationship data → Service layer not populating relationships
|
|
585
|
+
3. **Verify service layer usage** in controllers
|
|
586
|
+
4. **Test navigation through all application pages**
|
|
587
|
+
|
|
588
|
+
#### Common error patterns and solutions:
|
|
589
|
+
|
|
590
|
+
- **`method findByLastNameStartingWith cannot be applied`** → Remove `Pageable` parameter
|
|
591
|
+
- **`cannot find symbol: method findPetTypes()`** → Change to `findAllOrderByName()`
|
|
592
|
+
- **`incompatible types: int cannot be converted to String`** → Update test ID constants
|
|
593
|
+
- **`method getPet(String) is already defined`** → Rename one method (e.g., `getPetByName`)
|
|
594
|
+
- **`cannot find symbol: method isNotZero()`** → Change to `isNotEmpty()` for String IDs
|
|
595
|
+
- **`Property or field 'specialties' cannot be found`** → Add transient property and populate in service
|
|
596
|
+
- **`ClassCastException: reactor.core.publisher.BlockingIterable cannot be cast to java.util.List`** → Fix repository `findAllWithEagerRelationships()` method to use StreamSupport
|
|
597
|
+
- **`Unable to make field...BigDecimal.intVal accessible`** → Replace BigDecimal with Double throughout application
|
|
598
|
+
- **Health check database failure** → Remove 'db' from health check readiness configuration
|
|
599
|
+
|
|
600
|
+
#### **Template-Specific Runtime Errors**
|
|
601
|
+
|
|
602
|
+
- **`Property or field 'XXX' cannot be found on object of type 'YYY'`**:
|
|
603
|
+
|
|
604
|
+
- Root cause: Template accessing relationship property that was converted to ID storage
|
|
605
|
+
- Solution: Add transient property to entity + populate in service layer
|
|
606
|
+
- Prevention: Always check template usage before converting relationships
|
|
607
|
+
|
|
608
|
+
- **`EL1008E` Spring Expression Language errors**:
|
|
609
|
+
|
|
610
|
+
- Root cause: Service layer not populating transient properties
|
|
611
|
+
- Solution: Verify `populateRelationships()` methods are called and working
|
|
612
|
+
- Prevention: Test all template navigation after service layer implementation
|
|
613
|
+
|
|
614
|
+
- **Empty/null relationship data in templates**:
|
|
615
|
+
- Root cause: Controller bypassing service layer or service not populating relationships
|
|
616
|
+
- Solution: Ensure all controller methods use service layer for entity retrieval
|
|
617
|
+
- Prevention: Never return repository results directly to templates
|
|
618
|
+
|
|
619
|
+
### Step 11 — Validation checklist
|
|
620
|
+
|
|
621
|
+
After conversion, verify:
|
|
622
|
+
|
|
623
|
+
- [ ] **Main application compiles**: `mvn compile` succeeds
|
|
624
|
+
- [ ] **All test files compile**: `mvn test-compile` succeeds
|
|
625
|
+
- [ ] **No compilation errors**: Address every single compilation error
|
|
626
|
+
- [ ] **Application starts successfully**: `mvn spring-boot:run` without errors
|
|
627
|
+
- [ ] **All web pages load**: Navigate through all application pages without runtime errors
|
|
628
|
+
- [ ] **Service layer populates relationships**: Transient properties are correctly set
|
|
629
|
+
- [ ] **All template pages render without errors**: Navigate through entire application
|
|
630
|
+
- [ ] **Relationship data displays correctly**: Lists, counts, and related objects show properly
|
|
631
|
+
- [ ] **No SpEL template errors in logs**: Check application logs during navigation
|
|
632
|
+
- [ ] **Transient properties are @JsonIgnore annotated**: Prevents JSON serialization issues
|
|
633
|
+
- [ ] **Service layer used consistently**: No direct repository access in controllers for template rendering
|
|
634
|
+
- [ ] No remaining `jakarta.persistence` imports
|
|
635
|
+
- [ ] All entity IDs are `String` type consistently
|
|
636
|
+
- [ ] All repository interfaces extend `CosmosRepository<Entity, String>`
|
|
637
|
+
- [ ] Configuration uses `DefaultAzureCredential` for authentication
|
|
638
|
+
- [ ] Data seeding component exists and works
|
|
639
|
+
- [ ] Test files use String IDs consistently
|
|
640
|
+
- [ ] Repository mocks updated for Cosmos methods
|
|
641
|
+
- [ ] **No method signature conflicts** in entity classes
|
|
642
|
+
- [ ] **All renamed methods updated** in callers (controllers, tests, formatters)
|
|
643
|
+
|
|
644
|
+
### Common pitfalls to avoid
|
|
645
|
+
|
|
646
|
+
1. **Not checking compilation frequently** - Run `mvn test-compile` after each major change
|
|
647
|
+
2. **Method signature conflicts** - Method overloading issues when converting ID types
|
|
648
|
+
3. **Forgetting to update method callers** - When renaming methods, update ALL callers
|
|
649
|
+
4. **Missing repository method renames** - Custom repository methods must be updated everywhere called
|
|
650
|
+
5. **Using key-based authentication** - Use `DefaultAzureCredential` instead
|
|
651
|
+
6. **Mixing Integer and String IDs** - Be consistent with String IDs everywhere, especially in tests
|
|
652
|
+
7. **Not updating controller pagination logic** - Remove pagination from controllers when repositories change
|
|
653
|
+
8. **Leaving JPA-specific test annotations** - Replace with Cosmos-compatible alternatives
|
|
654
|
+
9. **Incomplete test file updates** - Search entire test directory, not just obvious files
|
|
655
|
+
10. **Skipping runtime testing** - Always test the running application, not just compilation
|
|
656
|
+
11. **Missing service layer** - Don't access repositories directly from controllers
|
|
657
|
+
12. **Forgetting transient properties** - Templates may need access to relationship data
|
|
658
|
+
13. **Not testing template navigation** - Compilation success doesn't mean templates work
|
|
659
|
+
14. **Missing transient properties for templates** - Templates need object access, not just IDs
|
|
660
|
+
15. **Service layer bypassing** - Controllers must use services, never direct repository access
|
|
661
|
+
16. **Incomplete relationship population** - Service methods must populate ALL transient properties used by templates
|
|
662
|
+
17. **Forgetting @JsonIgnore on transient properties** - Prevents serialization issues
|
|
663
|
+
18. **@JsonIgnore on persisted fields** - **CRITICAL**: Never use `@JsonIgnore` on fields that need to be stored in Cosmos DB
|
|
664
|
+
19. **Authentication serialization errors** - User/Authority entities must be fully serializable without `@JsonIgnore` blocking required fields
|
|
665
|
+
20. **BigDecimal reflection issues** - Use alternative data types or JVM arguments for JDK 17+ compatibility
|
|
666
|
+
21. **Repository reactive type casting** - Don't cast `findAll()` directly to `List`, use `StreamSupport.stream().collect(Collectors.toList())`
|
|
667
|
+
22. **Health check database references** - Remove database dependencies from Spring Boot health checks after JPA removal
|
|
668
|
+
23. **Collection type mismatches** - Update service methods to handle String vs object collections consistently
|
|
669
|
+
|
|
670
|
+
### Debugging compilation issues systematically
|
|
671
|
+
|
|
672
|
+
If compilation fails after conversion:
|
|
673
|
+
|
|
674
|
+
1. **Start with main compilation**: `mvn compile` - fix entity and controller issues first
|
|
675
|
+
2. **Then test compilation**: `mvn test-compile` - fix each error systematically
|
|
676
|
+
3. **Check for remaining `jakarta.persistence` imports** throughout codebase
|
|
677
|
+
4. **Verify all test constants use String IDs** - search for `int.*TEST.*ID`
|
|
678
|
+
5. **Ensure repository method signatures match** new Cosmos interface
|
|
679
|
+
6. **Check for mixed Integer/String ID usage** in entity relationships and tests
|
|
680
|
+
7. **Validate all mocking uses correct method names** (`findAllOrderByName()` not `findPetTypes()`)
|
|
681
|
+
8. **Look for method signature conflicts** - resolve by renaming conflicting methods
|
|
682
|
+
9. **Verify assertion methods work with String IDs** (`isNotEmpty()` not `isNotZero()`)
|
|
683
|
+
|
|
684
|
+
### Debugging runtime issues systematically
|
|
685
|
+
|
|
686
|
+
If runtime fails after successful compilation:
|
|
687
|
+
|
|
688
|
+
1. **Check application startup logs** for initialization errors
|
|
689
|
+
2. **Navigate through all pages** to identify template/controller issues
|
|
690
|
+
3. **Look for SpEL template errors** in logs:
|
|
691
|
+
- `Property or field 'xxx' cannot be found` → Missing transient property
|
|
692
|
+
- `EL1008E` → Service layer not populating relationships
|
|
693
|
+
4. **Verify service layer is being used** instead of direct repository access
|
|
694
|
+
5. **Check that transient properties are populated** in service methods
|
|
695
|
+
6. **Test all CRUD operations** through the web interface
|
|
696
|
+
7. **Verify data seeding worked correctly** and relationships are maintained
|
|
697
|
+
8. **Authentication-specific debugging**:
|
|
698
|
+
- `Cannot pass null or empty values to constructor` → Check for `@JsonIgnore` on required fields
|
|
699
|
+
- `BadCredentialsException` → Verify User entity serialization and password field accessibility
|
|
700
|
+
- Check logs for "DomainUserDetailsService" debugging output to trace authentication flow
|
|
701
|
+
|
|
702
|
+
### **Pro Tips for Success**
|
|
703
|
+
|
|
704
|
+
- **Compile early and often** - Don't let errors accumulate
|
|
705
|
+
- **Use global search and replace** - Find all occurrences of patterns to update
|
|
706
|
+
- **Be systematic** - Fix one type of error across all files before moving to next
|
|
707
|
+
- **Test method renames carefully** - Ensure all callers are updated
|
|
708
|
+
- **Use meaningful String IDs** - "owner-1", "pet-1" instead of random strings
|
|
709
|
+
- **Check controller classes** - They often call repository methods that change signatures
|
|
710
|
+
- **Always test runtime** - Compilation success doesn't guarantee functional templates
|
|
711
|
+
- **Service layer is critical** - Bridge between document storage and template expectations
|
|
712
|
+
|
|
713
|
+
### **Authentication Troubleshooting Guide** (CRITICAL)
|
|
714
|
+
|
|
715
|
+
#### **Common Authentication Serialization Errors**:
|
|
716
|
+
|
|
717
|
+
1. **`Cannot pass null or empty values to constructor`**:
|
|
718
|
+
|
|
719
|
+
- **Root Cause**: `@JsonIgnore` preventing required field serialization to Cosmos DB
|
|
720
|
+
- **Solution**: Remove `@JsonIgnore` from all persisted fields (password, authorities, etc.)
|
|
721
|
+
- **Verification**: Check User entity has no `@JsonIgnore` on stored fields
|
|
722
|
+
|
|
723
|
+
2. **`BadCredentialsException` during login**:
|
|
724
|
+
|
|
725
|
+
- **Root Cause**: Password field not accessible during authentication
|
|
726
|
+
- **Solution**: Ensure password field is serializable and accessible in UserDetailsService
|
|
727
|
+
- **Verification**: Add debug logs in `loadUserByUsername` method
|
|
728
|
+
|
|
729
|
+
3. **Authorities not loading correctly**:
|
|
730
|
+
|
|
731
|
+
- **Root Cause**: Authority objects stored as complex entities instead of strings
|
|
732
|
+
- **Solution**: Store authorities as `Set<String>` and convert to `GrantedAuthority` in UserDetailsService
|
|
733
|
+
- **Pattern**:
|
|
734
|
+
|
|
735
|
+
```java
|
|
736
|
+
// In User entity - stored in Cosmos
|
|
737
|
+
@JsonProperty("authorities")
|
|
738
|
+
private Set<String> authorities = new HashSet<>();
|
|
739
|
+
|
|
740
|
+
// In UserDetailsService - convert for Spring Security
|
|
741
|
+
List<GrantedAuthority> grantedAuthorities = user
|
|
742
|
+
.getAuthorities()
|
|
743
|
+
.stream()
|
|
744
|
+
.map(SimpleGrantedAuthority::new)
|
|
745
|
+
.collect(Collectors.toList());
|
|
746
|
+
|
|
747
|
+
```
|
|
748
|
+
|
|
749
|
+
4. **User entity not found during authentication**:
|
|
750
|
+
- **Root Cause**: Repository query methods not working with String IDs
|
|
751
|
+
- **Solution**: Update repository `findOneByLogin` method to work with Cosmos DB
|
|
752
|
+
- **Verification**: Test repository methods independently
|
|
753
|
+
|
|
754
|
+
#### **Authentication Debugging Checklist**:
|
|
755
|
+
|
|
756
|
+
- [ ] User entity fully serializable (no `@JsonIgnore` on persisted fields)
|
|
757
|
+
- [ ] Password field accessible and not null
|
|
758
|
+
- [ ] Authorities stored as `Set<String>`
|
|
759
|
+
- [ ] UserDetailsService converts string authorities to `GrantedAuthority`
|
|
760
|
+
- [ ] Repository methods work with String IDs
|
|
761
|
+
- [ ] Debug logging enabled in authentication service
|
|
762
|
+
- [ ] User activation status checked appropriately
|
|
763
|
+
- [ ] Test login with known credentials (admin/admin)
|
|
764
|
+
|
|
765
|
+
### **Common Runtime Issues and Solutions**
|
|
766
|
+
|
|
767
|
+
#### **Issue 1: Repository Reactive Type Casting Errors**
|
|
768
|
+
|
|
769
|
+
**Error**: `ClassCastException: reactor.core.publisher.BlockingIterable cannot be cast to java.util.List`
|
|
770
|
+
|
|
771
|
+
**Root Cause**: Cosmos repositories return reactive types (`Iterable`) but legacy JPA code expects `List`
|
|
772
|
+
|
|
773
|
+
**Solution**: Convert reactive types properly in repository methods:
|
|
774
|
+
|
|
775
|
+
```java
|
|
776
|
+
// WRONG - Direct casting fails
|
|
777
|
+
default List<Entity> customFindMethod() {
|
|
778
|
+
return (List<Entity>) this.findAll(); // ClassCastException!
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
// CORRECT - Convert Iterable to List
|
|
782
|
+
default List<Entity> customFindMethod() {
|
|
783
|
+
return StreamSupport.stream(this.findAll().spliterator(), false)
|
|
784
|
+
.collect(Collectors.toList());
|
|
785
|
+
}
|
|
786
|
+
```
|
|
787
|
+
|
|
788
|
+
**Files to Check**:
|
|
789
|
+
|
|
790
|
+
- All repository interfaces with custom default methods
|
|
791
|
+
- Any method that returns `List<Entity>` from Cosmos repository calls
|
|
792
|
+
- Import `java.util.stream.StreamSupport` and `java.util.stream.Collectors`
|
|
793
|
+
|
|
794
|
+
#### **Issue 2: BigDecimal Reflection Issues in Java 17+**
|
|
795
|
+
|
|
796
|
+
**Error**: `Unable to make field private final java.math.BigInteger java.math.BigDecimal.intVal accessible`
|
|
797
|
+
|
|
798
|
+
**Root Cause**: Java 17+ module system restricts reflection access to BigDecimal internal fields during serialization
|
|
799
|
+
|
|
800
|
+
**Solutions**:
|
|
801
|
+
|
|
802
|
+
1. **Replace with Double for simple cases**:
|
|
803
|
+
|
|
804
|
+
```java
|
|
805
|
+
// Before: BigDecimal fields
|
|
806
|
+
private BigDecimal amount;
|
|
807
|
+
|
|
808
|
+
// After: Double fields (if precision requirements allow)
|
|
809
|
+
private Double amount;
|
|
810
|
+
|
|
811
|
+
```
|
|
812
|
+
|
|
813
|
+
2. **Use String for high precision requirements**:
|
|
814
|
+
|
|
815
|
+
```java
|
|
816
|
+
// Store as String, convert as needed
|
|
817
|
+
private String amount; // Store "1500.00"
|
|
818
|
+
|
|
819
|
+
public BigDecimal getAmountAsBigDecimal() {
|
|
820
|
+
return new BigDecimal(amount);
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
```
|
|
824
|
+
|
|
825
|
+
3. **Add JVM argument** (if BigDecimal must be kept):
|
|
826
|
+
```
|
|
827
|
+
--add-opens java.base/java.math=ALL-UNNAMED
|
|
828
|
+
```
|
|
829
|
+
|
|
830
|
+
#### **Issue 3: Health Check Database Dependencies**
|
|
831
|
+
|
|
832
|
+
**Error**: Application fails health checks looking for removed database components
|
|
833
|
+
|
|
834
|
+
**Root Cause**: Spring Boot health checks still reference JPA/database dependencies after removal
|
|
835
|
+
|
|
836
|
+
**Solution**: Update health check configuration:
|
|
837
|
+
|
|
838
|
+
```yaml
|
|
839
|
+
# In application.yml - Remove database from health checks
|
|
840
|
+
management:
|
|
841
|
+
health:
|
|
842
|
+
readiness:
|
|
843
|
+
include: 'ping,diskSpace' # Remove 'db' if present
|
|
844
|
+
```
|
|
845
|
+
|
|
846
|
+
**Files to Check**:
|
|
847
|
+
|
|
848
|
+
- All `application*.yml` configuration files
|
|
849
|
+
- Remove any database-specific health indicators
|
|
850
|
+
- Check actuator endpoint configurations
|
|
851
|
+
|
|
852
|
+
#### **Issue 4: Collection Type Mismatches in Services**
|
|
853
|
+
|
|
854
|
+
**Error**: Type mismatch errors when converting entity relationships to String-based storage
|
|
855
|
+
|
|
856
|
+
**Root Cause**: Service methods expecting different collection types after entity conversion
|
|
857
|
+
|
|
858
|
+
**Solution**: Update service methods to handle new entity structure:
|
|
859
|
+
|
|
860
|
+
```java
|
|
861
|
+
// Before: Entity relationships
|
|
862
|
+
public Set<RelatedEntity> getRelatedEntities() {
|
|
863
|
+
return entity.getRelatedEntities(); // Direct entity references
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
// After: String-based relationships with conversion
|
|
867
|
+
public Set<RelatedEntity> getRelatedEntities() {
|
|
868
|
+
return entity.getRelatedEntityIds()
|
|
869
|
+
.stream()
|
|
870
|
+
.map(relatedRepository::findById)
|
|
871
|
+
.filter(Optional::isPresent)
|
|
872
|
+
.map(Optional::get)
|
|
873
|
+
.collect(Collectors.toSet());
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
### **Enhanced Error Resolution Process**
|
|
877
|
+
|
|
878
|
+
#### **Common Error Patterns and Solutions**:
|
|
879
|
+
|
|
880
|
+
1. **Reactive Type Casting Errors**:
|
|
881
|
+
- **Pattern**: `cannot be cast to java.util.List`
|
|
882
|
+
- **Fix**: Use `StreamSupport.stream().collect(Collectors.toList())`
|
|
883
|
+
- **Files**: Repository interfaces with custom default methods
|
|
884
|
+
|
|
885
|
+
2. **BigDecimal Serialization Errors**:
|
|
886
|
+
- **Pattern**: `Unable to make field...BigDecimal.intVal accessible`
|
|
887
|
+
- **Fix**: Replace with Double, String, or add JVM module opens
|
|
888
|
+
- **Files**: Entity classes, DTOs, data initialization classes
|
|
889
|
+
|
|
890
|
+
3. **Health Check Database Errors**:
|
|
891
|
+
- **Pattern**: Health check fails looking for database
|
|
892
|
+
- **Fix**: Remove database references from health check configuration
|
|
893
|
+
- **Files**: application.yml configuration files
|
|
894
|
+
|
|
895
|
+
4. **Collection Type Conversion Errors**:
|
|
896
|
+
- **Pattern**: Type mismatch in entity relationship handling
|
|
897
|
+
- **Fix**: Update service methods to handle String-based entity references
|
|
898
|
+
- **Files**: Service classes, DTOs, entity relationship methods
|
|
899
|
+
|
|
900
|
+
#### **Enhanced Validation Checklist**:
|
|
901
|
+
- [ ] **Repository reactive casting handled**: No ClassCastException on collection returns
|
|
902
|
+
- [ ] **BigDecimal compatibility resolved**: Java 17+ serialization works
|
|
903
|
+
- [ ] **Health checks updated**: No database dependencies in health configuration
|
|
904
|
+
- [ ] **Service layer collection handling**: String-based entity references work correctly
|
|
905
|
+
- [ ] **Data seeding completes**: "Data seeding completed" message appears in logs
|
|
906
|
+
- [ ] **Application starts fully**: Both frontend and backend accessible
|
|
907
|
+
- [ ] **Authentication works**: Can sign in without serialization errors
|
|
908
|
+
- [ ] **CRUD operations functional**: All entity operations work through UI
|
|
909
|
+
|
|
910
|
+
## **Quick Reference: Common Post-Migration Fixes**
|
|
911
|
+
|
|
912
|
+
### **Top Runtime Issues to Check**
|
|
913
|
+
|
|
914
|
+
1. **Repository Collection Casting**:
|
|
915
|
+
```java
|
|
916
|
+
// Fix any repository methods that return collections:
|
|
917
|
+
default List<Entity> customFindMethod() {
|
|
918
|
+
return StreamSupport.stream(this.findAll().spliterator(), false)
|
|
919
|
+
.collect(Collectors.toList());
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
2. **BigDecimal Compatibility (Java 17+)**:
|
|
923
|
+
|
|
924
|
+
```java
|
|
925
|
+
// Replace BigDecimal fields with alternatives:
|
|
926
|
+
private Double amount; // Or String for high precision
|
|
927
|
+
|
|
928
|
+
```
|
|
929
|
+
|
|
930
|
+
3. **Health Check Configuration**:
|
|
931
|
+
```yaml
|
|
932
|
+
# Remove database dependencies from health checks:
|
|
933
|
+
management:
|
|
934
|
+
health:
|
|
935
|
+
readiness:
|
|
936
|
+
include: 'ping,diskSpace'
|
|
937
|
+
```
|
|
938
|
+
|
|
939
|
+
### **Authentication Conversion Patterns**
|
|
940
|
+
|
|
941
|
+
- **Remove `@JsonIgnore` from fields that need Cosmos DB persistence**
|
|
942
|
+
- **Store complex objects as simple types** (e.g., authorities as `Set<String>`)
|
|
943
|
+
- **Convert between simple and complex types** in service/repository layers
|
|
944
|
+
|
|
945
|
+
### **Template/UI Compatibility Patterns**
|
|
946
|
+
|
|
947
|
+
- **Add transient properties** with `@JsonIgnore` for UI access to related data
|
|
948
|
+
- **Use service layer** to populate transient relationships before rendering
|
|
949
|
+
- **Never return repository results directly** to templates without relationship population
|