|
@@ -1,94 +0,0 @@
|
|
|
-package test;
|
|
|
-
|
|
|
-
|
|
|
-import java.lang.annotation.Annotation;
|
|
|
-import java.lang.reflect.Method;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.Map;
|
|
|
-
|
|
|
-import org.junit.Test;
|
|
|
-import org.junit.runner.RunWith;
|
|
|
-import javax.annotation.Resource;
|
|
|
-import org.springframework.boot.test.context.SpringBootTest;
|
|
|
-import org.springframework.test.context.junit4.SpringRunner;
|
|
|
-import org.thymeleaf.TemplateEngine;
|
|
|
-import org.thymeleaf.context.Context;
|
|
|
-import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver;
|
|
|
-import com.gyee.SpringbootStart;
|
|
|
-import com.gyee.frame.common.spring.SpringUtils;
|
|
|
-import com.gyee.frame.mapper.auto.GeneratorMapper;
|
|
|
-import com.gyee.frame.mapper.custom.TsysUserDao;
|
|
|
-
|
|
|
-@RunWith(SpringRunner.class)
|
|
|
-@SpringBootTest(classes = SpringbootStart.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
|
|
-public class SpringbootTest {
|
|
|
-
|
|
|
- @Resource
|
|
|
- private GeneratorMapper generatorMapper;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- @Test
|
|
|
- public void test(){
|
|
|
-
|
|
|
- Gson gson=new Gson();
|
|
|
- System.out.println();
|
|
|
- System.out.println(gson.toJson(modelVo));
|
|
|
- System.out.println();*/
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- TsysUserDao dao= SpringUtils.getBean(TsysUserDao.class);
|
|
|
-
|
|
|
- Method[] methods= dao.getClass().getMethods();
|
|
|
- for (Method method : methods) {
|
|
|
- Annotation[] annotations= method.getAnnotations();
|
|
|
-
|
|
|
- for (Annotation annotation : annotations) {
|
|
|
- System.out.println(annotation.toString());
|
|
|
-
|
|
|
- Method[] methods2= annotations.getClass().getDeclaredMethods();
|
|
|
- for (Method method2 : methods2) {
|
|
|
- Annotation[] annotations2= method2.getAnnotations();
|
|
|
- for (Annotation annotation2 : annotations2) {
|
|
|
- System.out.println("annotation2>>"+annotation2.toString());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- System.out.println(dao.queryUserName("admin").getUsername());
|
|
|
- }
|
|
|
-
|
|
|
- public void main() {
|
|
|
-
|
|
|
- ClassLoaderTemplateResolver resolver = new ClassLoaderTemplateResolver();
|
|
|
- resolver.setPrefix("templates/");
|
|
|
- resolver.setSuffix(".TEXT");
|
|
|
-
|
|
|
- TemplateEngine templateEngine = new TemplateEngine();
|
|
|
-
|
|
|
- templateEngine.setTemplateResolver(resolver);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- Context context = new Context();
|
|
|
-
|
|
|
- Map<String, String> map=new HashMap<String, String>();
|
|
|
- map.put("hello4","444");
|
|
|
- map.put("hello2","2222");
|
|
|
- context.setVariable("hello","111111111");
|
|
|
- context.setVariable("items",map);
|
|
|
-
|
|
|
-
|
|
|
- System.out.println(templateEngine.process("example", context)) ;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-}
|