Saturday, February 27, 2016

Set global properties for your MyBatis mappers using Spring-MyBatis

If you need to define some global properties in MyBatis, but using spring-mybatis

In your spring config file:



In application.properties:

fooTableName=FOO_T

In your spring config file: (note sorry about the odd xml declaration, this blogger pre xml doesn't let me define the xml in one line using "/"?)


 
  
 
  
   ${fooTableName}
  
 



Now in your mapper:




Thanks to post at http://stackoverflow.com/questions/8392741/mybatis-defining-a-global-parameter/8422082#8422082

No comments :

Post a Comment

Blogger Syntax Highliter