Compare commits
1 Commits
master
...
springboot
| Author | SHA1 | Date | |
|---|---|---|---|
| e4aa453e39 |
10
DockerFileJava25
Normal file
10
DockerFileJava25
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
FROM eclipse-temurin:25-jdk-jammy
|
||||||
|
MAINTAINER TongTongStudio <tongtongstudios@gmail.com>
|
||||||
|
RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak
|
||||||
|
|
||||||
|
RUN mkdir -p /data/uploads/
|
||||||
|
|
||||||
|
VOLUME /tmp
|
||||||
|
ADD target/*.jar app.jar
|
||||||
|
EXPOSE 8088
|
||||||
|
ENTRYPOINT ["java", "-jar", "/app.jar"]
|
||||||
14
pom.xml
14
pom.xml
@@ -12,7 +12,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>3.5.4</version>
|
<version>4.0.1</version>
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>com.onekeycall</groupId>
|
<groupId>com.onekeycall</groupId>
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
<url/>
|
<url/>
|
||||||
</scm>
|
</scm>
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>21</java.version>
|
<java.version>25</java.version>
|
||||||
<spring-cloud.version>2025.0.0</spring-cloud.version>
|
<spring-cloud.version>2025.0.0</spring-cloud.version>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@@ -89,8 +89,12 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-oauth2-client</artifactId>
|
<artifactId>spring-boot-starter-security-oauth2-client</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||||
|
<!-- <artifactId>spring-boot-starter-oauth2-client</artifactId>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
|
<artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
|
||||||
@@ -108,7 +112,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mybatis.spring.boot</groupId>
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
<version>3.0.3</version>
|
<version>4.0.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -200,7 +204,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.jsonwebtoken</groupId>
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
<artifactId>jjwt-jackson</artifactId>
|
<artifactId>jjwt-jackson</artifactId>
|
||||||
<version>0.12.3</version>
|
<version>0.12.6</version>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- 腾讯云短信服务 -->
|
<!-- 腾讯云短信服务 -->
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import org.springframework.context.annotation.Lazy;
|
|||||||
import org.springframework.security.authentication.AuthenticationManager;
|
import org.springframework.security.authentication.AuthenticationManager;
|
||||||
import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration;
|
import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration;
|
||||||
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
|
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
|
||||||
|
import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
|
||||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
@@ -18,7 +19,7 @@ import org.springframework.security.web.authentication.UsernamePasswordAuthentic
|
|||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableWebSecurity
|
@EnableWebSecurity
|
||||||
@EnableGlobalMethodSecurity(prePostEnabled = true)
|
@EnableMethodSecurity
|
||||||
public class SecurityConfig {
|
public class SecurityConfig {
|
||||||
|
|
||||||
private final JwtAuthenticationFilter jwtAuthenticationFilter; // 自定义的JWT认证过滤器
|
private final JwtAuthenticationFilter jwtAuthenticationFilter; // 自定义的JWT认证过滤器
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.onekeycall.videotablet.controller.sn;
|
package com.onekeycall.videotablet.controller.sn;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import com.onekeycall.videotablet.bean.ApkUploadRequest;
|
import com.onekeycall.videotablet.bean.ApkUploadRequest;
|
||||||
import com.onekeycall.videotablet.entity.ApkInfo;
|
import com.onekeycall.videotablet.entity.ApkInfo;
|
||||||
import com.onekeycall.videotablet.result.Result;
|
import com.onekeycall.videotablet.result.Result;
|
||||||
@@ -17,12 +16,6 @@ import java.util.List;
|
|||||||
public class DeviceApkInfoController {
|
public class DeviceApkInfoController {
|
||||||
static Logger logger = LoggerFactory.getLogger(DeviceApkInfoController.class);
|
static Logger logger = LoggerFactory.getLogger(DeviceApkInfoController.class);
|
||||||
|
|
||||||
private final ObjectMapper objectMapper; // Spring默认已注入
|
|
||||||
|
|
||||||
public DeviceApkInfoController(ObjectMapper objectMapper) {
|
|
||||||
this.objectMapper = objectMapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DeviceApkInfoService deviceApkInfoService;
|
private DeviceApkInfoService deviceApkInfoService;
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ import java.nio.charset.StandardCharsets;
|
|||||||
public class JwtAuthenticationFilter extends OncePerRequestFilter {
|
public class JwtAuthenticationFilter extends OncePerRequestFilter {
|
||||||
Logger logger = LoggerFactory.getLogger(JwtAuthenticationFilter.class);
|
Logger logger = LoggerFactory.getLogger(JwtAuthenticationFilter.class);
|
||||||
|
|
||||||
|
// 推荐的缓存上限:20480字节 = 20KB,Spring5.x的默认值
|
||||||
|
private static final int DEFAULT_CACHE_LIMIT = 20480;
|
||||||
|
|
||||||
private final UserService userService;
|
private final UserService userService;
|
||||||
|
|
||||||
private final JwtUtil jwtUtil;
|
private final JwtUtil jwtUtil;
|
||||||
@@ -44,7 +47,7 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
|
|||||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response,
|
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response,
|
||||||
FilterChain filterChain) throws ServletException, IOException {
|
FilterChain filterChain) throws ServletException, IOException {
|
||||||
// 使用ContentCachingRequestWrapper包装请求以支持多次读取
|
// 使用ContentCachingRequestWrapper包装请求以支持多次读取
|
||||||
ContentCachingRequestWrapper wrappedRequest = new ContentCachingRequestWrapper(request);
|
ContentCachingRequestWrapper wrappedRequest = new ContentCachingRequestWrapper(request, DEFAULT_CACHE_LIMIT);
|
||||||
|
|
||||||
String uripath = wrappedRequest.getRequestURI();
|
String uripath = wrappedRequest.getRequestURI();
|
||||||
// 新增请求路径日志
|
// 新增请求路径日志
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
spring.application.name=VideoTablet
|
spring.application.name=VideoTablet
|
||||||
server.port=8088
|
server.port=8088
|
||||||
|
|
||||||
|
spring.threads.virtual.enabled=true
|
||||||
|
|
||||||
## mysql 数据连接信息
|
## mysql 数据连接信息
|
||||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||||
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/video_tablet_db?useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
|
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/video_tablet_db?useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
|
||||||
@@ -23,11 +25,11 @@ spring.data.redis.lettuce.pool.max-wait=1ms
|
|||||||
spring.data.redis.lettuce.shutdown-timeout=100ms
|
spring.data.redis.lettuce.shutdown-timeout=100ms
|
||||||
|
|
||||||
#MongoDB
|
#MongoDB
|
||||||
spring.data.mongodb.uri=mongodb://fht:fanhuitong@139.199.77.221:27027/device_apks?authSource=admin&connectTimeoutMS=5000
|
spring.mongodb.uri=mongodb://fht:fanhuitong@139.199.77.221:27027/device_apks?authSource=admin&connectTimeoutMS=5000
|
||||||
|
|
||||||
# Hibernate配置
|
# Hibernate配置
|
||||||
#spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MariaDBDialect
|
#spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MariaDBDialect
|
||||||
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
|
#spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
|
||||||
spring.jpa.hibernate.ddl-auto=update
|
spring.jpa.hibernate.ddl-auto=update
|
||||||
spring.jpa.show-sql=true
|
spring.jpa.show-sql=true
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
spring.application.name=VideoTablet
|
spring.application.name=VideoTablet
|
||||||
server.port=8088
|
server.port=8088
|
||||||
|
|
||||||
|
spring.threads.virtual.enabled=true
|
||||||
|
|
||||||
## mysql 数据连接信息
|
## mysql 数据连接信息
|
||||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||||
spring.datasource.url=jdbc:mysql://139.199.77.221:13306/video_tablet_db?useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
|
spring.datasource.url=jdbc:mysql://139.199.77.221:13306/video_tablet_db?useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
|
||||||
@@ -23,11 +25,11 @@ spring.data.redis.lettuce.pool.max-wait=1ms
|
|||||||
spring.data.redis.lettuce.shutdown-timeout=100ms
|
spring.data.redis.lettuce.shutdown-timeout=100ms
|
||||||
|
|
||||||
#MongoDB
|
#MongoDB
|
||||||
spring.data.mongodb.uri=mongodb://fht:fanhuitong@139.199.77.221:27027/device_apks?authSource=admin&connectTimeoutMS=5000
|
spring.mongodb.uri=mongodb://fht:fanhuitong@139.199.77.221:27027/device_apks?authSource=admin&connectTimeoutMS=5000
|
||||||
|
|
||||||
# Hibernate配置
|
# Hibernate配置
|
||||||
#spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MariaDBDialect
|
#spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MariaDBDialect
|
||||||
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
|
#spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
|
||||||
spring.jpa.hibernate.ddl-auto=update
|
spring.jpa.hibernate.ddl-auto=update
|
||||||
spring.jpa.show-sql=true
|
spring.jpa.show-sql=true
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
spring.application.name=VideoTablet
|
spring.application.name=VideoTablet
|
||||||
server.port=8088
|
server.port=8088
|
||||||
|
|
||||||
## mysql 数据连接信息
|
spring.threads.virtual.enabled=true
|
||||||
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
|
||||||
#spring.datasource.url=jdbc:mysql://139.199.77.221:13306/video_tablet_db?useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
|
|
||||||
#spring.datasource.username=tt
|
|
||||||
#spring.datasource.password=fanhuitong
|
|
||||||
|
|
||||||
# PostgreSQL 数据源配置
|
# mysql 数据连接信息
|
||||||
spring.datasource.url=jdbc:postgresql://139.199.77.221:5433/video_tablet_db
|
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||||
spring.datasource.username=postgres
|
spring.datasource.url=jdbc:mysql://139.199.77.221:13306/video_tablet_db?useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
|
||||||
|
spring.datasource.username=tt
|
||||||
spring.datasource.password=fanhuitong
|
spring.datasource.password=fanhuitong
|
||||||
spring.datasource.driver-class-name=org.postgresql.Driver
|
|
||||||
|
## PostgreSQL 数据源配置
|
||||||
|
#spring.datasource.url=jdbc:postgresql://139.199.77.221:5433/video_tablet_db
|
||||||
|
#spring.datasource.username=postgres
|
||||||
|
#spring.datasource.password=fanhuitong
|
||||||
|
#spring.datasource.driver-class-name=org.postgresql.Driver
|
||||||
|
|
||||||
# redis基础配置
|
# redis基础配置
|
||||||
# 0也是默认值,表示你要操控的 Redis 上的哪个数据库
|
# 0也是默认值,表示你要操控的 Redis 上的哪个数据库
|
||||||
@@ -29,11 +31,11 @@ spring.data.redis.lettuce.pool.max-wait=1ms
|
|||||||
spring.data.redis.lettuce.shutdown-timeout=100ms
|
spring.data.redis.lettuce.shutdown-timeout=100ms
|
||||||
|
|
||||||
#MongoDB
|
#MongoDB
|
||||||
spring.data.mongodb.uri=mongodb://fht:fanhuitong@139.199.77.221:27027/device_apks?authSource=admin&connectTimeoutMS=5000
|
spring.mongodb.uri=mongodb://fht:fanhuitong@139.199.77.221:27027/device_apks?authSource=admin&connectTimeoutMS=5000
|
||||||
|
|
||||||
# Hibernate配置
|
# Hibernate配置
|
||||||
#spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MariaDBDialect
|
#spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MariaDBDialect
|
||||||
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
|
#spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
|
||||||
spring.jpa.hibernate.ddl-auto=update
|
spring.jpa.hibernate.ddl-auto=update
|
||||||
spring.jpa.show-sql=true
|
spring.jpa.show-sql=true
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user