| | |
| | | import org.springframework.context.event.ContextRefreshedEvent; |
| | | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| | | import org.yeshi.utils.mq.JobThreadExecutorServiceImpl; |
| | | import org.yeshi.utils.tencentcloud.COSManager; |
| | | import org.yeshi.utils.tencentcloud.entity.COSInitParams; |
| | | |
| | | import java.util.Properties; |
| | | |
| | | //不引入数据库 |
| | | //@SpringBootApplication(exclude= {DataSourceAutoConfiguration.class,DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class |
| | | // , DruidDataSourceAutoConfigure.class, HibernateJpaAutoConfiguration.class}) |
| | |
| | | @Override |
| | | public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) { |
| | | logger.info("容器加载完毕"); |
| | | initCOS(); |
| | | initMQMsgConsumer(); |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 对象存储初始化 |
| | | */ |
| | | public static void initCOS() { |
| | | // 载入cos参数 |
| | | Properties ps = org.yeshi.utils.PropertiesUtil |
| | | .getProperties(Application.class.getClassLoader().getResourceAsStream("cos.properties")); |
| | | COSInitParams params = new COSInitParams(); |
| | | params.setAppId(Long.parseLong(ps.getProperty("appId"))); |
| | | params.setBucketName(ps.getProperty("bucketName")); |
| | | params.setRegion(ps.getProperty("region")); |
| | | params.setSecretId(ps.getProperty("secretId")); |
| | | params.setSecretKey(ps.getProperty("secretKey")); |
| | | // 初始化 |
| | | COSManager.getInstance().init(params); |
| | | } |
| | | |
| | | |
| | | } |