{"id":27598354,"url":"https://github.com/devxb/jvault","last_synced_at":"2025-04-22T14:13:49.782Z","repository":{"id":63281900,"uuid":"559206790","full_name":"devxb/Jvault","owner":"devxb","description":"💙 Java DI library for package encapsulation","archived":false,"fork":false,"pushed_at":"2023-03-10T04:19:06.000Z","size":4747,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-22T14:13:45.555Z","etag":null,"topics":["dependency-injection","encapsulation","java","package"],"latest_commit_sha":null,"homepage":"https://docs.jvault.org","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devxb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-10-29T11:51:44.000Z","updated_at":"2023-05-21T08:22:05.000Z","dependencies_parsed_at":"2023-01-23T20:47:00.576Z","dependency_job_id":null,"html_url":"https://github.com/devxb/Jvault","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devxb%2FJvault","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devxb%2FJvault/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devxb%2FJvault/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devxb%2FJvault/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devxb","download_url":"https://codeload.github.com/devxb/Jvault/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250255776,"owners_count":21400410,"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","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":["dependency-injection","encapsulation","java","package"],"created_at":"2025-04-22T14:13:49.199Z","updated_at":"2025-04-22T14:13:49.771Z","avatar_url":"https://github.com/devxb.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src = \"https://user-images.githubusercontent.com/62425964/201680890-2072d240-c91d-4b69-94c3-f60c30520e79.svg\" width=\"625\" height=\"auto\"/\u003e\n\n# Jvault - Java encapsulation library using DI\n   \n[한국어로 번역](/KOREAN.md)    \n[Learn Jvault](#Learn-Jvault)    \n[Java doc](https://docs.jvault.org/)    \n[License](/LICENSE)    \n   \n![current jvault version](https://img.shields.io/badge/Jvault-0.1.1-orange) ![test method coverage](https://img.shields.io/badge/Method%20coverage-100%25-brightgreen) ![test line coverage](https://img.shields.io/badge/Line%20coverage-92%25-brightgreen) ![test class coverage](https://img.shields.io/badge/Class%20coverage-90%25-brightgreen) ![needed jdk version](https://img.shields.io/badge/JDK-8-blue) ![libarry status](https://img.shields.io/badge/library%20status-activity-green)    \n![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fdevxb%2FJvault\u0026count_bg=%23C8C13D\u0026title_bg=%23555555\u0026icon=\u0026icon_color=%23FFFFFF\u0026title=HIT+COUNT\u0026edge_flat=false) ![made with love](https://img.shields.io/badge/Made%20with-Love--❤-red)    \n   \nJvault is a library that restricts a class to be accessible only to the class permitted by it and links the dependencies between the restricted classes.   \nWith Jvaut, you can effectively encapsulate your internal APIs from external users and making it easier to improve the evolveability of your APIs.   \n   \nSo, why Jvault?   \n   \n1, __Jvault is a DI library__, it's means Jvault allows you to write code against interfaces, not implementations.   \n   \n2, __Since Jvault does not depend on any library or framework__, it can be used in various development environments (ex. Spring).   \n   \n3, __Jvault helps you choose which classes can use you__, so you can design an architecture like this:     \nIf you are a library developer or developer creating an API that works on other code, you can completely hide your internal implementations from users and force to use only the APIs you intended.   \nLike this,   \n![Group 31-2](https://user-images.githubusercontent.com/62425964/202200662-8ef29169-8d15-4f48-a5e5-7eec98b410a1.svg)    \nNow, client does not access your internal implements and only accessible the API defined you. (Even if the client doesn't know about Jvault)   \n   \nAnd, Jvault may helpful, If your application is being developed based on a monolithic architecture and you want to gradually decouple services.   \n![Group 30](https://user-images.githubusercontent.com/62425964/202200768-50049555-73b6-415f-aca3-a1daa36d56e1.svg)    \nAbove, you can see that the internal implementations are hidden, and applications communicate through each other's APIs. \n   \n\n\n\u003cbr\u003e\n\n## Getting Start\n\nThis document introduces how to use Jvault and how to download the Jvault library to the project.   \nMore library details can be found at [Javadoc](https://docs.jvault.org/).\n\n\u003cbr\u003e\n   \n## Download Jvault in project\n\nJvault can be downloaded to the project using Gradle and Maven build tools.\n\n``` gradle\nimplementation 'org.jvault:jvault-core:0.1.1'\n```\n   \n``` maven\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.jvault\u003c/groupId\u003e\n  \u003cartifactId\u003ejvault-core\u003c/artifactId\u003e\n  \u003cversion\u003e0.1.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n   \nIf the project does not use a build tool, you can download __Jvault-x.x.jar__ (x.x is the version) and set the classpath to use Jvault in the project. Also, if you want to apply the Jvault javadoc index to your IDE, download __Jvault-x.x-sources.jar__ and configure it according to the IDE you are using.   \n\n\u003cbr\u003e\n\n## Learn Jvault\n\nLearn Jvault introduces the use of Jvault with examples of encapsulating vehicle programs using Jvault.   \n   \n-_A brief introduction to the example code_   \nThe Wheel class used in the example is an internal API. If the Wheel class is used outside, it is judged that it will adversely affect the evolution of the API, _(The more people use an API, the harder it is to evolve.)_ so it should not be used outside the project.   \nOn the other hand, the Car class used in the example is an API. The Car class is intended to be used as an API for users, and all users should use the Car class to communicate with our project.   \n   \nAlso, you can find the complete car example code [here](https://github.com/devxb/Jvault/tree/main/Jvault/src/test/java/usecase/car).\n   \n\u003cbr\u003e\n\n### Register InternalBean \n\nJvault provides @InternalBean annotation to control access of class and mark class as bean registration target.   \nClasses marked with @InternalBean annotation are subject to bean scan, and an exception is thrown if a class not permitted by @InternalBean tries to be injected during the DI process.   \n   \nLet's see how to use it through an example of registering SquareWheel.class, as an InternalBean, which is one of the implementations of the Wheel interface.    \n   \n``` Java\npackage usecase.car.wheel;\n\nimport org.jvault.annotation.InternalBean;  \nimport org.jvault.bean.Type;\n\n@InternalBean(\n\tname = \"squareWheel\",\n\ttype = Type.SINGLETON,\n\taccessClasses = {\"usecase.car.Car\"},\n\taccessPackages = {\"usecase.car.factory.*\", \"usecase.car.wheel\"}\n)\npublic final class SquareWheel implements Wheel{\n\n\tSquareWheel(){}\n\t\n\t@Override\n\tpublic int accel(){\n\t\treturn 1;\n\t}\n\t\n}\n```\n   \nThe information that can be parametered in @InternalBean is as follows.   \n\n| parameter | value |\n|-----------|---|\n| name | Specifies the name of the bean to be registered. If omitted, the value obtained by changing the first letter of the class name to lowercase is registered as the name of the bean.   |\n| type | Specifies how the bean behaves. If omitted, it is registered as SINGLETON. The scope of type is the same as that of Vault. For example, in the case of a singleton type bean, it is guaranteed that the same instance is always injected within the vault with the same name. However, it has a different address than a bean injected by a different named vault. |\n| accessClasses | Specifies the classes that this bean can be injected into. The package path and class name must be specified. If both accessClasses and accessPackages are omitted, all classes can receive this bean. (I chose the designation method of the String type rather than the Class type, because the injected class may not be a public class due to the characteristics of the Internal API.) |\n| accessPackages | Specifies the package paths into which this bean can be injected. All classes in the package specified in this parameter can receive this bean injection. The package path must be specified, and if .* expression is used at the end, this bean can be injected up to all subpackages including this package. If the .* expression does not exist, only the corresponding package can receive bean injection. If both accessClasses and accessPackages are omitted, all classes can receive this bean. |\n   \nLooking at the code block above, the SquareWheel class is a public class that everyone can access, but since the constructor is package-private, no one in another package can instantiate it.    \nIn other words, the SquareWheel class is encapsulated by the user, but the problem is that it is hidden from code that exists in other packages in the same project that need to use the SquareWheel.   \n   \n\u003e __WARNING__ : Jvault is not a library that encapsulates classes, but a library that links dependencies of encapsulated classes.    \n\u003e Even if it is marked with @InternalBean, the non-encapsulated class can be accessed by everyone.\n   \nJvault solves this problem using DI, which reads the information of @InternalBean and throws an exception if the bean is not a class that allows injection.   \n   \n\u003cbr\u003e\n   \n### Inject InternalBean\n\nJvault provides @Inject annotation to injected InternalBean.    \nThere are two methods of injection, constructor injection and field injection, and if both methods coexist in one class, constructor injection is selected.   \n   \nLet's see how to use it through an example of injecting a wheel into Car, which is one of the implementations of Vehicle, an API that the client will use.   \n   \n``` Java\npackage usecase.car;\n\n// Field Inject\npublic final class Car implements Vehicle{\n\t\n\t@Inject(\"squareWheel\")\n\tprivate Wheel wheel;\n\t\n\tprivate Car(){}\n\t\n\t@Override  \n\tpublic String meter() {  \n\t    return \"current meter : \" + wheel.accel();  \n\t}\n\t\n}\n```\n   \nThe information that can be parametered in the @Inject annotation is as follows.   \n   \n| parameter | value |\n|-----------|---|\n| value | Specifies the name of the bean to inject. |\n   \nField injection finds and registers a bean based on the field's name if the value is omitted.   \n   \nFor constructor injection, @Inject annotation must be marked on the constructor method to be used for injection, and the parameter of the constructor must be marked with @Inject annotation.   \n   \n``` Java\npackage usecase.car;\n\n// Constructor Inject\npublic final class Car implements Vehicle{\n\t\n\tprivate final Wheel WHEEL;\n\t\n\t@Inject\n\tprivate Car(@Inject(\"squareWheel\") Wheel wheel){\n\t\tWHEEL = wheel;\n\t}\n\t\n\t@Override  \n\tpublic String meter() {  \n\t    return \"current meter : \" + WHEEL.accel();  \n\t}\n\t\n}\n```\n   \n\u003e __WARNING__ : In case of constructor injection, @Inject annotation must be marked on the constructor to be used for injection, and @Inject annotation must be marked on the parameters of the constructor. At this time, the name of the bean to be injected must be specified in the @Inject annotation marked on the parameter of the constructor, otherwise an exception is thrown.   \n   \n\u003e __WARNING__ : Be careful not to cycle between InternalBeans. An exception is thrown when a cycle occurs.   \n   \n\u003e __TIP__ : The Car class in the example receives bean injection but is not marked with @InternalBean. If the Car class does not need to be injected into other classes, it does not need to be marked with @InternalBean.    \n   \n\u003cbr\u003e\n   \n### Create Vault, Scan Bean\n\nVault is a variant of BeanFactory, and plays a role for injecting InternalBeans (registered in Vault) into the passed parameters. Therefore, the parameter passed to the Vault does not need to be an InternalBean, which is why the Car class was not marked as @InternalBean earlier.   \n   \n\u003e __TIP__ : If the parameter passed to Vault is marked with @InternalBean(type = Type.SINGLETON) and is included in the scope of Vault's bean scan, the same instance is returned for every request. Otherwise, a new object is returned for every request. - This behavior is for ClassVault, and for the behavior of other Vault implementations, refer to [Javadoc](https://docs.jvault.org/org/jvault/vault/package-summary.html).   \n   \nSince the word Vault is a bit abstract and the role of Vault may not be well understood, let's take a look at the code that uses Vault in advance.   \n   \n``` Java\n// The created Car instance is the state in which the \"sqaureWheel\" bean is injected.\nClassVault classVault = TypeVaultFactory.get(buildInfo, VaultType.CLASS);\nCar car = classVault.inject(Car.class); \n```\n   \nThe above code receives Car.class as a parameter and returns an instance of Car.class into which the bean is injected. In the code above, a Car instance in which \"squareWheel\" is injected is returned. This is because the InternalBean named \"squareWheel\" was injected by the @Inject(\"squareWheel\") annotation marked in the constructor of Car.class earlier.   \n   \nIn this tutorial, we will learn how to create a vault like the one above.\n   \nFirst of all, to create a vault, you need to set the location to scan the bean and the information of the vault.   \nBean scan information and vault creation information setting are actually in charge of different objects, but Jvault provides setting using properties file and setting using class which is a way to set the above two information at once for client convenience.   \n   \nFirst of all, the settings using the properties file are as follows.   \n   \n``` properties\norg.jvault.vault.name = CAR_VAULT\norg.jvault.vault.access.packages = usecase.car, usecase.car.wheel.*\norg.jvault.vault.access.classes = usecase.car.Car\n\norg.jvault.reader.packages = usecase.car.*, usecase.wheel\norg.jvault.reader.classes = usecase.wheel.SquareWheel, usecase.wheel.RoundWheel\norg.jvault.reader.exclude.packages = usecase.car\n```\n   \n| key | value |\n| --- | ----- |\n| org.jvault.vault.name | Specifies the name of the vault to be created. |\n| org.jvault.vault.access.packages | Specifies the package that can receive bean injection through Vault. All classes in the specified package can receive bean injection through the vault, and if the .* expression is used at the end, classes in all sub-packages including the specified package can receive bean injection through the vault. If both org.jvault.vault.access.packages and org.jvault.vault.access.classes are omitted, all classes can receive bean injection through the vault. |\n| org.jvault.vault.access.classes | Specifies the class that can receive bean injection through Vault. Only the specified class can receive beans through the vault, and if both org.jvault.vault.access.packages and org.jvault.vault.access.classes are omitted, all classes can receive beans through the vault. |\n| org.jvault.reader.packages | Specifies the package in which classes marked with @InternalBean to be registered in the vault exist. When the .* expression is used at the end, the class marked with @InternalBean in all subpackages including the package is registered as a bean in the vault. If there is no expression, all classes marked with @InternalBean in the package are registered as beans in the vault. |\n| org.jvault.reader.classes | Specifies the package and class-name of the class marked with @InternalBean to be registered in the vault. |\n| org.jvault.reader.exclude.packages | Specifies the path of the package not to be registered as a bean. The registered package is excluded from the bean search, and when the .* expression is used at the end, all subpackages including the package are excluded from the search. However, classes that are directly registered using org.jvault.reader.classes rather than package search are not excluded. |\n   \nNow you can create a vault using this properties file.     \nThe following is an example of creating and using ClassVault that takes the Class type as a parameter, injects a dependency into the instance of the parameter, and returns it.\n\n``` Java\n// 1. Create instance containing the information of the .properties file.\nVaultFactoryBuildInfo buildInfo = new PropertiesVaultFactoryBuildInfo(\"path of properties file\");\n\n// 2. Get an instance of VaultFactory.\nTypeVaultFactory vaultFactory = TypeVaultFactory.getInstance();\n\n// 3. Acquire a Vault using the Vault Factory.\nClassVault vault = vaultFactory.get(buildInfo, VaultType.CLASS);\n\n// 4. Acquire a Car instance using the created vault.\n// The created Car instance is the state in which the \"sqaureWheel\" bean is injected.\nCar car = vault.inject(Car.class);\n```\n   \nIf you want to create a different type of vault, you can change the value of VaultType passed as an argument of vaultFactory. For the types of VaultTypes that can be selected, refer to [Java doc](https://docs.jvault.org/org/jvault/vault/VaultType.html).   \n   \nIn the code above, a vault with SquareWheel and RoundWheel registered as beans is created, and the vault can receive Car.class and all classes in the car and wheel package as parameters. Also, since the Car class is specified to be injected with a bean named \"squareWheel\", a Car instance injected with a bean named \"squareWheel\" is created by __vault.inject(Car.class);__.   \n   \nIf it is a Vault created by VaultFactory at least once, you can search by name as follows. The vault in the code above and the vault in the code below are different vaults, but the information of the beans stored inside the vault is the same.  \n   \n``` Java\nTypeVaultFactory vaultFactory = TypeVaultFactory.getInstance();\n\nClassVault vault = vaultFactory.get(\"CAR_VAULT\", VaultType.CLASS);\n\nCar car = vault.inject(Car.class);\n```\n   \n\u003e __TIP__ : Earlier, consider registering SquareWheel Bean as a SINGLETON. The car created in the above example and the car created in the previous example are different objects, but the SquareWheel injected inside the Car is the same object.   \n  \nThe following is an example of creating a vault using the Class setting.   \nA VaultConfiguration class can be defined by marking @VaultConfiguration above the class name.   \n   \n``` Java\n@VaultConfiguration(\n\tname = \"CAR_VAULT\",\n\tvaultAccessPackages = {\"usecase.car\", \"usecase.car.*\"},\n\tvaultAccessClasses = {\"usecase.car.Car\"}\n)\npublic class CarVaultConfig{\n\t\n\t@BeanWire\n\tprivate SquareWheel squareWheel;\n\t\n}\n```\n   \ninformation that can be parametered in @VaultConfiguration.   \n   \n| parameter | value |\n| ---------- | ----- | \n| name | Same as org.jvault.vault.name in the properties setting example. If omitted, the value of changing the first letter of the class name to lowercase is registered as the vault name. |\n| vaultAccessPackages | Same as org.jvault.vault.access.packages in the properties setting example. If both vaultAccessPackages and vaultAccessClasses are omitted, all classes can be passed as parameters of the vault. |\n| vaultAccessClasses | Same as org.jvault.vault.access.classes in the properties setting example. If both vaultAccessPackages and vaultAccessClasses are omitted, all classes can be passed as parameters of the vault. |\n   \nAlso, by marking @BeanWire annotation on member variable inside class, bean to be registered in vault can be defined. At this time, the type of the marked field must be a concrete type, not an interface, and the corresponding class must be marked with @InternalBean. Bean is created according to @InternalBean information of variable class marked with @BeanWire.   \n   \n_*(I adopted the mapping of BeanWire to field variables. Due to the nature of the internal API, the class constructor may not be public, so it was necessary to register the bean without the constructor.)*_     \n   \nNow, we can use this class to create a Vault.   \n   \n``` Java\n// 1. Create instance containing the information of the CarVaultConfig.class\nVaultFactoryBuildInfo buildInfo = new AnnotationVaultFactoryBuildInfo(CarVaultConfig.class);\n\n// 2. Get an instance of VaultFactory.\nClassVaultFactory vaultFactory = ClassVaultFactory.getInstance();\n\n// 3. Acquire a Vault using the Vault Factory.\nClassVault vault = vaultFactory.get(buildInfo, VaultType.CLASS);\n\n// 4. Acquire a Car instance using the created vault.\n// The created Car instance is in the state in which the \"sqaureWheel\" bean is injected.\nCar car = vault.inject(Car.class);\n```\n   \nFor more types of vaults that can be created, refer to [Java doc](https://docs.jvault.org/org/jvault/vault/VaultType.html).\n   \n\u003cbr\u003e\n   \n### Use Vault\n\nThis tutorials introduce different ways to use Vault.   \nVaults are managed globally by the application, and once a vault is created, the same vault is returned every time from the next request. This means that Vault is globally reusable across applications.   \n   \n``` Java\npublic class Main {  \n  \n    public static void main(String[] args){  \n        AnnotationVaultFactoryBuildInfo buildInfo = new AnnotationVaultFactoryBuildInfo(AnnotationConfig.class);  \n        TypeVaultFactory typeVaultFactory = TypeVaultFactory.getInstance();  \n        typeVaultFactory.get(buildInfo, VaultType.CLASS);  \n    }  \n  \n    @VaultConfiguration(name = \"CAR_VAULT\", vaultAccessPackages = \"usecase.car.*\")  \n    private static class AnnotationConfig{  \n  \n        @BeanWire  \n        private RoundWheel roundWheel;  \n  \n        @BeanWire  \n        private SquareWheel squareWheel;  \n  \n    }  \n  \n}\n\n```\n   \nFor example, as in the code above, if you have created a vault with the name \"CAR_VAULT\", you can get a vault anywhere in the application as in the code below.   \n   \n``` Java\nTypeVaultFactory vaultFactory = TypeVaultFactory.getInstance();\n\nClassVault classVault = vaultFactory.get(\"CAR_VAULT\", VaultType.CLASS);\n\nInstanceVault instanceVault = vaultFactory.get(\"CAR_VAULT\", VaultType.INSTANCE);\n```\n   \n_(If the name is the same, you can create various types vault with the same bean.)_   \n   \nDevelopers who use Jvault to build APIs may not like the fact that users who use their APIs have to learn Jvault, but Jvault provides the perfect way to solve this \"unwelcome third-party code exposure\" problem.   \n   \nFor example, if the Car class, which is an API, must be created through a constructor, you can use InstanceVault as follows   \n_(When the roundWheel and squareWheel classes are allowed to inject themselves from the InstancedCar,)_   \n   \n``` Java\npackage usecase.car;  \n\npublic final class InstancedCar implements Vehicle{  \n  \n    private String carName;  \n    @Inject  \n    private Wheel roundWheel;  \n    @Inject  \n    private Wheel squareWheel;  \n\t\n\tprivate InstancedCar(){}\n\t\n    public InstancedCar(String carName){  \n        this.carName = carName;  \n        TypeVaultFactory vaultFactory = TypeVaultFactory.getInstance();  \n        InstanceVault instanceVault = vaultFactory.get(\"CAR_VAULT\", VaultType.INSTANCE);  \n        instanceVault.inject(this);  \n    }  \n\t  \n    @Override  \n    public String meter() {  \n        return carName + roundWheel.accel() + squareWheel.accel();  \n    }  \n}\n```\n   \nNow, InstancedCar users can use InstancedCar injected with roundWheel and squareWheel like this:   \n   \n``` Java\nInstancedCar instancedCar = new InstancedCar(\"mini-car\");\ninstancedCar.meter();\n```\n   \nIn the code above, the user actually gets and uses the InstancedCar object with no knowledge of the Jvault API.   \nFor more detailed usage of InstanceVault, see [Java doc](https://docs.jvault.org/org/jvault/vault/InstanceVault.html).   \n   \nA better way is to provide a Factory rather than a constructor, or a separate method to get an Instance.   \n   \n``` Java\npublic final class VehicleFactory {  \n  \n    private static final VehicleFactory INSTANCE = new VehicleFactory();  \n    private final ClassVault CLASS_VAULT;  \n  \n    {  \n        TypeVaultFactory vaultFactory = TypeVaultFactory.getInstance();  \n        CLASS_VAULT = vaultFactory.get(\"CAR_VAULT\", VaultType.CLASS);  \n    }  \n  \n    public static \u003cR extends Vehicle\u003e R getVehicle(Class\u003cR\u003e type){  \n        return INSTANCE.CLASS_VAULT.inject(type);  \n    }  \n  \n}\n```\n   \nNow the user gets a Car object through VehicleFactory like this:   \n   \n``` Java\nCar car = VehicleFactory.getVehicle(Car.class);  \nInstancedCar instancedCar = VehicleFactory.getVehicle(InstancedCar.class);\n```\n   \n\u003e __TIP__ : I recommend reusing ClassVault every time as in the code above, ClassVault is more efficient because it caches requests that satisfy certain conditions(The class passed as a parameter is marked with @InternalBean(type = Type.SINGLETON) and must be included in the scope of Vault's bean scan.), and uses the cache to process incoming requests after this.   \n   \nAlso, Jvault can be used with spring,   \nRegister Vault with Spring Bean and inject Vault from an object that requires Vault.   \n   \n``` Java\n@Autowire \nprivate ClassVault classVault;\n```\n   \nAlso, if you need to use Spring Bean in InternalBean, you can use _ApplicationContextAware_ provided by Spring.   \n   \n\u003cbr\u003e\n   \n### Jvault Extensions\n\nThe Jvault library provides a way to modify library behavior at runtime.   \nAll runtime extensions are performed using [JvaultRuntimeExtension.class](https://docs.jvault.org/org/jvault/extension/JvaultRuntimeExtension.html). For example, if you want to register your own BeanReader instead of the AnnotatedBeanReader provided by Jvault at default, you can inject the implementation of the BeanReader interface into JvaultRuntimeExtension.   \n   \n``` Java\nBeanReader nullBeanReader = param -\u003e null;  \nJvaultRuntimeExtension.extend(nullBeanReader, BeanReader.class);\n```\n   \nAs shown in the code above, if you register _nullBeanReader_ that returns null when requested, all Jvault internal implementations that use BeanReader including PropertiesVaultFactoryBuildInfo and AnnotationVaultFactoryBuildInfo will use nullBeanReader.   \nIf you want to initialize to default, you can write the following code.   \n   \n``` Java\nJvaultRuntimeExtension.reset(BeanReader.class);\n// or\nJvaultRuntimeExtension.resetAll();\n```\n   \nSee [Java doc](https://docs.jvault.org/org/jvault/extension/JvaultRuntimeExtension.html) for more detailed Jvault extensions.\n   \n\u003ch2\u003e\u003c/h2\u003e\n\n\u003cdiv align=\"center\"\u003e\n        \u003ca href=\"/LICENSE\"\u003eLICENSE\u003c/a\u003e / inquiry : \u003ci\u003edevelxb@gmail.com\u003c/i\u003e / \u003ca href=\"https://docs.jvault.org\"\u003e\u003ci\u003eJava doc\u003c/i\u003e\u003c/a\u003e\n        \u003cbr/\u003e\u003cdiv align=\"right\"\u003e @author : \u003ca href=\"https://github.com/devxb\"\u003e\u003ci\u003edevxb\u003c/i\u003e\u003c/a\u003e\u003c/div\u003e\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevxb%2Fjvault","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevxb%2Fjvault","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevxb%2Fjvault/lists"}