Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change all needed jars from maven and add jdbc.properties #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v8.0"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0"/>
<classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/json-lib-2.4-jdk15.jar" sourcepath="E:/web/开发库/json-lib-2.4-jdk15-sources.jar"/>
<classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/json.jar"/>
<classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/ueditor-1.1.2.jar"/>
Expand Down
93 changes: 65 additions & 28 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,43 @@
<artifactId>Blog</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<properties>
<!-- spring版本号 -->
<spring.version>4.2.8.RELEASE</spring.version>
<!-- junit版本号 -->
<junit.version>4.10</junit.version>
<!-- mybatis版本号 -->
<mybatis.version>3.2.8</mybatis.version>

<mysql.version>5.1.40</mysql.version>

<javaee.version>6.0</javaee.version>
<!-- druid版本号 -->
<druid-version>1.0.20</druid-version>

<fastjson.version>1.2.20</fastjson.version>
<!-- Shiro -->
<Shiro.version>1.2.5</Shiro.version>
<!-- lucene -->
<lucene.version>5.3.1</lucene.version>
<jsoup.version>1.9.2</jsoup.version>
<jsp.version>2.3.1</jsp.version>
</properties>

<dependencies>

<!-- 添加sevlet支持 -->
<dependency>
<!-- <dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
</dependency> -->
<!-- 添加jsp支持 -->
<dependency>
<!-- <dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.1</version>
</dependency>
<version>${jsp.version}</version>
</dependency> -->
<!-- 添加jstl支持 -->
<dependency>
<groupId>javax.servlet</groupId>
Expand All @@ -31,60 +53,60 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.3.0.RELEASE</version>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.3.0.RELEASE</version>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.3.0.RELEASE</version>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>4.3.0.RELEASE</version>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.3.0.RELEASE</version>
<version>${spring.version}</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.3.0.RELEASE</version>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>4.3.0.RELEASE</version>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>4.3.0.RELEASE</version>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>4.3.0.RELEASE</version>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>4.3.0.RELEASE</version>
<version>${spring.version}</version>
</dependency>

<!-- 添加mybatis支持 -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.4.0</version>
<version>${mybatis.version}</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
Expand All @@ -96,14 +118,14 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.30</version>
<version>${mysql.version}</version>
</dependency>

<!-- 添加阿里巴巴连接池Druid支持 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.0.16</version>
<version>${druid-version}</version>
</dependency>

<!-- 添加log4j日志 -->
Expand All @@ -122,44 +144,44 @@
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
<version>1.2.5</version>
<version>${Shiro.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-web</artifactId>
<version>1.2.5</version>
<version>${Shiro.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring</artifactId>
<version>1.2.5</version>
<version>${Shiro.version}</version>
</dependency>

<!-- 添加lucene支持 -->
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
<version>5.3.1</version>
<version>${lucene.version}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-queryparser</artifactId>
<version>5.3.1</version>
<version>${lucene.version}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers-common</artifactId>
<version>5.3.1</version>
<version>${lucene.version}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-highlighter</artifactId>
<version>5.3.1</version>
<version>${lucene.version}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers-smartcn</artifactId>
<version>5.3.1</version>
<version>${lucene.version}</version>
</dependency>

<!-- apache共公包 -->
Expand Down Expand Up @@ -206,16 +228,31 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>

<!-- 添加jsoup支持 -->
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.9.2</version>
<version>${jsoup.version}</version>
</dependency>
<dependency>
<groupId>cn.songxinqiang</groupId>
<artifactId>com.baidu.ueditor</artifactId>
<version>1.1.2-offical</version>
</dependency>
<dependency>
<groupId>com.hynnet</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20151123</version>
</dependency>
</dependencies>
<build>
<finalName>Blog</finalName>
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/ssm/blog/controller/IndexController.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,11 @@ public ModelAndView index(
return modelAndView;

}
/*
* ��̨��ַ�ض���
*/
@RequestMapping("/admin")
public String admin(){
return "redirect:/admin/main.jsp";
}
}
8 changes: 5 additions & 3 deletions src/main/java/ssm/blog/listener/InitBloggerData.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ public void contextInitialized(ServletContextEvent sce) {
//��ȡ������Ϣ
Blogger blogger = bloggerService.getBloggerData();
//��������Ҳ��ȡ���ˣ��Ƚ����У�����Ҳ����Ҫ��������԰�������յ�
blogger.setPassword(null);
//��������Ϣ����application����
application.setAttribute("blogger", blogger);
if (null != blogger) {
blogger.setPassword(null);
//��������Ϣ����application����
application.setAttribute("blogger", blogger);
}

//ͬ�ϣ���ȡ����������Ϣ
LinkService linkService = (LinkService) applicationContext.getBean("linkService");
Expand Down
30 changes: 25 additions & 5 deletions src/main/resources/applicationContext.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,32 @@

<!-- 自动扫描包中的bean -->
<context:component-scan base-package="ssm.blog.*" />

<!-- 加载配置文件 -->
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath*:jdbc.properties</value>
</list>
</property>
</bean>
<!-- 配置数据源,使用阿里巴巴连接池Druid -->
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
<property name="url" value="jdbc:mysql://localhost:3306/db_blog"/>
<property name="username" value="root"/>
<property name="password" value="root"/>
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.user}" />
<property name="password" value="${jdbc.password}" />
<property name="filters" value="stat" />
<property name="maxActive" value="20" />
<property name="initialSize" value="1" />
<property name="maxWait" value="60000" />
<property name="minIdle" value="1" />
<property name="timeBetweenEvictionRunsMillis" value="60000" />
<property name="minEvictableIdleTimeMillis" value="300000" />
<property name="testWhileIdle" value="true" />
<property name="testOnBorrow" value="false" />
<property name="testOnReturn" value="false" />
<property name="poolPreparedStatements" value="true" />
<property name="maxOpenPreparedStatements" value="20" />
</bean>

<!-- 配置mybatis的sqlSessionFactory -->
Expand Down Expand Up @@ -61,7 +81,7 @@
<!-- 身份认证失败,则跳转到登录页面的配置 -->
<property name="loginUrl" value="/login.jsp" />
<!-- 权限认证失败,则跳转到指定页面,因为个人博客就一个人登陆,就不需要权限了 -->
<!-- <property name="unauthorizedUrl" value="/unauthorized.jsp" /> -->
<!-- <property name="unauthorizedUrl" value="/unauthorized.jsp" /> -->
<!-- Shiro连接约束配置,即过滤链的定义 -->
<property name="filterChainDefinitions">
<value>
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/jdbc.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
jdbc.url=jdbc:mysql://127.0.0.1:3306/db_blog
jdbc.user=root
jdbc.password=
4 changes: 2 additions & 2 deletions src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>Blog</display-name>
<welcome-file-list>
<welcome-file>a.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>

<!-- spring监听器 -->
Expand Down Expand Up @@ -33,7 +33,7 @@
</servlet>
<servlet-mapping>
<servlet-name>springMVC</servlet-name>
<url-pattern>*.do</url-pattern>
<url-pattern>/</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>springMVC</servlet-name>
Expand Down
30 changes: 25 additions & 5 deletions target/classes/applicationContext.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,32 @@

<!-- 自动扫描包中的bean -->
<context:component-scan base-package="ssm.blog.*" />

<!-- 加载配置文件 -->
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath*:jdbc.properties</value>
</list>
</property>
</bean>
<!-- 配置数据源,使用阿里巴巴连接池Druid -->
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
<property name="url" value="jdbc:mysql://localhost:3306/db_blog"/>
<property name="username" value="root"/>
<property name="password" value="root"/>
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.user}" />
<property name="password" value="${jdbc.password}" />
<property name="filters" value="stat" />
<property name="maxActive" value="20" />
<property name="initialSize" value="1" />
<property name="maxWait" value="60000" />
<property name="minIdle" value="1" />
<property name="timeBetweenEvictionRunsMillis" value="60000" />
<property name="minEvictableIdleTimeMillis" value="300000" />
<property name="testWhileIdle" value="true" />
<property name="testOnBorrow" value="false" />
<property name="testOnReturn" value="false" />
<property name="poolPreparedStatements" value="true" />
<property name="maxOpenPreparedStatements" value="20" />
</bean>

<!-- 配置mybatis的sqlSessionFactory -->
Expand Down Expand Up @@ -61,7 +81,7 @@
<!-- 身份认证失败,则跳转到登录页面的配置 -->
<property name="loginUrl" value="/login.jsp" />
<!-- 权限认证失败,则跳转到指定页面,因为个人博客就一个人登陆,就不需要权限了 -->
<!-- <property name="unauthorizedUrl" value="/unauthorized.jsp" /> -->
<!-- <property name="unauthorizedUrl" value="/unauthorized.jsp" /> -->
<!-- Shiro连接约束配置,即过滤链的定义 -->
<property name="filterChainDefinitions">
<value>
Expand Down
Binary file modified target/classes/ssm/blog/controller/IndexController.class
Binary file not shown.
Binary file modified target/classes/ssm/blog/listener/InitBloggerData.class
Binary file not shown.