Skip to content

Commit 018ad57

Browse files
author
zhangzhen
committed
test
1 parent 28da7b3 commit 018ad57

7 files changed

Lines changed: 29 additions & 12 deletions

File tree

src/main/java/org/neil/controller/TestController.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
import javax.servlet.http.HttpSession;
66

77
import org.neil.domain.ActivityGiftProductVO;
8+
import org.neil.domain.PC;
89
import org.neil.domain.TestDomain;
910
import org.neil.domain.TestDomainWapper;
1011
import org.neil.domain.UpdateChildLevelVO;
1112
import org.neil.manager.TestManager;
13+
import org.neil.service.PCService;
1214
import org.slf4j.Logger;
1315
import org.slf4j.LoggerFactory;
1416
import org.springframework.beans.factory.annotation.Autowired;
@@ -20,6 +22,7 @@
2022
import org.springframework.web.bind.annotation.RequestMethod;
2123
import org.springframework.web.bind.annotation.RestController;
2224
import org.springframework.web.multipart.MultipartFile;
25+
import com.github.pagehelper.Page;
2326

2427

2528
/**
@@ -41,6 +44,9 @@ public class TestController {
4144
@Autowired
4245
private TestDomain testDomain;
4346

47+
@Autowired
48+
private PCService pcService;
49+
4450

4551
public void setTestDomainWapper(TestDomainWapper testDomainWapper) {
4652
this.testDomainWapper = testDomainWapper;
@@ -164,6 +170,16 @@ public Object circulationTest() throws Exception {
164170
return testDomain;
165171
}
166172

173+
174+
@GetMapping(value = "querypc")
175+
public Object querypc() throws Exception {
176+
Page<PC> pcs = pcService.pageQueryPCList();
177+
return pcs;
178+
}
179+
180+
181+
182+
167183
private void circulation(byte[] bytes, int i) {
168184
try {
169185
Thread.sleep(1000);

src/main/java/org/neil/mybatis/WithoutSpring.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
public class WithoutSpring {
1717

1818
public static void main(String[] args) throws IOException {
19-
String resource = "mapper/mybatis-config.xml";
19+
String resource = "mybatis-config.xml";
2020
InputStream inputStream = Resources.getResourceAsStream(resource);
2121
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
2222
SqlSession sqlSession = sqlSessionFactory.openSession();

src/main/resource/config/application.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
driver=com.mysql.cj.jdbc.Driver
22
url=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8&allowMultiQueries=true
33
username=root
4-
password=root1234
4+
#password=root1234
5+
password=134ojdon
56
maxActive=50
67
maxIdle=10
78
minIdle=1
File renamed without changes.

src/main/resource/spring-servlet.xml renamed to src/main/webapp/WEB-INF/spring-servlet.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@
6363

6464
<bean id="springInitTest" class="org.neil.util.SpringInitTest" init-method="initMethod"/>
6565

66-
<import resource="spring-bean.xml"/>
67-
<import resource="spring-datasource.xml"/>
66+
<import resource="classpath:/spring-bean.xml"/>
67+
<import resource="classpath:/spring-datasource.xml"/>
6868
</beans>

src/main/webapp/WEB-INF/web.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515

1616
<context-param>
1717
<param-name>contextConfigLocation</param-name>
18-
<param-value>classpath:spring-servlet.xml</param-value>
18+
<param-value>/WEB-INF/spring-servlet.xml</param-value>
1919
</context-param>
2020

21-
<!--<listener>-->
22-
<!--<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>-->
23-
<!--</listener>-->
21+
<listener>
22+
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
23+
</listener>
2424
<!--&lt;!&ndash; 监听器 &ndash;&gt;-->
2525
<!--<listener>-->
2626
<!--<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>-->
@@ -45,18 +45,18 @@
4545
</filter-mapping>
4646

4747
<servlet>
48-
<servlet-name>spring-servlet</servlet-name>
48+
<servlet-name>spring</servlet-name>
4949
<!-- spring初始化配置文件位置 -->
5050
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
5151
<!--<init-param>-->
5252
<!--<param-name>contextConfigLocation</param-name>-->
5353
<!--<param-value>classpath:spring-servlet.xml</param-value>-->
5454
<!--</init-param>-->
55-
<load-on-startup>1</load-on-startup>
55+
<load-on-startup>2</load-on-startup>
5656
</servlet>
5757

5858
<servlet-mapping>
59-
<servlet-name>spring-servlet</servlet-name>
59+
<servlet-name>spring</servlet-name>
6060
<url-pattern>/*</url-pattern>
6161
</servlet-mapping>
6262

src/test/java/org/neil/BaseTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* @date 2018/6/28
1616
*/
1717
@RunWith(SpringJUnit4ClassRunner.class)
18-
@ContextConfiguration(locations = { "classpath:spring-servlet.xml" })
18+
@ContextConfiguration(locations = {"classpath:WEB-INF/spring-servlet.xml"})
1919
public class BaseTest {
2020

2121
@Autowired

0 commit comments

Comments
 (0)