Commit 6648d7522c4969fc2a51ae03f7812b0f39fdb4dc
1 parent
8f62499f
job
Showing
3 changed files
with
6 additions
and
0 deletions
src/main/java/com/cnlive/shenhe/ShenheApplication.java
| ... | ... | @@ -19,6 +19,7 @@ import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerF |
| 19 | 19 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; |
| 20 | 20 | import org.springframework.context.annotation.Bean; |
| 21 | 21 | import org.springframework.context.annotation.Configuration; |
| 22 | +import org.springframework.scheduling.annotation.EnableAsync; | |
| 22 | 23 | import org.springframework.stereotype.Controller; |
| 23 | 24 | import tk.mybatis.spring.annotation.MapperScan; |
| 24 | 25 | |
| ... | ... | @@ -29,6 +30,7 @@ import java.util.Map; |
| 29 | 30 | |
| 30 | 31 | @SpringBootApplication |
| 31 | 32 | @MapperScan(basePackages = {"com.cnlive.shenhe.mapper"}) |
| 33 | +@EnableAsync | |
| 32 | 34 | public class ShenheApplication extends SpringBootServletInitializer { |
| 33 | 35 | /** |
| 34 | 36 | * url的前缀 | ... | ... |
src/main/java/com/cnlive/shenhe/job/LiveApplyJob.java
| ... | ... | @@ -16,6 +16,7 @@ import org.slf4j.Logger; |
| 16 | 16 | import org.slf4j.LoggerFactory; |
| 17 | 17 | import org.springframework.beans.factory.annotation.Autowired; |
| 18 | 18 | import org.springframework.beans.factory.annotation.Value; |
| 19 | +import org.springframework.scheduling.annotation.Async; | |
| 19 | 20 | import org.springframework.scheduling.annotation.Scheduled; |
| 20 | 21 | import org.springframework.stereotype.Component; |
| 21 | 22 | import tk.mybatis.mapper.entity.Example; |
| ... | ... | @@ -29,6 +30,7 @@ import java.util.Map; |
| 29 | 30 | * @author Administrator |
| 30 | 31 | */ |
| 31 | 32 | @Component |
| 33 | +@Async | |
| 32 | 34 | public class LiveApplyJob { |
| 33 | 35 | |
| 34 | 36 | private static Logger logger = LoggerFactory.getLogger(LiveApplyJob.class); | ... | ... |
src/main/java/com/cnlive/shenhe/job/VideosJob.java
| ... | ... | @@ -7,6 +7,7 @@ import com.cnlive.shenhe.utils.CommonConstStates; |
| 7 | 7 | import org.slf4j.Logger; |
| 8 | 8 | import org.slf4j.LoggerFactory; |
| 9 | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 10 | +import org.springframework.scheduling.annotation.Async; | |
| 10 | 11 | import org.springframework.scheduling.annotation.Scheduled; |
| 11 | 12 | import org.springframework.stereotype.Component; |
| 12 | 13 | |
| ... | ... | @@ -16,6 +17,7 @@ import java.util.List; |
| 16 | 17 | * @author Administrator |
| 17 | 18 | */ |
| 18 | 19 | @Component |
| 20 | +@Async | |
| 19 | 21 | public class VideosJob { |
| 20 | 22 | |
| 21 | 23 | private static Logger logger = LoggerFactory.getLogger(VideosJob.class); | ... | ... |