Skip to content

Commit ada5fae

Browse files
committed
update example
1 parent 62b05ac commit ada5fae

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

ddal-example/ddal-example-example0/src/main/java/org/hellojavaer/ddal/example/example0/dao/impl/UserDaoImpl.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import org.hellojavaer.ddal.sequence.Sequence;
2121
import org.mybatis.spring.SqlSessionTemplate;
2222
import org.springframework.beans.factory.annotation.Autowired;
23-
import org.springframework.beans.factory.annotation.Value;
2423
import org.springframework.stereotype.Repository;
2524

2625
import java.util.List;
@@ -36,7 +35,7 @@ public class UserDaoImpl implements UserDao {
3635
@Autowired
3736
private SqlSessionTemplate sqlSessionTemplate;
3837

39-
@Value("#{dataSource.sequence}")
38+
@Autowired
4039
private Sequence sequence;
4140

4241
@Override

ddal-example/ddal-example-example0/src/main/resources/context.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@
1616
<bean name="dataSource" class="org.hellojavaer.ddal.datasource.DefaultDDALDataSource">
1717
<constructor-arg index="0" value="jdbc:ddal:thick:classpath:/datasource.xml"/>
1818
</bean>
19+
<bean id="sequence" class="org.springframework.aop.framework.ProxyFactoryBean">
20+
<property name="proxyInterfaces">
21+
<value>org.hellojavaer.ddal.sequence.Sequence</value>
22+
</property>
23+
<property name="target" value="#{dataSource.sequence}"/>
24+
</bean>
25+
<bean id="shardRouter" class="org.springframework.aop.framework.ProxyFactoryBean">
26+
<property name="proxyInterfaces">
27+
<value>org.hellojavaer.ddal.ddr.shard.ShardRouter</value>
28+
</property>
29+
<property name="target" value="#{dataSource.shardRouter}"/>
30+
</bean>
1931

2032
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
2133
<property name="defaultTimeout" value="6000"/>

0 commit comments

Comments
 (0)