Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/beyondfengyu/seacos
a easy ioc frame
https://github.com/beyondfengyu/seacos
filter ioc spring
Last synced: about 1 month ago
JSON representation
a easy ioc frame
- Host: GitHub
- URL: https://github.com/beyondfengyu/seacos
- Owner: beyondfengyu
- Created: 2017-05-12T15:01:13.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-05-23T03:45:17.000Z (over 7 years ago)
- Last Synced: 2023-10-20T18:13:08.967Z (about 1 year ago)
- Topics: filter, ioc, spring
- Language: Java
- Homepage: http://www.wolfbe.com
- Size: 25.4 KB
- Stars: 8
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Seacos
仿Spring实现的轻量级IOC框架,线上大型网站验证:
* 支持注解和配置两种注入方式;
* 支持拦截监听;
* 稳定可靠,简单易用;
## 使用
可以参照exmple包下例子,源码如下:
```
URL resource = Thread.currentThread().getContextClassLoader().getResource("sea_example.xml");
Sea sea = null;
if (resource != null) {
URI uri = resource.toURI();
File file = new File(uri);String path = file.getPath();
sea = new Sea(path);
}else{
sea = new Sea("E:\\WebCode\\Sea\\src\\main\\resources\\sea_example.xml");
}logger.info("sea is: {}",sea.toString());
// 增加监听器
sea.addFinishListener(new FinishListener());
sea.addBeforeListener(new BeforeListener());
// 容器初始化
sea.init();System.out.println("---"+ BeanFactory.getBeanKey("testService1", "TestService"));
//获取容器的Bean实例
TestService testService1 = (TestService) BeanFactory.getClassBean(BeanFactory.getBeanKey("testService1", "TestService"));
TestService testService2 = (TestService) BeanFactory.getClassBean(BeanFactory.getBeanKey("testService2", "TestService"));
TestService testService3 = (TestService) BeanFactory.getClassBean(TestService.class);
```
1 首先,获取Seacos的配置文件所在的类路径;
2 然后,添加自定义的监听器,继承框架的监听器接口来实现自定义监听器;
3 最后,调用BeanFactory获取指定名称的Bean;
## 交流
如果有兴趣交流Netty相关知识,可以加入**Netty联盟:379119816** **Java联盟:399643539**