[{"data":1,"prerenderedAt":547},["ShallowReactive",2],{"content-query-9lpnp4Kn76":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"sidebar_position":10,"body":11,"_type":541,"_id":542,"_source":543,"_file":544,"_stem":545,"_extension":546},"/docs/sdks/java","sdks",false,"","Java SDK","The official CredVault SDK for Java applications. Built for enterprise environments, this SDK provides robust, type-safe access to all platform capabilities.",3,{"type":12,"children":13,"toc":530},"root",[14,22,27,34,39,44,49,55,60,65,71,76,85,106,114,166,171,177,182,224,229,234,240,245,255,265,275,285,295,301,306,311,317,322,457,463,468,473,479,489,499,509,519,524],{"type":15,"tag":16,"props":17,"children":19},"element","h1",{"id":18},"java-sdk",[20],{"type":21,"value":8},"text",{"type":15,"tag":23,"props":24,"children":25},"p",{},[26],{"type":21,"value":9},{"type":15,"tag":28,"props":29,"children":31},"h2",{"id":30},"why-use-the-java-sdk",[32],{"type":21,"value":33},"Why Use the Java SDK?",{"type":15,"tag":23,"props":35,"children":36},{},[37],{"type":21,"value":38},"Java remains the language of choice for large-scale enterprise applications. The CredVault Java SDK is designed with enterprise needs in mind: thread safety, comprehensive error handling, and compatibility with popular frameworks like Spring Boot.",{"type":15,"tag":23,"props":40,"children":41},{},[42],{"type":21,"value":43},"The SDK uses OkHttp for efficient HTTP communication and Gson for JSON serialization. These proven libraries ensure reliable performance under heavy load.",{"type":15,"tag":23,"props":45,"children":46},{},[47],{"type":21,"value":48},"All public methods use descriptive return types, making it easy to work with responses. IDE support is excellent, with full JavaDoc documentation for every class and method.",{"type":15,"tag":28,"props":50,"children":52},{"id":51},"system-requirements",[53],{"type":21,"value":54},"System Requirements",{"type":15,"tag":23,"props":56,"children":57},{},[58],{"type":21,"value":59},"The SDK requires Java 11 or higher. It's compatible with all major Java distributions including Oracle JDK, OpenJDK, and Amazon Corretto.",{"type":15,"tag":23,"props":61,"children":62},{},[63],{"type":21,"value":64},"For building projects, the SDK works with both Maven and Gradle. Dependencies are published to Maven Central, the standard repository for Java libraries.",{"type":15,"tag":28,"props":66,"children":68},{"id":67},"installation",[69],{"type":21,"value":70},"Installation",{"type":15,"tag":23,"props":72,"children":73},{},[74],{"type":21,"value":75},"Add the SDK dependency to your build configuration.",{"type":15,"tag":23,"props":77,"children":78},{},[79],{"type":15,"tag":80,"props":81,"children":82},"strong",{},[83],{"type":21,"value":84},"For Gradle users (build.gradle):",{"type":15,"tag":86,"props":87,"children":91},"pre",{"className":88,"code":89,"language":90,"meta":7,"style":7},"language-gradle shiki shiki-themes github-dark","implementation 'com.credvault:credvault-edge:1.0.0'\n","gradle",[92],{"type":15,"tag":93,"props":94,"children":95},"code",{"__ignoreMap":7},[96],{"type":15,"tag":97,"props":98,"children":101},"span",{"class":99,"line":100},"line",1,[102],{"type":15,"tag":97,"props":103,"children":104},{},[105],{"type":21,"value":89},{"type":15,"tag":23,"props":107,"children":108},{},[109],{"type":15,"tag":80,"props":110,"children":111},{},[112],{"type":21,"value":113},"For Maven users (pom.xml):",{"type":15,"tag":86,"props":115,"children":119},{"className":116,"code":117,"language":118,"meta":7,"style":7},"language-xml shiki shiki-themes github-dark","\u003Cdependency>\n    \u003CgroupId>com.credvault\u003C/groupId>\n    \u003CartifactId>credvault-edge\u003C/artifactId>\n    \u003Cversion>1.0.0\u003C/version>\n\u003C/dependency>\n","xml",[120],{"type":15,"tag":93,"props":121,"children":122},{"__ignoreMap":7},[123,131,140,148,157],{"type":15,"tag":97,"props":124,"children":125},{"class":99,"line":100},[126],{"type":15,"tag":97,"props":127,"children":128},{},[129],{"type":21,"value":130},"\u003Cdependency>\n",{"type":15,"tag":97,"props":132,"children":134},{"class":99,"line":133},2,[135],{"type":15,"tag":97,"props":136,"children":137},{},[138],{"type":21,"value":139},"    \u003CgroupId>com.credvault\u003C/groupId>\n",{"type":15,"tag":97,"props":141,"children":142},{"class":99,"line":10},[143],{"type":15,"tag":97,"props":144,"children":145},{},[146],{"type":21,"value":147},"    \u003CartifactId>credvault-edge\u003C/artifactId>\n",{"type":15,"tag":97,"props":149,"children":151},{"class":99,"line":150},4,[152],{"type":15,"tag":97,"props":153,"children":154},{},[155],{"type":21,"value":156},"    \u003Cversion>1.0.0\u003C/version>\n",{"type":15,"tag":97,"props":158,"children":160},{"class":99,"line":159},5,[161],{"type":15,"tag":97,"props":162,"children":163},{},[164],{"type":21,"value":165},"\u003C/dependency>\n",{"type":15,"tag":23,"props":167,"children":168},{},[169],{"type":21,"value":170},"You'll also need the OkHttp and Gson libraries, which the SDK uses internally.",{"type":15,"tag":28,"props":172,"children":174},{"id":173},"connecting-to-credvault",[175],{"type":21,"value":176},"Connecting to CredVault",{"type":15,"tag":23,"props":178,"children":179},{},[180],{"type":21,"value":181},"Begin by creating a client instance with your API key. The client is thread-safe and should be reused for multiple requests.",{"type":15,"tag":86,"props":183,"children":187},{"className":184,"code":185,"language":186,"meta":7,"style":7},"language-java shiki shiki-themes github-dark","import com.credvault.CredVaultClient;\n\nString apiKey = System.getenv(\"CREDVAULT_API_KEY\");\nCredVaultClient client = new CredVaultClient(apiKey);\n","java",[188],{"type":15,"tag":93,"props":189,"children":190},{"__ignoreMap":7},[191,199,208,216],{"type":15,"tag":97,"props":192,"children":193},{"class":99,"line":100},[194],{"type":15,"tag":97,"props":195,"children":196},{},[197],{"type":21,"value":198},"import com.credvault.CredVaultClient;\n",{"type":15,"tag":97,"props":200,"children":201},{"class":99,"line":133},[202],{"type":15,"tag":97,"props":203,"children":205},{"emptyLinePlaceholder":204},true,[206],{"type":21,"value":207},"\n",{"type":15,"tag":97,"props":209,"children":210},{"class":99,"line":10},[211],{"type":15,"tag":97,"props":212,"children":213},{},[214],{"type":21,"value":215},"String apiKey = System.getenv(\"CREDVAULT_API_KEY\");\n",{"type":15,"tag":97,"props":217,"children":218},{"class":99,"line":150},[219],{"type":15,"tag":97,"props":220,"children":221},{},[222],{"type":21,"value":223},"CredVaultClient client = new CredVaultClient(apiKey);\n",{"type":15,"tag":23,"props":225,"children":226},{},[227],{"type":21,"value":228},"For applications with many concurrent users, create a single client instance and share it across threads. This allows efficient connection pooling.",{"type":15,"tag":23,"props":230,"children":231},{},[232],{"type":21,"value":233},"If your organization uses a custom deployment, you can specify an alternative base URL when creating the client.",{"type":15,"tag":28,"props":235,"children":237},{"id":236},"working-with-data",[238],{"type":21,"value":239},"Working with Data",{"type":15,"tag":23,"props":241,"children":242},{},[243],{"type":21,"value":244},"The SDK provides strongly-typed methods for all data operations.",{"type":15,"tag":23,"props":246,"children":247},{},[248,253],{"type":15,"tag":80,"props":249,"children":250},{},[251],{"type":21,"value":252},"Listing clusters",{"type":21,"value":254}," retrieves your database clusters. The response includes details about each cluster's configuration and status.",{"type":15,"tag":23,"props":256,"children":257},{},[258,263],{"type":15,"tag":80,"props":259,"children":260},{},[261],{"type":21,"value":262},"Querying data",{"type":21,"value":264}," fetches documents from collections. Pass your query parameters as a JSON string, and the SDK returns the matching documents.",{"type":15,"tag":23,"props":266,"children":267},{},[268,273],{"type":15,"tag":80,"props":269,"children":270},{},[271],{"type":21,"value":272},"Inserting data",{"type":21,"value":274}," adds new documents. Provide documents as a JSON array, and the method returns information about the inserted records.",{"type":15,"tag":23,"props":276,"children":277},{},[278,283],{"type":15,"tag":80,"props":279,"children":280},{},[281],{"type":21,"value":282},"Updating data",{"type":21,"value":284}," modifies existing documents. Specify a filter to match documents and provide the update operations to apply.",{"type":15,"tag":23,"props":286,"children":287},{},[288,293],{"type":15,"tag":80,"props":289,"children":290},{},[291],{"type":21,"value":292},"Deleting data",{"type":21,"value":294}," removes documents. Like other operations, use a filter to select which documents to delete.",{"type":15,"tag":28,"props":296,"children":298},{"id":297},"error-handling",[299],{"type":21,"value":300},"Error Handling",{"type":15,"tag":23,"props":302,"children":303},{},[304],{"type":21,"value":305},"Java applications should handle IOException for all SDK operations. The SDK wraps API errors in descriptive exceptions with status codes and error messages.",{"type":15,"tag":23,"props":307,"children":308},{},[309],{"type":21,"value":310},"Use try-catch blocks around API calls and handle errors appropriately for your application's needs. Consider retry logic for transient network errors.",{"type":15,"tag":28,"props":312,"children":314},{"id":313},"resources-available",[315],{"type":21,"value":316},"Resources Available",{"type":15,"tag":23,"props":318,"children":319},{},[320],{"type":21,"value":321},"The SDK organizes functionality into resource classes:",{"type":15,"tag":323,"props":324,"children":325},"ul",{},[326,337,347,357,367,377,387,397,407,417,427,437,447],{"type":15,"tag":327,"props":328,"children":329},"li",{},[330,335],{"type":15,"tag":80,"props":331,"children":332},{},[333],{"type":21,"value":334},"auth",{"type":21,"value":336}," — User authentication",{"type":15,"tag":327,"props":338,"children":339},{},[340,345],{"type":15,"tag":80,"props":341,"children":342},{},[343],{"type":21,"value":344},"data",{"type":21,"value":346}," — Database operations",{"type":15,"tag":327,"props":348,"children":349},{},[350,355],{"type":15,"tag":80,"props":351,"children":352},{},[353],{"type":21,"value":354},"cie",{"type":21,"value":356}," — Machine learning",{"type":15,"tag":327,"props":358,"children":359},{},[360,365],{"type":15,"tag":80,"props":361,"children":362},{},[363],{"type":21,"value":364},"webhooks",{"type":21,"value":366}," — Event notifications",{"type":15,"tag":327,"props":368,"children":369},{},[370,375],{"type":15,"tag":80,"props":371,"children":372},{},[373],{"type":21,"value":374},"functions",{"type":21,"value":376}," — Serverless execution",{"type":15,"tag":327,"props":378,"children":379},{},[380,385],{"type":15,"tag":80,"props":381,"children":382},{},[383],{"type":21,"value":384},"triggers",{"type":21,"value":386}," — Event automation",{"type":15,"tag":327,"props":388,"children":389},{},[390,395],{"type":15,"tag":80,"props":391,"children":392},{},[393],{"type":21,"value":394},"backups",{"type":21,"value":396}," — Data protection",{"type":15,"tag":327,"props":398,"children":399},{},[400,405],{"type":15,"tag":80,"props":401,"children":402},{},[403],{"type":21,"value":404},"schema",{"type":21,"value":406}," — Schema management",{"type":15,"tag":327,"props":408,"children":409},{},[410,415],{"type":15,"tag":80,"props":411,"children":412},{},[413],{"type":21,"value":414},"apiKeys",{"type":21,"value":416}," — Key management",{"type":15,"tag":327,"props":418,"children":419},{},[420,425],{"type":15,"tag":80,"props":421,"children":422},{},[423],{"type":21,"value":424},"metrics",{"type":21,"value":426}," — Monitoring",{"type":15,"tag":327,"props":428,"children":429},{},[430,435],{"type":15,"tag":80,"props":431,"children":432},{},[433],{"type":21,"value":434},"logs",{"type":21,"value":436}," — Activity tracking",{"type":15,"tag":327,"props":438,"children":439},{},[440,445],{"type":15,"tag":80,"props":441,"children":442},{},[443],{"type":21,"value":444},"notifications",{"type":21,"value":446}," — User notifications",{"type":15,"tag":327,"props":448,"children":449},{},[450,455],{"type":15,"tag":80,"props":451,"children":452},{},[453],{"type":21,"value":454},"settings",{"type":21,"value":456}," — Configuration",{"type":15,"tag":28,"props":458,"children":460},{"id":459},"spring-boot-integration",[461],{"type":21,"value":462},"Spring Boot Integration",{"type":15,"tag":23,"props":464,"children":465},{},[466],{"type":21,"value":467},"The SDK integrates naturally with Spring Boot applications. Create a configuration class that provides the CredVault client as a bean. Spring's dependency injection will make the client available throughout your application.",{"type":15,"tag":23,"props":469,"children":470},{},[471],{"type":21,"value":472},"Consider using Spring's @Value annotation to inject the API key from configuration properties, keeping credentials separate from code.",{"type":15,"tag":28,"props":474,"children":476},{"id":475},"best-practices",[477],{"type":21,"value":478},"Best Practices",{"type":15,"tag":23,"props":480,"children":481},{},[482,487],{"type":15,"tag":80,"props":483,"children":484},{},[485],{"type":21,"value":486},"Reuse the client instance.",{"type":21,"value":488}," Creating a new client for every request wastes resources. Create one instance and share it across your application.",{"type":15,"tag":23,"props":490,"children":491},{},[492,497],{"type":15,"tag":80,"props":493,"children":494},{},[495],{"type":21,"value":496},"Handle exceptions properly.",{"type":21,"value":498}," Don't ignore exceptions. Log them, report them to monitoring systems, and provide appropriate feedback to users.",{"type":15,"tag":23,"props":500,"children":501},{},[502,507],{"type":15,"tag":80,"props":503,"children":504},{},[505],{"type":21,"value":506},"Use environment-specific configuration.",{"type":21,"value":508}," Keep API keys and base URLs in configuration files or environment variables, not in source code.",{"type":15,"tag":23,"props":510,"children":511},{},[512,517],{"type":15,"tag":80,"props":513,"children":514},{},[515],{"type":21,"value":516},"Close resources properly.",{"type":21,"value":518}," While the SDK manages connections automatically, ensure your application shuts down cleanly.",{"type":15,"tag":23,"props":520,"children":521},{},[522],{"type":21,"value":523},"For detailed API documentation, refer to the JavaDoc included with the SDK or explore the source code on GitHub.",{"type":15,"tag":525,"props":526,"children":527},"style",{},[528],{"type":21,"value":529},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":7,"searchDepth":133,"depth":133,"links":531},[532,533,534,535,536,537,538,539,540],{"id":30,"depth":133,"text":33},{"id":51,"depth":133,"text":54},{"id":67,"depth":133,"text":70},{"id":173,"depth":133,"text":176},{"id":236,"depth":133,"text":239},{"id":297,"depth":133,"text":300},{"id":313,"depth":133,"text":316},{"id":459,"depth":133,"text":462},{"id":475,"depth":133,"text":478},"markdown","content:docs:sdks:java.md","content","docs/sdks/java.md","docs/sdks/java","md",1777847380919]