没完成整改
This commit is contained in:
parent
830ea83dfa
commit
d6139a1c6b
17
pom.xml
17
pom.xml
|
|
@ -5,22 +5,21 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.chinaweal.youfool</groupId>
|
||||
<artifactId>prj-springboot-template</artifactId>
|
||||
<artifactId>youfool-prj-springboot-template</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<packaging>war</packaging>
|
||||
|
||||
<name>prj-springboot-template</name>
|
||||
<name>${project.artifactId}</name>
|
||||
<url>https://www.chinaweal.com.cn</url>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.2.6.RELEASE</version>
|
||||
<version>2.3.5.RELEASE</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<postgresql.version>42.2.8</postgresql.version>
|
||||
<easyexcel.version>2.2.2</easyexcel.version>
|
||||
<skipTests>true</skipTests>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
|
|
@ -32,7 +31,7 @@
|
|||
<dependency>
|
||||
<groupId>com.chinaweal.youfool</groupId>
|
||||
<artifactId>youfool-framework-springboot</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!--postgresql-->
|
||||
<dependency>
|
||||
|
|
@ -40,12 +39,6 @@
|
|||
<artifactId>postgresql</artifactId>
|
||||
<version>${postgresql.version}</version>
|
||||
</dependency>
|
||||
<!--druid-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>1.1.21</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
|
|
|
|||
|
|
@ -19,39 +19,38 @@ import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
|||
import javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
* youfool基础的数据源
|
||||
* cms基础的数据源
|
||||
*/
|
||||
|
||||
@Configuration
|
||||
@MapperScan(basePackages = "com.chinaweal.youfool.framework.springboot.**.mapper", sqlSessionTemplateRef = "youfoolSqlSessionTemplate")
|
||||
public class YoufoolDataSource {
|
||||
@MapperScan(basePackages = "com.chinaweal.youfool.framework.springboot.**.mapper", sqlSessionTemplateRef = "cmsSqlSessionTemplate")
|
||||
public class CmsDataSource {
|
||||
|
||||
|
||||
@Bean(name = "youfoolDS", initMethod = "init", destroyMethod = "close")
|
||||
@ConfigurationProperties(prefix = "spring.datasource.youfool")
|
||||
@Bean(name = "cmsDS", initMethod = "init", destroyMethod = "close")
|
||||
@ConfigurationProperties(prefix = "spring.datasource.cms")
|
||||
public DruidDataSource dataSource() {
|
||||
return DruidDataSourceBuilder.create().build();
|
||||
}
|
||||
|
||||
@Bean(name = "youfoolSqlSessionFactory")
|
||||
public MybatisSqlSessionFactoryBean sqlSessionFactory(@Qualifier("youfoolDS") DataSource dataSource) throws Exception {
|
||||
@Bean(name = "cmsSqlSessionFactory")
|
||||
public MybatisSqlSessionFactoryBean sqlSessionFactory(@Qualifier("cmsDS") DataSource dataSource) throws Exception {
|
||||
MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();
|
||||
bean.setDataSource(dataSource);
|
||||
GlobalConfig globalConfig = new GlobalConfig();
|
||||
globalConfig.setMetaObjectHandler(new CommonMetaObjectHandler());
|
||||
bean.setGlobalConfig(globalConfig);
|
||||
bean.setConfigLocation(new ClassPathResource("youfool/mybatis/mybatis-config.xml"));
|
||||
bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:youfool/mybatis/mapper/**/*.xml"));
|
||||
bean.setConfigLocation(new ClassPathResource("cms/mybatis/mybatis-config.xml"));
|
||||
bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:cms/mybatis/mapper/**/*.xml"));
|
||||
return bean;
|
||||
}
|
||||
|
||||
@Bean(name = "youfoolTransactionManager")
|
||||
public DataSourceTransactionManager transactionManager(@Qualifier("youfoolDS") DataSource dataSource) {
|
||||
@Bean(name = "cmsTransactionManager")
|
||||
public DataSourceTransactionManager transactionManager(@Qualifier("cmsDS") DataSource dataSource) {
|
||||
return new DataSourceTransactionManager(dataSource);
|
||||
}
|
||||
|
||||
@Bean(name = "youfoolSqlSessionTemplate")
|
||||
public SqlSessionTemplate sqlSessionTemplate(@Qualifier("youfoolSqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
|
||||
@Bean(name = "cmsSqlSessionTemplate")
|
||||
public SqlSessionTemplate sqlSessionTemplate(@Qualifier("cmsSqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
|
||||
return new SqlSessionTemplate(sqlSessionFactory);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
package com.chinaweal.youfool.prj.config;
|
||||
|
||||
import com.chinaweal.youfool.framework.springboot.filter.RepeatlyReadFilter;
|
||||
import com.chinaweal.youfool.framework.springboot.log.filter.RestLogFilter;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author itluck
|
||||
*/
|
||||
@Configuration
|
||||
public class FilterConfig {
|
||||
/**
|
||||
* 日志记录过滤器
|
||||
*/
|
||||
@Bean
|
||||
public FilterRegistrationBean<RestLogFilter> restLogFilter() {
|
||||
FilterRegistrationBean<RestLogFilter> registrationBean = new FilterRegistrationBean<>();
|
||||
registrationBean.setFilter(new RestLogFilter());
|
||||
registrationBean.addUrlPatterns("/*");
|
||||
registrationBean.setName("restLogFilter");
|
||||
registrationBean.setOrder(-99);
|
||||
return registrationBean;
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启重复读取request流,用于日志
|
||||
*/
|
||||
@Bean
|
||||
public FilterRegistrationBean<RepeatlyReadFilter> repeatlyReadFilter() {
|
||||
FilterRegistrationBean<RepeatlyReadFilter> registrationBean = new FilterRegistrationBean<>();
|
||||
registrationBean.setFilter(new RepeatlyReadFilter());
|
||||
registrationBean.addUrlPatterns("/*");
|
||||
registrationBean.setName("repeatlyReadFilter");
|
||||
registrationBean.setOrder(-100);
|
||||
return registrationBean;
|
||||
}
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@ import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
|||
import javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
* 系统的数据源
|
||||
* 项目的数据源
|
||||
*/
|
||||
|
||||
@Configuration
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import java.util.Map;
|
|||
/**
|
||||
* shiro配置
|
||||
*/
|
||||
@Configuration
|
||||
//@Configuration
|
||||
public class ShiroConfig {
|
||||
|
||||
@Bean
|
||||
|
|
|
|||
|
|
@ -1,27 +1,20 @@
|
|||
package com.chinaweal.youfool.prj.config;
|
||||
|
||||
import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.ParameterBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.schema.ModelRef;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.service.Contact;
|
||||
import springfox.documentation.service.Parameter;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Configuration
|
||||
@EnableSwagger2
|
||||
@EnableKnife4j
|
||||
@EnableSwagger2WebMvc
|
||||
public class SwaggerKnife4j {
|
||||
@Value("${applicationName}")
|
||||
private String applicationName;
|
||||
|
|
@ -32,8 +25,8 @@ public class SwaggerKnife4j {
|
|||
@Value("${license}")
|
||||
private String license;
|
||||
|
||||
@Bean("youfool")
|
||||
public Docket youfoolApi() {
|
||||
@Bean("cms")
|
||||
public Docket cmsApi() {
|
||||
//添加head参数start
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.enable(true)
|
||||
|
|
@ -45,7 +38,6 @@ public class SwaggerKnife4j {
|
|||
.build();
|
||||
}
|
||||
|
||||
|
||||
private ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
.title(applicationName)
|
||||
|
|
@ -57,4 +49,5 @@ public class SwaggerKnife4j {
|
|||
.licenseUrl("https://www.chinaweal.com.cn")
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -7,10 +7,10 @@ logging:
|
|||
spring:
|
||||
datasource:
|
||||
prj:
|
||||
url: jdbc:postgresql://172.22.80.157:5432/pms_dev
|
||||
url: jdbc:postgresql://172.22.80.157:5432/prj_template
|
||||
username: postgres
|
||||
password: 123456
|
||||
youfool:
|
||||
url: jdbc:postgresql://172.22.80.157:5432/pms_dev?currentSchema=youfool
|
||||
cms:
|
||||
url: jdbc:postgresql://172.22.80.157:5432/prj_template?currentSchema=cms
|
||||
username: postgres
|
||||
password: 123456
|
||||
|
|
@ -5,7 +5,7 @@ spring:
|
|||
profiles:
|
||||
active: dev
|
||||
application:
|
||||
name: prj-springboot-template
|
||||
name: youfool-prj-springboot-template
|
||||
datasource:
|
||||
#https://gitee.com/wenshao/druid/tree/master/druid-spring-boot-starter
|
||||
#https://github.com/alibaba/druid/wiki/DruidDataSource%E9%85%8D%E7%BD%AE
|
||||
|
|
@ -18,7 +18,7 @@ spring:
|
|||
time-between-eviction-runs-millis: 60000
|
||||
min-evictable-idle-time-millis: 300000
|
||||
validation-query: select version()
|
||||
youfool:
|
||||
cms:
|
||||
filters: stat
|
||||
initial-size: 2
|
||||
min-idle: 1
|
||||
|
|
@ -53,7 +53,8 @@ jwt:
|
|||
sm3:
|
||||
secret: 82b0832fdaac473b83225ab92e7e3c3d
|
||||
|
||||
#knife4j:
|
||||
knife4j:
|
||||
enable: true
|
||||
# production: false
|
||||
# basic:
|
||||
# enable: true
|
||||
|
|
|
|||
Loading…
Reference in New Issue