海量数据处理项目-账号微服务注册Nacos+配置文件增加
导入生成好的代码
model (为啥不放common项目,如果是确定每个服务都用到的依赖或者类才放到common项目)
mapper 类接口拷贝
resource/mapper文件夹 xml脚本拷贝
controller
service 不拷贝
Mybatis plus配置控制台打印日志
#配置plus打印sql日志
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
启动账号微服务
排除sharding-jdbc依赖
<dependencies>
<dependency>
<groupId>net.xdclass</groupId>
<artifactId>dcloud-common</artifactId>
<version>1.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>sharding-jdbc-spring-boot-starter</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
配置文件
server:
port: 8001
#应用名称
spring:
application:
name: dcloud-account
#服务注册发现
cloud:
nacos:
discovery:
server-addr: 39.107.90.188:8848
username: nacos
password: nacos
#数据库配置
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://39.107.90.188:3306/dcloud_account?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password: xdclass.net168
#配置plus打印sql日志
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
增加main函数主类
@MapperScan("net.xdclass.mapper")
@EnableTransactionManagement
@EnableFeignClients
@EnableDiscoveryClient
@SpringBootApplication
public class AccountApplication {
public static void main(String[] args) {
SpringApplication.run(AccountApplication.class, args);
}
}