diff --git a/src/test/java/cn/noexception/test/AopTest.java b/src/test/java/cn/noexception/test/AopTest.java
index e9ede2dfdc21f02b1260ad9ad644b84c017da357..69ee52f0eac87edbeaaa1cb1362a0ee712010474 100644
--- a/src/test/java/cn/noexception/test/AopTest.java
+++ b/src/test/java/cn/noexception/test/AopTest.java
@@ -9,6 +9,7 @@ import cn.noexception.container.aop.aspectj.AspectJExpressionPointcutAdvisor;
import cn.noexception.container.aop.framework.ProxyFactory;
import cn.noexception.container.aop.framework.ReflectiveMethodInvocation;
import cn.noexception.container.aop.framework.adapter.MethodBeforeAdviceInterceptor;
+import cn.noexception.container.context.support.ClassPathXmlApplicationContext;
import cn.noexception.test.bean.IUserService;
import cn.noexception.test.bean.UserServiceBeforeAdvice;
import cn.noexception.test.bean.UserServiceInterceptor;
@@ -101,4 +102,29 @@ public class AopTest {
String result = proxy.queryUserInfo();
System.out.println("测试结果:" + result);
}
+
+ @Test
+ public void test_property() {
+ ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:spring-property.xml");
+ IUserService userService = applicationContext.getBean("userService", IUserService.class);
+ System.out.println("测试结果: " + userService);
+ }
+
+ @Test
+ public void test_scan() {
+ ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:spring-scan.xml");
+ IUserService userService = applicationContext.getBean("userService", IUserService.class);
+ System.out.println("测试结果:" + userService.queryUserInfo());
+ }
+
+
}
+
+
+
+
+
+
+
+
+
diff --git a/src/test/java/cn/noexception/test/bean/impl/UserService.java b/src/test/java/cn/noexception/test/bean/impl/UserService.java
index c161043ca6a4bddb72cf2ced42e4ed657ab22f59..506edaa05e8333c24aa18aa0aea8bff2d3cf2095 100644
--- a/src/test/java/cn/noexception/test/bean/impl/UserService.java
+++ b/src/test/java/cn/noexception/test/bean/impl/UserService.java
@@ -1,5 +1,6 @@
package cn.noexception.test.bean.impl;
+import cn.noexception.container.factory.stereotype.Cube;
import cn.noexception.test.bean.IUserService;
import java.util.Random;
@@ -10,7 +11,11 @@ import java.util.Random;
* @author 吕滔
* @Date 2021/11/3 17:01
*/
+@Cube("userService")
public class UserService implements IUserService {
+
+ private String token;
+
@Override
public String queryUserInfo() {
try {
@@ -31,4 +36,17 @@ public class UserService implements IUserService {
return "注册用户:" + userName + " success! ";
}
+
+ @Override
+ public String toString() {
+ return "UserService#token = { " + token + " }";
+ }
+
+ public String getToken() {
+ return token;
+ }
+
+ public void setToken(String token) {
+ this.token = token;
+ }
}
diff --git a/src/test/resources/spring-property.xml b/src/test/resources/spring-property.xml
new file mode 100644
index 0000000000000000000000000000000000000000..2f7034788ec0ae1a638d11c354c0e62f9bd98227
--- /dev/null
+++ b/src/test/resources/spring-property.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/spring-scan.xml b/src/test/resources/spring-scan.xml
new file mode 100644
index 0000000000000000000000000000000000000000..8fa51cd02f024a6fc1c5080ad4d0b16ea3d618bb
--- /dev/null
+++ b/src/test/resources/spring-scan.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/token.properties b/src/test/resources/token.properties
new file mode 100644
index 0000000000000000000000000000000000000000..ecd5e622a8537fb6983e46ffb52921c8f31fcb38
--- /dev/null
+++ b/src/test/resources/token.properties
@@ -0,0 +1 @@
+token=RejDlI78hu223Opo983Ds