Fully executable Jar does not scan typeAlias
See original GitHub issuemybatis-spring-boot 1.0.1 does not scan typeAlias from specified package as follow:
mybatis.type-aliases-package=com.example.model
Specify a type alias in Mapper XML
<!DOCTYPE mapper PUBLIC
"-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.mapper.MessageMapper">
<select id="findOne" resultType="Message"> <!-- ## Use type alias -->
SELECT code, message FROM t_message WHERE code = #{code}
</select>
</mapper>
Settings for building a fully executable jar
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable> <!-- Add -->
</configuration>
</plugin>
</plugins>
</build>
Build a fully executable jar
$ ./mvnw clean install
Run a fully executable jar
$ java -jar target/xxxx.jar
...
at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:118)
... 44 more
Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias 'Message'. Cause: java.lang.ClassNotFoundException: Cannot find class: Message
at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:120)
at org.apache.ibatis.builder.BaseBuilder.resolveAlias(BaseBuilder.java:149)
at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:116)
... 48 more
...
Related issue : #35
Issue Analytics
- State:
- Created 7 years ago
- Comments:19 (14 by maintainers)
Top Results From Across the Web
mybatis-spring & spring boot - Could not resolve type alias issue
My situation is that I have a executable jar with Spring Boot which has a nested jar (which uses regular Spring) as dependency....
Read more >MyBatis 3 | Configuration
Specifies if and how MyBatis should automatically map columns to fields/properties. NONE disables auto-mapping. PARTIAL will only auto-map ...
Read more >The Executable Jar Format - Spring
A shaded jar packages all classes, from all jars, into a single “uber jar”. The problem with shaded jars is that it becomes...
Read more >com.baomidou.mybatisplus.extension.spring ... - Download JAR files
typeAliases = typeAliases; } /** * If true, a final check is done on Configuration to assure that all mapped * statements are...
Read more >intellij 나 STS에서 실행하면 아무 문제 없는데 executable jar로 ...
TypeException: Could not resolve type alias "entities". 이런 오류가 나네요. ... Fully executable Jar does not scan typeAlias · Issue #38 · mybatis/spring-....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@kazuki43zoo , Yes,the problem is solved.Thanks for your reply.
If you need my help, I want to a small reproduce project(maven or gradle). It is difficult to analyze issue with stack trace only in this case.