Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
8097d4c0e8 |
@ -19,6 +19,20 @@
|
|||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-security</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- SpringSession Redis支持 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.session</groupId>
|
||||||
|
<artifactId>spring-session-data-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- 添加Redis的Starter -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
@ -32,6 +46,10 @@
|
|||||||
<artifactId>commons</artifactId>
|
<artifactId>commons</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package com.test.controller;
|
package com.test.controller;
|
||||||
|
|
||||||
|
import com.test.entity.Book;
|
||||||
import com.test.service.BookService;
|
import com.test.service.BookService;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.awt.print.Book;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClassName: BookController
|
* ClassName: BookController
|
||||||
@ -25,4 +25,5 @@ public class BookController {
|
|||||||
Book findBookById(@PathVariable("bid") int bid){
|
Book findBookById(@PathVariable("bid") int bid){
|
||||||
return service.getBookById(bid);
|
return service.getBookById(bid);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
package com.test.mapper;
|
package com.test.mapper;
|
||||||
|
|
||||||
|
import com.test.entity.Book;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
import java.awt.print.Book;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClassName: BookMapper
|
* ClassName: BookMapper
|
||||||
* Package: com.test.mapper
|
* Package: com.test.mapper
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.test.service;
|
package com.test.service;
|
||||||
|
|
||||||
import java.awt.print.Book;
|
import com.test.entity.Book;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClassName: BookService
|
* ClassName: BookService
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package com.test.service.impl;
|
package com.test.service.impl;
|
||||||
|
|
||||||
|
import com.test.entity.Book;
|
||||||
import com.test.mapper.BookMapper;
|
import com.test.mapper.BookMapper;
|
||||||
import com.test.service.BookService;
|
import com.test.service.BookService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.awt.print.Book;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClassName: BookServiceImpl
|
* ClassName: BookServiceImpl
|
||||||
|
@ -6,3 +6,11 @@ spring:
|
|||||||
url: jdbc:mysql://43.143.164.194:3306/mac
|
url: jdbc:mysql://43.143.164.194:3306/mac
|
||||||
username: mac
|
username: mac
|
||||||
password: mactest
|
password: mactest
|
||||||
|
session:
|
||||||
|
# 存储类型修改为redis
|
||||||
|
store-type: redis
|
||||||
|
redis:
|
||||||
|
# Redis服务器的信息,该咋写咋写
|
||||||
|
host: 43.143.164.194
|
||||||
|
port: 6379
|
||||||
|
password: redis
|
||||||
|
30
book-service/src/test/java/com/test/BookTest.java
Normal file
30
book-service/src/test/java/com/test/BookTest.java
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package com.test;
|
||||||
|
|
||||||
|
import com.test.mapper.BookMapper;
|
||||||
|
import com.test.service.BookService;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClassName: BookTest
|
||||||
|
* Package: com.test
|
||||||
|
*
|
||||||
|
* @author yovinchen
|
||||||
|
* @Create 2023/8/19 12:58
|
||||||
|
*/
|
||||||
|
@SpringBootTest
|
||||||
|
public class BookTest {
|
||||||
|
@Resource
|
||||||
|
private BookService service;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BookMapper bookMapper;
|
||||||
|
@Test
|
||||||
|
public void bookTest(){
|
||||||
|
System.out.println(bookMapper.getBookById(1));
|
||||||
|
System.out.println(service.getBookById(1));
|
||||||
|
}
|
||||||
|
}
|
@ -18,6 +18,20 @@
|
|||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-security</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- SpringSession Redis支持 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.session</groupId>
|
||||||
|
<artifactId>spring-session-data-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- 添加Redis的Starter -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
@ -6,3 +6,11 @@ spring:
|
|||||||
url: jdbc:mysql://43.143.164.194:3306/mac
|
url: jdbc:mysql://43.143.164.194:3306/mac
|
||||||
username: mac
|
username: mac
|
||||||
password: mactest
|
password: mactest
|
||||||
|
session:
|
||||||
|
# 存储类型修改为redis
|
||||||
|
store-type: redis
|
||||||
|
redis:
|
||||||
|
# Redis服务器的信息,该咋写咋写
|
||||||
|
host: 43.143.164.194
|
||||||
|
port: 6379
|
||||||
|
password: redis
|
||||||
|
@ -18,6 +18,20 @@
|
|||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-security</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- SpringSession Redis支持 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.session</groupId>
|
||||||
|
<artifactId>spring-session-data-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- 添加Redis的Starter -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
@ -6,3 +6,11 @@ spring:
|
|||||||
url: jdbc:mysql://43.143.164.194:3306/mac
|
url: jdbc:mysql://43.143.164.194:3306/mac
|
||||||
username: mac
|
username: mac
|
||||||
password: mactest
|
password: mactest
|
||||||
|
session:
|
||||||
|
# 存储类型修改为redis
|
||||||
|
store-type: redis
|
||||||
|
redis:
|
||||||
|
# Redis服务器的信息,该咋写咋写
|
||||||
|
host: 43.143.164.194
|
||||||
|
port: 6379
|
||||||
|
password: redis
|
||||||
|
Loading…
Reference in New Issue
Block a user