Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Commit

Permalink
[ch07] use DefaultSqlService.
Browse files Browse the repository at this point in the history
  • Loading branch information
dhsim86 committed Oct 22, 2017
1 parent fc567d7 commit 1ba668a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
11 changes: 11 additions & 0 deletions src/main/java/ch07/springbook/sql/DefaultSqlService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package ch07.springbook.sql;

import ch07.springbook.sql.reader.JaxbXmlSqlReader;
import ch07.springbook.sql.registry.HashMapSqlRegistry;

public class DefaultSqlService extends BaseSqlService {
public DefaultSqlService() {
setSqlReader(new JaxbXmlSqlReader());
setSqlRegistry(new HashMapSqlRegistry());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@

public class JaxbXmlSqlReader implements SqlReader {

private String sqlMapFile;
private static final String DEFAULT_SQLMAP_FILE = "/sql/sqlmap.xml";

private String sqlMapFile = DEFAULT_SQLMAP_FILE;

public void setSqlMapFile(String sqlMapFile) {
this.sqlMapFile = sqlMapFile;
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/applicationContext.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@

<bean id="testUserService" class="ch01.springbook.user.UserServiceTest$TestUserService" parent="userService" />

<bean id="sqlService" class="ch07.springbook.sql.BaseSqlService" >
<property name="sqlReader" ref="sqlReader" />
<property name="sqlRegistry" ref="sqlRegistry" />
<bean id="sqlService" class="ch07.springbook.sql.DefaultSqlService" >
<!--<property name="sqlReader" ref="sqlReader" />
<property name="sqlRegistry" ref="sqlRegistry" /> -->
</bean>

<bean id="sqlReader" class="ch07.springbook.sql.reader.JaxbXmlSqlReader" >
Expand Down

0 comments on commit 1ba668a

Please sign in to comment.