Core Technology (Volume 2) 02, Chapter 1-Regular expression

2023-01-01   ES  

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): cn.com.bofeng.pipihealth.database.mapper.rule.RuleServiceIndicatorsDetailMapper.selectList


  1. Check whether I introduce mybatis plus dependencies

    In the
    official website, the introduction of mybatis plus depends on the following

<!-- spring boot -->
<dependency>
    <groupId>com.baomidou</groupId>
    <artifactId>mybatis-plus-boot-starter</artifactId>
    <version>3.5.1</version>
</dependency>

<!-- spring -->
<dependency>
    <groupId>com.baomidou</groupId>
    <artifactId>mybatis-plus</artifactId>
    <version>3.5.1</version>
</dependency>

After introducing MyBatis-Plus, please do not introduce Mybatis and MyBatis-Spring again to avoid problems caused by version differences.

  1. Delete mybatis other dependencies that cause conflicts
    Check whether other Mybatis dependencies are introduced in the POM file. If there is the following dependencies, you can directly annotate:
<!-- spring boot -->
<dependency>
    <groupId>org.mybatis.spring.boot</groupId>
    <artifactId>mybatis-spring-boot-starter</artifactId>
    <version>1.3.0</version>
</dependency>


<!-- spring -->
<dependency>
    <groupId>org.mybatis</groupId>
    <artifactId>mybatis-spring</artifactId>
    <version>1.3.1</version>
</dependency>

<dependency>
    <groupId>org.mybatis</groupId>
    <artifactId>mybatis</artifactId>
    <version>3.4.4</version>
</dependency>

  1. Spring Boot SQLSESSIONFACTORY BeAN configuration
@Configuration
public class MybatisPlusConfig {
    
	@Value("${mybatis.mapper-locations}")
	private String mapperLocations;
	
	// spring boot
	@Bean
	public SqlSessionFactory sqlSessionFactory(DataSource dataSource)
	        throws Exception {
    
	    final MybatisSqlSessionFactoryBean sessionFactory = new MybatisSqlSessionFactoryBean();
	    sessionFactory.setDataSource(dataSource);
	    sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(mapperLocations));
	    return sessionFactory.getObject();
	}
}
  1. Spring Boot SQLSESSIONFACTORY BeAN configuration
<!-- spring -->
<bean id="sqlSessionFactory" class="com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean">
    <property name="dataSource" ref="dataSource"/>
    <property name="configLocation" value="classpath:/mybatis.xml"/>
    <property name="mapperLocations">
        <array>
            <value>classpath*:/mapper/**/*.xml</value>
        </array>
    </property>
</bean>

source

Related Posts

Use EXE4J to pack executable jar into exe files

Financial information security training -information encryption (classical)

Gephi’s simple drawing learns to learn together

GOOGLEVR panoramic production process

Core Technology (Volume 2) 02, Chapter 1-Regular expression

Random Posts

Train YOLO on colab

Four, Spring Security certification and authorization-dynamic authorization solution Still

mount and umount commands (mounting and uninstalling file system) Deepwater

MAC, Node visits mysql database to report an error

After class, practice (advancement) 1017. -1+I advance naive “Programming Thinking and Practice” personal learning notes