【文件属性】:
文件名称:springboot启动类
文件大小:1KB
文件格式:JAVA
更新时间:2021-11-18 04:31:11
springboot
package com;
import java.util.Properties;
import com.github.pagehelper.PageHelper;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
@SpringBootApplication
public class OfficeServiceApplication {
public static void main(String[] args) {
SpringApplication.run(OfficeServiceApplication.class, args);
}
@Bean
@LoadBalanced
public RestTemplate getRestTemplate(){
return new RestTemplate();
}
//配置mybatis的分页插件pageHelper
@Bean
public PageHelper pageHelper(){
PageHelper pageHelper = new PageHelper();
Properties properties = new Properties();
properties.setProperty("offsetAsPageNum","true");
properties.setProperty("rowBoundsWithCount","true");
properties.setProperty("reasonable","true");
properties.setProperty("dialect","mysql"); //配置mysql数据库的方言
pageHelper.setProperties(properties);
return pageHelper;
}
}
网友评论
- 谢谢楼主了。