Showing
6 changed files
with
148 additions
and
0 deletions
.gitignore
0 → 100644
Dockerfile
0 → 100644
pom.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
| 3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| 4 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| 5 | + <modelVersion>4.0.0</modelVersion> | ||
| 6 | + | ||
| 7 | + <groupId>org.example</groupId> | ||
| 8 | + <artifactId>massSync</artifactId> | ||
| 9 | + <version>1.0-SNAPSHOT</version> | ||
| 10 | + <parent> | ||
| 11 | + <groupId>org.springframework.boot</groupId> | ||
| 12 | + <artifactId>spring-boot-starter-parent</artifactId> | ||
| 13 | + <version>2.7.0</version> | ||
| 14 | + </parent> | ||
| 15 | + | ||
| 16 | + <properties> | ||
| 17 | + <java.version>1.8</java.version> | ||
| 18 | + </properties> | ||
| 19 | + | ||
| 20 | + <dependencies> | ||
| 21 | + <!-- Spring Boot Web --> | ||
| 22 | + <dependency> | ||
| 23 | + <groupId>org.springframework.boot</groupId> | ||
| 24 | + <artifactId>spring-boot-starter-web</artifactId> | ||
| 25 | + </dependency> | ||
| 26 | + | ||
| 27 | + <!-- Spring Boot JPA --> | ||
| 28 | + <dependency> | ||
| 29 | + <groupId>org.springframework.boot</groupId> | ||
| 30 | + <artifactId>spring-boot-starter-data-jpa</artifactId> | ||
| 31 | + </dependency> | ||
| 32 | + | ||
| 33 | + <!-- MySQL Connector --> | ||
| 34 | + <dependency> | ||
| 35 | + <groupId>mysql</groupId> | ||
| 36 | + <artifactId>mysql-connector-java</artifactId> | ||
| 37 | + <version>8.0.24</version> | ||
| 38 | + </dependency> | ||
| 39 | + | ||
| 40 | + <!-- Lombok --> | ||
| 41 | + <dependency> | ||
| 42 | + <groupId>org.projectlombok</groupId> | ||
| 43 | + <artifactId>lombok</artifactId> | ||
| 44 | + <optional>true</optional> | ||
| 45 | + </dependency> | ||
| 46 | + | ||
| 47 | + <!-- Test --> | ||
| 48 | + <dependency> | ||
| 49 | + <groupId>org.springframework.boot</groupId> | ||
| 50 | + <artifactId>spring-boot-starter-test</artifactId> | ||
| 51 | + <scope>test</scope> | ||
| 52 | + </dependency> | ||
| 53 | + </dependencies> | ||
| 54 | + | ||
| 55 | + <build> | ||
| 56 | + <plugins> | ||
| 57 | + <plugin> | ||
| 58 | + <groupId>org.springframework.boot</groupId> | ||
| 59 | + <artifactId>spring-boot-maven-plugin</artifactId> | ||
| 60 | + <configuration> | ||
| 61 | + <excludes> | ||
| 62 | + <exclude> | ||
| 63 | + <groupId>org.projectlombok</groupId> | ||
| 64 | + <artifactId>lombok</artifactId> | ||
| 65 | + </exclude> | ||
| 66 | + </excludes> | ||
| 67 | + </configuration> | ||
| 68 | + </plugin> | ||
| 69 | + <plugin> | ||
| 70 | + <groupId>org.apache.maven.plugins</groupId> | ||
| 71 | + <artifactId>maven-compiler-plugin</artifactId> | ||
| 72 | + <configuration> | ||
| 73 | + <source>8</source> | ||
| 74 | + <target>8</target> | ||
| 75 | + </configuration> | ||
| 76 | + </plugin> | ||
| 77 | + </plugins> | ||
| 78 | + </build> | ||
| 79 | +</project> |
| 1 | +package com.mass; | ||
| 2 | + | ||
| 3 | +import org.springframework.boot.SpringApplication; | ||
| 4 | +import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
| 5 | +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; | ||
| 6 | +import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; | ||
| 7 | + | ||
| 8 | +@SpringBootApplication(exclude = { | ||
| 9 | + DataSourceAutoConfiguration.class, | ||
| 10 | + DataSourceTransactionManagerAutoConfiguration.class | ||
| 11 | +}) | ||
| 12 | +public class MassSyncApplication { | ||
| 13 | + public static void main(String[] args) { | ||
| 14 | + SpringApplication.run(MassSyncApplication.class, args); | ||
| 15 | + } | ||
| 16 | +} |
| 1 | +package com.mass.config; | ||
| 2 | + | ||
| 3 | +import org.springframework.context.annotation.Bean; | ||
| 4 | +import org.springframework.context.annotation.Configuration; | ||
| 5 | +import org.springframework.scheduling.annotation.EnableScheduling; | ||
| 6 | +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | ||
| 7 | + | ||
| 8 | +@Configuration | ||
| 9 | +@EnableScheduling | ||
| 10 | +public class TaskExecutorConfig { | ||
| 11 | + @Bean | ||
| 12 | + public ThreadPoolTaskExecutor taskExecutor() { | ||
| 13 | + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); | ||
| 14 | + executor.setCorePoolSize(10); | ||
| 15 | + executor.setMaxPoolSize(50); | ||
| 16 | + executor.setQueueCapacity(1000); | ||
| 17 | + executor.setKeepAliveSeconds(60); | ||
| 18 | + executor.setThreadNamePrefix("task-executor-"); | ||
| 19 | + return executor; | ||
| 20 | + } | ||
| 21 | +} |
| 1 | +package com.mass.service; | ||
| 2 | + | ||
| 3 | +import lombok.extern.slf4j.Slf4j; | ||
| 4 | +import org.springframework.scheduling.annotation.Scheduled; | ||
| 5 | +import org.springframework.stereotype.Service; | ||
| 6 | + | ||
| 7 | +@Service | ||
| 8 | +@Slf4j | ||
| 9 | +public class UserSyncService { | ||
| 10 | + @Scheduled(cron = "*/5 * * * * ?") | ||
| 11 | + public void snyc(){ | ||
| 12 | + log.info("test"); | ||
| 13 | + } | ||
| 14 | +} |