1. 程式人生 > 其它 >Spring Boot實踐——Mybatis分頁外掛PageHelper的使用

Spring Boot實踐——Mybatis分頁外掛PageHelper的使用

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@ComponentScan(basePackages = {"cn.com"})
public class SampleController {
    public static void main(String[] args) throws Exception {
        SpringApplication.run(SampleController.class, args);
    }
}

application.properties
server.port=9990
server.context-path=/myboot

@RestController
@RequestMapping("/cos")
public class XmhController {
    @RequestMapping("/hello1")
    public String hello1() {
        System.out.println("hello1");
        return "hello";
    }
}

<dependencies>
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>1.3.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>1.2.47</version>
        </dependency>
</dependencies>

http://192.168.31.123:9990/cos/hello1