Skip to content
This repository has been archived by the owner on Feb 22, 2021. It is now read-only.

1619khze/apex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Apex

Apex是一个简单的依赖注入库

Build Status Build Status Downloads

安装

通过 MavenGradle 创建一个项目,因为还未上传到Maven中心仓库,所以目前暂时通过clone代码进行安装

git clone https://github.com/AquiverV/apex.git

cd apex

mvn clean install

通过 Maven 安装:

<dependency>
    <groupId>org.apex</groupId>
    <artifactId>apex</artifactId>
    <version>1.0</version>
</dependency>

使用方式

final Apex apex = Apex.of();
final String scanPath = "org.example";
final List<Class<? extends Annotation>> typeAnnotations = new ArrayList<>();

//添加需要自动扫描的注解
typeAnnotations.add(Path.class);
typeAnnotations.add(RouteAdvice.class);
typeAnnotations.add(RestPath.class);
typeAnnotations.add(WebSocket.class);
typeAnnotations.add(Singleton.class);
typeAnnotations.add(ConfigBean.class);
typeAnnotations.add(PropertyBean.class);
typeAnnotations.add(Scheduled.class);
apex.typeAnnotation(typeAnnotations);

//添加扫描路径
apex.packages().add(scanPath);
apex.mainArgs(aquiver.mainArgs());

//通过instance方法获取ApexContext对象
ApexContext apexContext = ApexContext.instance();

//初始化
apexContext.init(apex);

License

MIT

Copyright (c) 2020-present, Yi (Ever) Wang

About

🍻 Implementation of a simple dependency injection framework and common utils

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages