In 1.2.5 The following version of the mybatis-spring configuration may fail to start, but JUnit mode can be started
Configuration:
<BeanID= "Sqlsessionfactoryname"class= "Org.mybatis.spring.SqlSessionFactoryBean">
< Propertyname= "DataSource"ref= "DataSource"/>
< Propertyname= "Configlocation"
value= "${dao.mybatis.sqlsessionfactory.configlocation}"/>
</Bean>
<BeanID= "Mapperscannerconfigurer"class= "Org.mybatis.spring.mapper.MapperScannerConfigurer"Lazy-init= "true">
< Propertyname= "Sqlsessionfactorybeanname"value= "Sqlsessionfactoryname"/>
< Propertyname= "Processpropertyplaceholders"value= "true"/>
< Propertyname= "Basepackage"value= "${dao.mybatis.scanner.basepackage}"/>
</Bean>
Starting mode:
CTX = new Classpathxmlapplicationcontext (configfilename), or web-mode startup
An error that the property cannot find is reported, but can be started normally through JUnit mode.
The specific reasons are as follows:
Mapperscannerconfigurer's Processpropertyplaceholders method adds a context type of judgment
if (!prcs.isempty () && this.applicationcontext instanceof Genericapplicationcontext) {
This causes the application that takes the Classpathxmlapplicationcontext boot to skip the action of loading the property, causing the property to not be found.
In the 1.3.1 version (I see 1.3.1 version, 1.3.0 version not verified) The judgement should read:
if (!prcs.isempty () && this.applicationcontext instanceof Configurableapplicationcontext) {
Solve this problem, if you encounter this problem can be resolved by upgrading the version
This article is from "Tianya Time and Space" blog, please make sure to keep this source http://leshjmail.blog.51cto.com/629172/1909489
About Spring+mybatis Mapperscannerconfigurer Unable to load Place-holder attribute problem analysis