Skip to content

Commit

Permalink
Modify : 优化Mybatis的Mapper为通过Spring扫描注入。 参考:MapperScannerConfigurer
Browse files Browse the repository at this point in the history
  • Loading branch information
TinyZzh committed Jul 20, 2016
1 parent 3a0ec49 commit 4b6dda5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
import org.apache.ibatis.annotations.UpdateProvider;
import org.ogcs.okra.example.game.persistence.domain.MemRole;
import org.ogcs.okra.example.game.persistence.provider.RoleSqlProvider;
import org.springframework.stereotype.Component;

@Component("roleMapper")
public interface RoleMapper {

@InsertProvider(type = RoleSqlProvider.class, method = "insertSql")
Expand Down
6 changes: 5 additions & 1 deletion okra-demo/src/main/resources/spring/beans.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@
<import resource="server-beans.xml"/>

<!-- Mybatis Persistence beans -->
<import resource="mybatis-beans.xml"/>
<!--<import resource="mybatis-beans.xml"/>-->
<bean id="mybatisScanner" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="org.ogcs.okra.example.game.persistence.mapper"/>
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
</bean>

<context:annotation-config/>
<!--<context:component-scan base-package="org.ogcs.okra.example.game"/>-->
Expand Down

0 comments on commit 4b6dda5

Please sign in to comment.