瞎几把改

master
luffy9412 7 years ago
parent b24f09407c
commit b37a69803f
  1. 4
      core/pom.xml
  2. 0
      core/src/main/java/org/pqh/core/annotation/EnableWebCrawlerConfiguration.java
  3. 0
      core/src/main/java/org/pqh/core/aop/InsertAdvice.java
  4. 0
      core/src/main/java/org/pqh/core/aop/InsertAdvisor.java
  5. 0
      core/src/main/java/org/pqh/core/aop/LogAspect.java
  6. 0
      core/src/main/java/org/pqh/core/aop/MatcherRule.java
  7. 19
      core/src/main/java/org/pqh/core/config/HibernateConfig.java
  8. 0
      core/src/main/java/org/pqh/core/dao/BaseDao.java
  9. 0
      core/src/main/java/org/pqh/core/model/AbstractModel.java
  10. 0
      core/src/main/java/org/pqh/core/model/Config.java
  11. 0
      core/src/main/java/org/pqh/core/model/Param.java
  12. 0
      core/src/main/java/org/pqh/core/service/BaseService.java
  13. 0
      core/src/main/java/org/pqh/core/util/DBAction.java
  14. 0
      core/src/main/java/org/pqh/core/util/PropertiesUtil.java
  15. 12
      pom.xml
  16. 13
      web/pom.xml
  17. 0
      web/src/main/java/org/pqh/achieve/config/AbstractWebConfig.java
  18. 4
      web/src/main/java/org/pqh/achieve/config/SpringConfig.java
  19. 0
      web/src/main/java/org/pqh/achieve/config/WebConfigImpl.java
  20. 0
      web/src/main/java/org/pqh/achieve/config/WebCrawlerConfig.java
  21. 0
      web/src/main/java/org/pqh/achieve/controller/AdminController.java
  22. 0
      web/src/main/java/org/pqh/achieve/controller/BaseController.java
  23. 0
      web/src/main/java/org/pqh/achieve/controller/ConfigController.java
  24. 0
      web/src/main/java/org/pqh/achieve/controller/ParamController.java
  25. 2
      web/src/main/resources/config.properties
  26. 0
      web/src/main/resources/log4j2.xml
  27. 0
      web/src/main/webapp/WEB-INF/jsp/index.jsp

@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent> <parent>
<artifactId>webCrawler</artifactId> <artifactId>webcrawler</artifactId>
<groupId>org.pqh</groupId> <groupId>org.pqh</groupId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</parent> </parent>
@ -9,7 +9,7 @@
<artifactId>core</artifactId> <artifactId>core</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>core Maven Webapp</name> <name>core Maven Webapp</name>
<url>https://gitee.com/WuXianChaoPin/webCrawler</url> <url>https://gitee.com/WuXianChaoPin/webcrawler</url>
<dependencies> <dependencies>

@ -1,9 +1,13 @@
package org.pqh.core.config; package org.pqh.core.config;
import org.apache.commons.dbcp2.BasicDataSource; import org.apache.commons.dbcp2.BasicDataSource;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.pqh.core.util.PropertiesUtil; import org.pqh.core.util.PropertiesUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.orm.hibernate5.HibernateTemplate; import org.springframework.orm.hibernate5.HibernateTemplate;
import org.springframework.orm.hibernate5.HibernateTransactionManager; import org.springframework.orm.hibernate5.HibernateTransactionManager;
import org.springframework.orm.hibernate5.LocalSessionFactoryBean; import org.springframework.orm.hibernate5.LocalSessionFactoryBean;
@ -16,19 +20,24 @@ import java.util.Properties;
* Created by reborn on 2017/7/28. * Created by reborn on 2017/7/28.
*/ */
@Configuration @Configuration
@PropertySource("classpath:config.properties")
@EnableTransactionManagement @EnableTransactionManagement
public class HibernateConfig { public class HibernateConfig {
private LocalSessionFactoryBean sessionFactoryBean; private LocalSessionFactoryBean sessionFactoryBean;
private BasicDataSource dataSource; private BasicDataSource dataSource;
Properties properties = PropertiesUtil.loadPropertiesFromResourceFile("config.properties"); private Logger log= LogManager.getLogger();
@Value("${dbcp2.url}")
private String url;
@Value("${dbcp2.username}")
private String username;
@Value("${dbcp2.password}")
private String password;
public HibernateConfig() { public HibernateConfig() {
log.info("数据库配置初始化\ndburl="+url+",dbcp2.username="+username+",dbcp2.password="+password);
dataSource = new BasicDataSource(); dataSource = new BasicDataSource();
dataSource.setUrl(properties.getProperty("dbcp2.url"));
dataSource.setUsername(properties.getProperty("dbcp2.username"));
dataSource.setPassword(properties.getProperty("dbcp2.password"));
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
sessionFactoryBean = new LocalSessionFactoryBean(); sessionFactoryBean = new LocalSessionFactoryBean();
sessionFactoryBean.setDataSource(dataSource); sessionFactoryBean.setDataSource(dataSource);

@ -2,15 +2,15 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.pqh</groupId> <groupId>org.pqh</groupId>
<artifactId>webCrawler</artifactId> <artifactId>webcrawler</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<modules> <modules>
<module>webCrawler-core</module> <module>core</module>
<module>webCrawler-achieve</module> <module>web</module>
</modules> </modules>
<name>webCrawler Maven Webapp</name> <name>webcrawler Maven Webapp</name>
<url>https://gitee.com/WuXianChaoPin/webCrawler</url> <url>https://gitee.com/WuXianChaoPin/webcrawler</url>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@ -120,7 +120,7 @@
</dependencyManagement> </dependencyManagement>
<build> <build>
<finalName>webCrawler</finalName> <finalName>webcrawler</finalName>
<plugins> <plugins>
<plugin> <plugin>
<artifactId>maven-war-plugin</artifactId> <artifactId>maven-war-plugin</artifactId>

@ -1,15 +1,15 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent> <parent>
<artifactId>webCrawler</artifactId> <artifactId>webcrawler</artifactId>
<groupId>org.pqh</groupId> <groupId>org.pqh</groupId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>achieve</artifactId> <artifactId>web</artifactId>
<packaging>war</packaging> <packaging>war</packaging>
<name>achieve Maven Webapp</name> <name>achieve Maven Webapp</name>
<url>https://gitee.com/WuXianChaoPin/webCrawler</url> <url>https://gitee.com/WuXianChaoPin/webcrawler</url>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.pqh</groupId> <groupId>org.pqh</groupId>
@ -88,8 +88,13 @@
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.pqh</groupId>
<artifactId>core</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>achieve</finalName> <finalName>web</finalName>
</build> </build>
</project> </project>

@ -1,5 +1,6 @@
package org.pqh.achieve.config; package org.pqh.achieve.config;
import org.pqh.core.annotation.EnableWebCrawlerConfiguration;
import org.pqh.core.config.HibernateConfig; import org.pqh.core.config.HibernateConfig;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.*; import org.springframework.context.annotation.*;
@ -12,9 +13,8 @@ import org.springframework.web.servlet.view.InternalResourceViewResolver;
*/ */
@Configuration @Configuration
@EnableWebMvc @EnableWebMvc
@ComponentScan(basePackages = "org.pqh")
@EnableAspectJAutoProxy @EnableAspectJAutoProxy
@Import(HibernateConfig.class) @Import({HibernateConfig.class,WebCrawlerConfig.class})
public class SpringConfig extends WebMvcConfigurationSupport{ public class SpringConfig extends WebMvcConfigurationSupport{
private static ApplicationContext applicationContext; private static ApplicationContext applicationContext;

@ -1,6 +1,6 @@
#dbcp2.url=jdbc:mysql://localhost:3306/bilibili?serverTimezone=UTC&&useSSL=true #dbcp2.url=jdbc:mysql://localhost:3306/bilibili?serverTimezone=UTC&&useSSL=true
#dbcp2.username=root #dbcp2.username=root
#dbcp2.password=123456 #dbcp2.password=123456
dbcp2.url=jdbc:mysql://172.16.0.50:3306/bb?serverTimezone=UTC&&useSSL=true dbcp2.url=jdbc:mysql://localhost:3306/bilibili?serverTimezone=UTC&&useSSL=true
dbcp2.username=root dbcp2.username=root
dbcp2.password=123456 dbcp2.password=123456
Loading…
Cancel
Save