Open xzy0725 opened 6 years ago
这种方式不能用,@AutoConfigureAfter
特定情况才起作用。
如果非要用类似方式,就参考 https://github.com/abel533/mapper-boot-starter 项目。
Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'mapperHelper' of bean class [org.mybatis.spring.mapper.MapperFactoryBean]: Bean property 'mapperHelper' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
去掉了,也不行~~使用的mybatis-spring-boot项目测试的
mybatis相关依赖的版本是多少?
` <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<groupId>tk.mybatis</groupId>
<artifactId>mybatis-spring-boot</artifactId>
<version>1.0.0-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.6.RELEASE</version>
</parent>
<properties>
<java.version>1.8</java.version>
<mybatis.spring.version>1.2.4</mybatis.spring.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-freemarker</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-joda</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-parameter-names</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.0.11</version>
</dependency>
<!--mybatis-->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>RELEASE</version>
</dependency>
<!--mapper-->
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper-spring-boot-starter</artifactId>
<version>RELEASE</version>
</dependency>
<!--pagehelper-->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>springloaded</artifactId>
<version>1.2.5.RELEASE</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.2</version>
<configuration>
<configurationFile>${basedir}/src/main/resources/generator/generatorConfig.xml</configurationFile>
<overwrite>true</overwrite>
<verbose>true</verbose>
</configuration>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper</artifactId>
<version>3.4.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
`
用的mybatis-spring-boot的项目,spring boot 1.5.6/1.5.8都不行,mybatis 3.4.5
和 https://github.com/abel533/MyBatis-Spring-Boot 项目很接近。。能不能在这个基础上试试。
我这个测试就是在你给出的项目上测试的。。又整了好几天了。。找到这么个答案。。
这个问题现在还没有解决吗?原文(https://www.oschina.net/question/2307208_2197431)
@xzy0725 很早很早就已经解决了,新版本Mapper没这个问题。
我现在用的是 Springboot版本,引入的是3.4.4,但是还是有这个问题
以前是什么原因导致的?能不能给提供点思路
如果方便就提供的简单demo吧,我试试。
https://github.com/xzy0725/mybatis.git
用这个试试,我直接在你的mybatis项目上修改的
问题描述:参考http://blog.csdn.net/isea533/article/details/53011890
使用属性文件方式配置,可以正常使用devtools,但是使用配置文件方式不会配置uuid回显,因此使用了javaConfig
用了javaConfig配置后,导致项目无法启动,一直报错:
配置文件如下: Mybatis配置:
TkMapperConfig Mapper的配置: