File tree Expand file tree Collapse file tree 5 files changed +46
-1
lines changed
spitter-persistence-mybatis Expand file tree Collapse file tree 5 files changed +46
-1
lines changed Original file line number Diff line number Diff line change 72
72
<version >2.8.0</version >
73
73
</dependency >
74
74
75
+ <dependency >
76
+ <groupId >log4j</groupId >
77
+ <artifactId >log4j</artifactId >
78
+ <version >1.2.12</version >
79
+ </dependency >
80
+
75
81
<dependency >
76
82
<groupId >junit</groupId >
77
83
<artifactId >junit</artifactId >
Original file line number Diff line number Diff line change 32
32
<orderEntry type =" library" name =" Maven: com.fasterxml.jackson.core:jackson-databind:2.8.0" level =" project" />
33
33
<orderEntry type =" library" name =" Maven: com.fasterxml.jackson.core:jackson-annotations:2.8.0" level =" project" />
34
34
<orderEntry type =" library" name =" Maven: com.fasterxml.jackson.core:jackson-core:2.8.0" level =" project" />
35
+ <orderEntry type =" library" name =" Maven: log4j:log4j:1.2.12" level =" project" />
35
36
<orderEntry type =" library" name =" Maven: junit:junit:4.11" level =" project" />
36
37
<orderEntry type =" library" name =" Maven: org.hamcrest:hamcrest-core:1.3" level =" project" />
37
38
</component >
Original file line number Diff line number Diff line change 2
2
3
3
import com .vonzhou .spitter .domain .Spitter ;
4
4
import com .vonzhou .spitter .service .SpitterService ;
5
+ import com .vonzhou .spitter .service .SpitterService2 ;
5
6
import org .springframework .context .ApplicationContext ;
6
7
import org .springframework .context .support .ClassPathXmlApplicationContext ;
7
8
@@ -17,7 +18,8 @@ public static void main(String[] args) {
17
18
ApplicationContext context = new ClassPathXmlApplicationContext ("applicationContext.xml" );
18
19
//JdbcSpitterDao dao = (JdbcSpitterDao)context.getBean("jdbcSpitterDao");
19
20
20
- SpitterService spitterService = (SpitterService ) context .getBean ("spitterService" );
21
+ // SpitterService spitterService = (SpitterService) context.getBean("spitterService");
22
+ SpitterService2 spitterService = (SpitterService2 ) context .getBean ("spitterService2" );
21
23
22
24
23
25
Spitter s = new Spitter ();
Original file line number Diff line number Diff line change
1
+ package com .vonzhou .spitter .service ;
2
+
3
+ import com .vonzhou .spitter .domain .Spitter ;
4
+ import com .vonzhou .spitter .mappers .SpitterMapper ;
5
+ import org .mybatis .spring .SqlSessionTemplate ;
6
+ import org .springframework .beans .factory .annotation .Autowired ;
7
+ import org .springframework .stereotype .Service ;
8
+ import org .springframework .transaction .annotation .Transactional ;
9
+
10
+ import java .util .List ;
11
+
12
+ /**
13
+ * Created by vonzhou on 16/7/12.
14
+ */
15
+ @ Service (value = "spitterService2" )
16
+ @ Transactional
17
+ public class SpitterService2 {
18
+
19
+ @ Autowired
20
+ private SqlSessionTemplate sqlSessionTemplate ;
21
+
22
+ public List <Spitter > findAllSpitters () {
23
+ SpitterMapper spitterMapper = sqlSessionTemplate .getMapper (SpitterMapper .class );
24
+ return spitterMapper .findAllSpitters ();
25
+ }
26
+ }
Original file line number Diff line number Diff line change
1
+ # ## set log levels - for more verbose logging change 'info' to 'debug' ###
2
+ log4j.rootLogger =info, stdout
3
+
4
+ # ## direct log messages to stdout ###
5
+ log4j.appender.stdout =org.apache.log4j.ConsoleAppender
6
+ log4j.appender.stdout.Target =System.out
7
+ log4j.appender.stdout.layout =org.apache.log4j.PatternLayout
8
+ log4j.appender.stdout.layout.ConversionPattern =%d{yyyy-MM-dd HH:mm:ss,SSS} %5p %c{1}:%L - %m%n
9
+
10
+ # log4j.logger.com.vonzhou.spitter.mappers.SpitterMapper=TRACE
You can’t perform that action at this time.
0 commit comments