Skip to content

Commit

Permalink
✨ Add @value annotation to inject config
Browse files Browse the repository at this point in the history
  • Loading branch information
chenchen42 committed Dec 26, 2017
1 parent ce01b1a commit e0053b2
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/test/java/com/blade/ioc/ValueDefineTest.java
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
package com.blade.ioc;

import com.blade.BaseTestCase;
import com.blade.Blade;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

/**
* @author : ccqy66
* Date: 2017/12/25
*/
public class ValueDefineTest extends BaseTestCase {
public class ValueDefineTest {
Blade app = Blade.me();
@Before
public void before() {
app.scanPackages("com.blade.model","com.blade.ioc");
app.listen(10086).start().await();
}
@Test
public void testValueFromClass() {
app.scanPackages("com.blade.model","com.blade.ioc");
start(app);
Assert.assertNotNull(app.ioc().getBean("com.blade.model.AppInfo"));
System.out.println(app.ioc().getBean("com.blade.model.AppInfo"));
//echo AppInfo{users='301', maxMoney='38.1', sex='true', hits='199283818033', startDate='2017-08-02'}
}
@Test
public void testValueFromPro() {
app.scanPackages("com.blade.model","com.blade.ioc");
start(app);
Assert.assertNotNull(app.ioc().getBean("com.blade.model.ValueBean"));
System.out.println(app.ioc().getBean("com.blade.model.ValueBean"));
//echo ValueBean{list=[hello, my, blade, word], appversion='0.0.2', map={user=blade, version=2.0.0}}
}
Expand Down

0 comments on commit e0053b2

Please sign in to comment.