Spring注解测试

Posted on 2019-04-09 14:45  断弦悠扬  阅读(143)  评论(0编辑  收藏  举报

@RunWith(SpringJUnit4ClassRunner.class) 
@ContextConfiguration(locations = "classpath:application.xml") 
@Transactional 
public class Egptest { 
@Autowired 
private RestTemplate restTemplate; 
@Test 
public void aa (){ 
List<Map<String,Object>> list=new ArrayList<Map<String, Object>>(); 
Map<String,Object> aa=new HashMap<String, Object>(); 
aa.put("newWtID","123"); 
aa.put("oldWtID","1111111111"); 
Map<String,Object> bb=new HashMap<String, Object>(); 
bb.put("newWtID","678"); 
bb.put("oldWtID","14596590"); 
list.add(aa); 
list.add(bb); 
String a= JSON.toJSONString(list); 
String result = restTemplate.postForObject("******************", a, String.class); 
System.out.println(result); 

} 
} 

Copyright © 2024 断弦悠扬
Powered by .NET 8.0 on Kubernetes