问题遇到的现象和发生背景
运行tomcat服务器后,打开浏览器输入localhost:8080/index.html
idea却输出以下语句:
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@47f4d08b] was not registered for synchronization because synchronization is not active
JDBC Connection [com.mysql.jdbc.JDBC4Connection@6c41c227] will not be managed by Spring
==> Preparing: select id, username from test_data where id=1
==> Parameters:
<== Columns: id, username
<== Row: 1, zjz
<== Total: 1
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@47f4d08b]
我在wepapp里面部署的有使用layui框架的index.html文件,且不开服务器直接通过idea的虚拟服务器运行是没问题的
###### 运行结果及报错内容
![img](https://img-mid.csdnimg.cn/release/static/image/mid/ask/460623043246187.png "#left")
我写的Controller如下:
```java
@RestController
public class TestDataController {
@Resource
private TestDataService testDataService;
@RequestMapping("/hello")
public String hello(){
return "13213213";
}
@RequestMapping
public List<TestData> selectById(){
return testDataService.selectById();
}
@RequestMapping("/testjson")
public Map<String,Object> testjson(){
Map<String,Object> map=new HashMap<>();
map.put("code",0);
map.put("msg","查询成功咯");
map.put("count",100);//总计有多少条数据
List<TestUser> listobj=new ArrayList<>();
TestUser testUser=null;
for(int i=0;i<100;i++){
testUser=new TestUser();
testUser.setId("0");
testUser.setUsername("张大帅哥"+i);
testUser.setEmail("6666666666@qq.com");
testUser.setSex("男");
testUser.setCity("xx省xx市");
listobj.add(testUser);
}
map.put("data",listobj);
return map;
}
}
运行其他两个,比如localhost:8080/hello,localhost:8080/selectById,都没有问题
我到底问题出在哪儿了,希望大家能帮我看一看,找找问题