Problem springboot package deployment project war and the emergence of Failed to bind properties under 'mybatis.configuration.mapped-statements [0].

1. Modify the pom file
modifications are packaged as a war;
add tomcat range, provided the meaning that is externally provided at the time of release, the built-in tomcat will not be packaged into

   <groupId>com.school</groupId>
    <artifactId>daniel</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>daniel</name>
    <description>student information project for Spring Boot</description>
    <!--打包方式,发布时使用此项-->
    <packaging>war</packaging>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <!--需要发布发war包时使用-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>

2. A successor SpringBootServletInitializer start class or class configuration, if the need to fight war package deployment, need to inherit such, rewrite configure method .

@SpringBootApplication
public class DanielApplication extends SpringBootServletInitializer {
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(DanielApplication.class);
    }
    public static void main(String[] args) {
        SpringApplication.run(DanielApplication.class, args);
    }
}

Note:
If you are using the latest version springboot will be reported, I was using a
springboot-Starter-parent: 2.2.0.RELEASE,
the mybatis-springboot-Starter: 2.1.1
modified version of the following problems solved by querying the information found there is a problem now with the latest version springboot mybatis compatibility, to the back after the upgrade should be no problem.
Failed to bind properties under 'mybatis.configuration.mapped- statements [0] .parameter-map.parameter- ...

 <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <!--<version>2.2.0.RELEASE</version>-->
        <version>2.1.5.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
<dependency>
        <groupId>org.mybatis.spring.boot</groupId>
        <artifactId>mybatis-spring-boot-starter</artifactId>
        <!-- <version>2.1.1</version>-->
        <version>2.0.1</version>
</dependency>

Attachment: the above problems have been solved, but my project using shiro framework, when an external tomcat deployment can not be used shiro. When there is no change version of the idea is to use a normal ...

Published 32 original articles · won praise 0 · Views 4438

Guess you like

Origin blog.csdn.net/InternetJava/article/details/104698527