springboot用法和与各种框架、组件等结合使用,包括springboot的注解分析、路径分析、取得内置对象、项目打包、配置环境属性、读取资源文件、Bean配置、模板渲染、基于yml的多profile配置、基于properties的多profile、添加数据验证、配置错误页、全局异常处理、配置Tomcat运行、配置https访问路径、信息显示、内置对象、显示对象信息、文件上传、使用文件服务器、拦截器、配置druid数据库连接池、整合MyBatis框架、事务控制、Druid监控、整合ActiveMQ、整合RabbitMQ、整合kafka、邮件发送、定时调度、Actuator监控、整合Redis数据库、整合Restfui框架、整合Shiro
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
Manifest-Version: 1.0
|
||||
Built-By: foreveriss
|
||||
Build-Jdk: 1.8.0_121
|
||||
Created-By: Maven Integration for Eclipse
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
#Generated by Maven Integration for Eclipse
|
||||
#Thu Jun 29 23:44:57 CST 2017
|
||||
version=0.0.1-SNAPSHOT
|
||||
groupId=cn.mldn
|
||||
m2e.projectName=microboot-activemq
|
||||
m2e.projectLocation=/Users/foreveriss/workspace/microboot/microboot-activemq
|
||||
artifactId=microboot-activemq
|
||||
@@ -0,0 +1,72 @@
|
||||
<?xml version="1.0"?>
|
||||
<project
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>cn.mldn</groupId>
|
||||
<artifactId>microboot</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>microboot-activemq</artifactId>
|
||||
<name>microboot-activemq</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-activemq</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jetty</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>springloaded</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,11 @@
|
||||
server:
|
||||
port: 80
|
||||
spring:
|
||||
messages:
|
||||
basename: i18n/Messages,i18n/Pages
|
||||
jms:
|
||||
pub-sub-domain: false # 配置消息的类型,如果是true则表示为topic消息,如果为false表示Queue消息
|
||||
activemq:
|
||||
user: mldnjava # 连接用户名
|
||||
password: hello # 连接密码
|
||||
broker-url: tcp://activemq-server:61616 # 消息组件的连接主机信息
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
welcome.url=www.mldn.cn
|
||||
welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01
|
||||
@@ -0,0 +1,2 @@
|
||||
member.add.page=/pages/back/admin/member/member_add.jsp
|
||||
member.add.action=/pages/back/admin/member/member_add.action
|
||||
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<configuration scan="true">
|
||||
<property name="APP" value="${project.artifactId}" />
|
||||
<property name="LOG_HOME" value="/data/www/log/${APP}" />
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
<appender name="DETAIL"
|
||||
class="ch.qos.logback.core.rolling.RollingFileAppender" additivity="false">
|
||||
<File>${LOG_HOME}/${APP}_detail.log</File>
|
||||
<encoder>
|
||||
<pattern>%d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n</pattern>
|
||||
</encoder>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd}</fileNamePattern>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
<appender name="ACCESS"
|
||||
class="ch.qos.logback.core.rolling.RollingFileAppender" additivity="false">
|
||||
<File>${LOG_HOME}/${APP}_access.log</File>
|
||||
<encoder>
|
||||
<pattern>%d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n</pattern>
|
||||
</encoder>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd}</fileNamePattern>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
|
||||
|
||||
<logger name="ACCESS">
|
||||
<appender-ref ref="ACCESS" />
|
||||
</logger>
|
||||
<logger name="druid.sql.Statement" level="DEBUG" />
|
||||
<logger name="cn.mldn.microboot.dao" level="TRACE" />
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="DETAIL" />
|
||||
<appender-ref ref="CONSOLE" />
|
||||
</root>
|
||||
</configuration>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.mldn.microboot.dao.IDeptDAO">
|
||||
<select id="findAll" resultType="Dept">
|
||||
SELECT deptno,dname FROM dept ;
|
||||
</select>
|
||||
<insert id="doCreate" parameterType="Dept">
|
||||
INSERT INTO dept(dname) VALUES (#{dname}) ;
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE configuration
|
||||
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||
<configuration>
|
||||
<!-- 进行Mybatis的相应的环境的属性定义 -->
|
||||
<settings> <!-- 在本项目之中开启二级缓存 -->
|
||||
<setting name="cacheEnabled" value="true"/>
|
||||
</settings>
|
||||
</configuration>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<title>SpringBoot模版渲染</title>
|
||||
<script type="text/javascript" th:src="@{js/main.js}"></script>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
|
||||
</head>
|
||||
<body>
|
||||
<h1>www.mldn.cn</h1>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,3 @@
|
||||
window.onload = function() {
|
||||
console.log("****** www.mldn.cn ******") ;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<title>SpringBoot模版渲染</title>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
|
||||
</head>
|
||||
<body>
|
||||
<h1>www.mldn.cn</h1>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,21 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<title>SpringBoot模版渲染</title>
|
||||
<script type="text/javascript" th:src="@{/js/main.js}"></script>
|
||||
<link rel="icon" type="image/x-icon" href="/images/mldn.ico"/>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
|
||||
</head>
|
||||
<body>
|
||||
<form th:action="@{/upload}" method="post" enctype="multipart/form-data">
|
||||
姓名:<input type="text" name="name"/><br/>
|
||||
照片:<input type="file" name="photo"/><br/>
|
||||
照片:<input type="file" name="photo"/><br/>
|
||||
照片:<input type="file" name="photo"/><br/>
|
||||
<input type="submit" value="上传"/>
|
||||
</form>
|
||||
<a th:href="@{/show(groupId='group1',fileId='M00/00/00/wKhEtVlTFc2ANT4kAALWT3AMif079.jpeg')}">查看照片</a>
|
||||
<a th:href="@{/show(groupId='group1',fileId='M00/00/00/wKhEtVlTFc2AUVINAAA9nfksZs0713.png')}">查看照片</a>
|
||||
<a th:href="@{/show(groupId='group1',fileId='M00/00/00/wKhEtVlTFc2AOgxGAC-AAARLh5I67.jpeg')}">查看照片</a>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,12 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<title>SpringBoot模版渲染</title>
|
||||
<script type="text/javascript" th:src="@{/js/main.js}"></script>
|
||||
<link rel="icon" type="image/x-icon" href="/images/mldn.ico"/>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
|
||||
</head>
|
||||
<body>
|
||||
<img th:src="${image}"/>
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user