> For the complete documentation index, see [llms.txt](https://failutee.gitbook.io/mineject/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://failutee.gitbook.io/mineject/before-you-start.md).

# Before you start

### Annotations

You need to know what [@Component](/mineject/core-features/component-and-injectable.md), [@Injectable](/mineject/core-features/component-and-injectable.md), [@BeanSetu](/mineject/core-features/beansetup-and-bean.md)p and [@Bean](/mineject/core-features/beansetup-and-bean.md) annotations are.

* <mark style="color:yellow;">Component</mark> - This is an annotation that means that a given class is a component. Components are automatically discovered and registered with Mineject dependencies during class scanning.
* <mark style="color:yellow;">Injectable</mark> - This annotation is used in constructors. It is used when you want to inject some dependencies into the constructor when instantiating an object.
* <mark style="color:yellow;">BeanSetup</mark> - It means a class that will provide beans, or in simple terms, dependencies that you will later be able to inject into your constructor.
* <mark style="color:yellow;">Bean</mark> - In comparison to other annotations, this annotation is used in methods (functions) that return a type which is later passed into Mineject dependencies. This annotation is used when you want to manually provide a dependency.

### Incomplete documentation

Since the documentation does not contain all the features of this project, please take a look at the sample code on GitHub. [Click here to view examples](https://github.com/failutee/Mineject/tree/master/mineject-examples/spigot-platform).

### API Usage

<pre class="language-java" data-full-width="false"><code class="lang-java">Mineject mineject = MinejectFactory.create()
  .dependencySettings((settings, context) -> settings.packageName("your.package"))
  .withBean(TestManager.class, new TestManagerImpl())
  .build(false); // Set to false if you prefer to manually initialize the dependency injector (optional)

/*
<strong> * Must be called if 'false' was passed to the #build method
</strong> * to manually start the dependency injector
*/
mineject.runDependencyInjector();
</code></pre>

This function is used to set the package that will be used when scanning classes.

```java
MinejectFactory.create()
  .dependencySettings((settings, context) -> settings.packageName("your.package"))
  ...
```

If you want to specify beans manually when creating an instance of the Mineject object, you can do it this way.

```java
MinejectFactory.create()
  .withBean(TestManager.class, new TestManagerImpl())
  ...
```

Getting dependencies using Dependency Provider.

```java
DependencyProvider dependencyProvider = mineject.getDependencyProvider();

// Retrieve a single instance of the specified dependency type
TestManager testManager = dependencyProvider.getDependency(TestManager.class);

/*
 * Retrieve multiple instances of the specified type
 * (useful if you have more than one instance provided of the same type)
*/
Set<TestManager> testManagers = dependencyProvider.getDependencies(TestManager.class);
```
