commit 0e66e801f4191e016f653602d3ef1184baa50adc Author: foreveriss <277821523@qq.com> Date: Thu Jun 29 23:46:06 2017 +0800 springboot用法和与各种框架、组件等结合使用,包括springboot的注解分析、路径分析、取得内置对象、项目打包、配置环境属性、读取资源文件、Bean配置、模板渲染、基于yml的多profile配置、基于properties的多profile、添加数据验证、配置错误页、全局异常处理、配置Tomcat运行、配置https访问路径、信息显示、内置对象、显示对象信息、文件上传、使用文件服务器、拦截器、配置druid数据库连接池、整合MyBatis框架、事务控制、Druid监控、整合ActiveMQ、整合RabbitMQ、整合kafka、邮件发送、定时调度、Actuator监控、整合Redis数据库、整合Restfui框架、整合Shiro diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..64db939 --- /dev/null +++ b/.classpath @@ -0,0 +1,4 @@ + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..27ebeb8 --- /dev/null +++ b/.project @@ -0,0 +1,23 @@ + + + microboot + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..4824b80 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/bin/pom.xml b/bin/pom.xml new file mode 100644 index 0000000..25574ba --- /dev/null +++ b/bin/pom.xml @@ -0,0 +1,26 @@ + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + pom + + microboot + http://maven.apache.org + + + UTF-8 + + + + + junit + junit + 3.8.1 + test + + + + diff --git a/microboot-activemq/.classpath b/microboot-activemq/.classpath new file mode 100644 index 0000000..a6f04e8 --- /dev/null +++ b/microboot-activemq/.classpath @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/microboot-activemq/.project b/microboot-activemq/.project new file mode 100644 index 0000000..26045bb --- /dev/null +++ b/microboot-activemq/.project @@ -0,0 +1,35 @@ + + + microboot-activemq + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/microboot-activemq/.settings/org.eclipse.core.resources.prefs b/microboot-activemq/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..a6dcfb7 --- /dev/null +++ b/microboot-activemq/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/main/view=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/microboot-activemq/.settings/org.eclipse.jdt.core.prefs b/microboot-activemq/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..d59e09c --- /dev/null +++ b/microboot-activemq/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/microboot-activemq/.settings/org.eclipse.m2e.core.prefs b/microboot-activemq/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/microboot-activemq/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/microboot-activemq/.settings/org.eclipse.wst.common.project.facet.core.xml b/microboot-activemq/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..e822977 --- /dev/null +++ b/microboot-activemq/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ + + + + diff --git a/microboot-activemq/pom.xml b/microboot-activemq/pom.xml new file mode 100644 index 0000000..971fc0e --- /dev/null +++ b/microboot-activemq/pom.xml @@ -0,0 +1,72 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-activemq + microboot-activemq + http://maven.apache.org + + UTF-8 + + + + mysql + mysql-connector-java + + + com.alibaba + druid + + + ch.qos.logback + logback-core + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + + + org.springframework.boot + spring-boot-starter-activemq + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-activemq/src/main/java/cn/mldn/microboot/StartSpringBootMain.java b/microboot-activemq/src/main/java/cn/mldn/microboot/StartSpringBootMain.java new file mode 100644 index 0000000..beb472b --- /dev/null +++ b/microboot-activemq/src/main/java/cn/mldn/microboot/StartSpringBootMain.java @@ -0,0 +1,13 @@ +package cn.mldn.microboot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +@SpringBootApplication // 启动SpringBoot程序,而后自带子包扫描 +@EnableTransactionManagement +public class StartSpringBootMain { + public static void main(String[] args) throws Exception { + SpringApplication.run(StartSpringBootMain.class, args); + } +} diff --git a/microboot-activemq/src/main/java/cn/mldn/microboot/config/ActiveMQConfig.java b/microboot-activemq/src/main/java/cn/mldn/microboot/config/ActiveMQConfig.java new file mode 100644 index 0000000..b110224 --- /dev/null +++ b/microboot-activemq/src/main/java/cn/mldn/microboot/config/ActiveMQConfig.java @@ -0,0 +1,17 @@ +package cn.mldn.microboot.config; + +import javax.jms.Queue; + +import org.apache.activemq.command.ActiveMQQueue; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.jms.annotation.EnableJms; + +@Configuration +@EnableJms +public class ActiveMQConfig { + @Bean + public Queue queue() { + return new ActiveMQQueue("mldn.msg.queue") ; + } +} diff --git a/microboot-activemq/src/main/java/cn/mldn/microboot/config/DruidConfig.java b/microboot-activemq/src/main/java/cn/mldn/microboot/config/DruidConfig.java new file mode 100644 index 0000000..1512a62 --- /dev/null +++ b/microboot-activemq/src/main/java/cn/mldn/microboot/config/DruidConfig.java @@ -0,0 +1,42 @@ +package cn.mldn.microboot.config; + +import javax.sql.DataSource; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.boot.web.servlet.ServletRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import com.alibaba.druid.pool.DruidDataSource; +import com.alibaba.druid.support.http.StatViewServlet; +import com.alibaba.druid.support.http.WebStatFilter; + +@Configuration +public class DruidConfig { + @Bean + public ServletRegistrationBean druidServlet() { // 主要实现WEB监控的配置处理 + ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean( + new StatViewServlet(), "/druid/*"); // 现在要进行druid监控的配置处理操作 + servletRegistrationBean.addInitParameter("allow", + "127.0.0.1,192.168.28.159"); // 白名单 + servletRegistrationBean.addInitParameter("deny", "192.168.28.200"); // 黑名单 + servletRegistrationBean.addInitParameter("loginUsername", "mldnjava"); // 用户名 + servletRegistrationBean.addInitParameter("loginPassword", "hello"); // 密码 + servletRegistrationBean.addInitParameter("resetEnable", "false"); // 是否可以重置数据源 + return servletRegistrationBean ; + } + @Bean + public FilterRegistrationBean filterRegistrationBean() { + FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean() ; + filterRegistrationBean.setFilter(new WebStatFilter()); + filterRegistrationBean.addUrlPatterns("/*"); // 所有请求进行监控处理 + filterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.css,/druid/*"); + return filterRegistrationBean ; + } + @Bean + @ConfigurationProperties(prefix = "spring.datasource") + public DataSource druidDataSource() { + return new DruidDataSource(); + } +} diff --git a/microboot-activemq/src/main/java/cn/mldn/microboot/consumer/MessageConsumerService.java b/microboot-activemq/src/main/java/cn/mldn/microboot/consumer/MessageConsumerService.java new file mode 100644 index 0000000..5a39316 --- /dev/null +++ b/microboot-activemq/src/main/java/cn/mldn/microboot/consumer/MessageConsumerService.java @@ -0,0 +1,12 @@ +package cn.mldn.microboot.consumer; + +import org.springframework.jms.annotation.JmsListener; +import org.springframework.stereotype.Service; + +@Service +public class MessageConsumerService { + @JmsListener(destination="mldn.msg.queue") + public void receiveMessage(String text) { // 进行消息接收处理 + System.err.println("【*** 接收消息 ***】" + text); + } +} diff --git a/microboot-activemq/src/main/java/cn/mldn/microboot/controller/DeptController.java b/microboot-activemq/src/main/java/cn/mldn/microboot/controller/DeptController.java new file mode 100644 index 0000000..452782e --- /dev/null +++ b/microboot-activemq/src/main/java/cn/mldn/microboot/controller/DeptController.java @@ -0,0 +1,20 @@ +package cn.mldn.microboot.controller; + +import javax.annotation.Resource; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import cn.mldn.microboot.service.IDeptService; +import cn.mldn.microboot.util.controller.AbstractBaseController; + +@RestController +public class DeptController extends AbstractBaseController { + @Resource + private IDeptService deptService ; + @RequestMapping(value = "/list", method = RequestMethod.GET) + public Object list() { // 通过model可以实现内容的传递 + return this.deptService.list() ; + } +} diff --git a/microboot-activemq/src/main/java/cn/mldn/microboot/dao/IDeptDAO.java b/microboot-activemq/src/main/java/cn/mldn/microboot/dao/IDeptDAO.java new file mode 100644 index 0000000..758693b --- /dev/null +++ b/microboot-activemq/src/main/java/cn/mldn/microboot/dao/IDeptDAO.java @@ -0,0 +1,12 @@ +package cn.mldn.microboot.dao; + +import java.util.List; + +import org.apache.ibatis.annotations.Mapper; + +import cn.mldn.microboot.vo.Dept; +@Mapper +public interface IDeptDAO { + public List findAll(); + public boolean doCreate(Dept vo) ; +} diff --git a/microboot-activemq/src/main/java/cn/mldn/microboot/producer/IMessageProducerService.java b/microboot-activemq/src/main/java/cn/mldn/microboot/producer/IMessageProducerService.java new file mode 100644 index 0000000..5621950 --- /dev/null +++ b/microboot-activemq/src/main/java/cn/mldn/microboot/producer/IMessageProducerService.java @@ -0,0 +1,5 @@ +package cn.mldn.microboot.producer; + +public interface IMessageProducerService { + public void sendMessage(String msg) ; +} diff --git a/microboot-activemq/src/main/java/cn/mldn/microboot/producer/impl/MessageProducerServiceImpl.java b/microboot-activemq/src/main/java/cn/mldn/microboot/producer/impl/MessageProducerServiceImpl.java new file mode 100644 index 0000000..eb758be --- /dev/null +++ b/microboot-activemq/src/main/java/cn/mldn/microboot/producer/impl/MessageProducerServiceImpl.java @@ -0,0 +1,21 @@ +package cn.mldn.microboot.producer.impl; + +import javax.annotation.Resource; +import javax.jms.Queue; + +import org.springframework.jms.core.JmsMessagingTemplate; +import org.springframework.stereotype.Service; + +import cn.mldn.microboot.producer.IMessageProducerService; +@Service +public class MessageProducerServiceImpl implements IMessageProducerService { + @Resource + private JmsMessagingTemplate jmsMessagingTemplate; + @Resource + private Queue queue; + @Override + public void sendMessage(String msg) { + this.jmsMessagingTemplate.convertAndSend(this.queue, msg); + } + +} diff --git a/microboot-activemq/src/main/java/cn/mldn/microboot/service/IDeptService.java b/microboot-activemq/src/main/java/cn/mldn/microboot/service/IDeptService.java new file mode 100644 index 0000000..2f10d1e --- /dev/null +++ b/microboot-activemq/src/main/java/cn/mldn/microboot/service/IDeptService.java @@ -0,0 +1,15 @@ +package cn.mldn.microboot.service; + +import java.util.List; + +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import cn.mldn.microboot.vo.Dept; + +public interface IDeptService { + @Transactional(readOnly = true) + public List list() ; + @Transactional(propagation=Propagation.REQUIRED) + public boolean add(Dept vo) ; +} diff --git a/microboot-activemq/src/main/java/cn/mldn/microboot/service/impl/DeptServiceImpl.java b/microboot-activemq/src/main/java/cn/mldn/microboot/service/impl/DeptServiceImpl.java new file mode 100644 index 0000000..ba710b7 --- /dev/null +++ b/microboot-activemq/src/main/java/cn/mldn/microboot/service/impl/DeptServiceImpl.java @@ -0,0 +1,25 @@ +package cn.mldn.microboot.service.impl; + +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import cn.mldn.microboot.dao.IDeptDAO; +import cn.mldn.microboot.service.IDeptService; +import cn.mldn.microboot.vo.Dept; +import cn.mldn.microboot.vo.Member; +@Service +public class DeptServiceImpl implements IDeptService { + @Resource + private IDeptDAO deptDAO; + @Override + public List list() { + return this.deptDAO.findAll(); + } + @Override + public boolean add(Dept vo) { + return this.deptDAO.doCreate(vo); + } +} diff --git a/microboot-activemq/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java b/microboot-activemq/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java new file mode 100644 index 0000000..5127e93 --- /dev/null +++ b/microboot-activemq/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java @@ -0,0 +1,15 @@ +package cn.mldn.microboot.util.controller; + +import java.util.Locale; + +import javax.annotation.Resource; + +import org.springframework.context.MessageSource; + +public abstract class AbstractBaseController { + @Resource + private MessageSource messageSource; // 自动注入此资源对象 + public String getMessage(String key, String... args) { + return this.messageSource.getMessage(key, args, Locale.getDefault()); + } +} diff --git a/microboot-activemq/src/main/java/cn/mldn/microboot/vo/Dept.java b/microboot-activemq/src/main/java/cn/mldn/microboot/vo/Dept.java new file mode 100644 index 0000000..7971469 --- /dev/null +++ b/microboot-activemq/src/main/java/cn/mldn/microboot/vo/Dept.java @@ -0,0 +1,25 @@ +package cn.mldn.microboot.vo; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class Dept implements Serializable { + private Long deptno ; + private String dname ; + public Long getDeptno() { + return deptno; + } + public void setDeptno(Long deptno) { + this.deptno = deptno; + } + public String getDname() { + return dname; + } + public void setDname(String dname) { + this.dname = dname; + } + @Override + public String toString() { + return "Dept [deptno=" + deptno + ", dname=" + dname + "]"; + } +} diff --git a/microboot-activemq/src/main/java/cn/mldn/microboot/vo/Member.java b/microboot-activemq/src/main/java/cn/mldn/microboot/vo/Member.java new file mode 100644 index 0000000..f6a9cd8 --- /dev/null +++ b/microboot-activemq/src/main/java/cn/mldn/microboot/vo/Member.java @@ -0,0 +1,44 @@ +package cn.mldn.microboot.vo; + +import java.io.Serializable; +import java.util.Date; + +@SuppressWarnings("serial") +public class Member implements Serializable { + private Long mid ; + private String name ; + private Integer age ; + private Date birthday ; + private Double salary ; + public Long getMid() { + return mid; + } + public void setMid(Long mid) { + this.mid = mid; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public Integer getAge() { + return age; + } + public void setAge(Integer age) { + this.age = age; + } + public Date getBirthday() { + return birthday; + } + public void setBirthday(Date birthday) { + this.birthday = birthday; + } + public Double getSalary() { + return salary; + } + public void setSalary(Double salary) { + this.salary = salary; + } +} + diff --git a/microboot-activemq/src/main/java/数据库创建脚本.sql b/microboot-activemq/src/main/java/数据库创建脚本.sql new file mode 100644 index 0000000..edd35b2 --- /dev/null +++ b/microboot-activemq/src/main/java/数据库创建脚本.sql @@ -0,0 +1,13 @@ +DROP DATBASE IF EXISTS mldn ; +CREATE DATBASE mldn CHARACTER SET UTF8 ; +USE mldn ; +CREATE TABLE dept ( + deptno BIGINT AUTO_INCREMENT , + dname VARCHAR(50) , + CONSTRAINT pk_deptno PRIMARY KEY(deptno) +) ; +INSERT INTO dept(dname) VALUES ('开发部') ; +INSERT INTO dept(dname) VALUES ('财务部') ; +INSERT INTO dept(dname) VALUES ('市场部') ; +INSERT INTO dept(dname) VALUES ('后勤部') ; +INSERT INTO dept(dname) VALUES ('公关部') ; \ No newline at end of file diff --git a/microboot-activemq/src/main/resources/application.yml b/microboot-activemq/src/main/resources/application.yml new file mode 100644 index 0000000..e6b73c2 --- /dev/null +++ b/microboot-activemq/src/main/resources/application.yml @@ -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 # 消息组件的连接主机信息 \ No newline at end of file diff --git a/microboot-activemq/src/main/resources/i18n/Messages.properties b/microboot-activemq/src/main/resources/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-activemq/src/main/resources/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-activemq/src/main/resources/i18n/Pages.properties b/microboot-activemq/src/main/resources/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-activemq/src/main/resources/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-activemq/src/main/resources/logback.xml b/microboot-activemq/src/main/resources/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-activemq/src/main/resources/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-activemq/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml b/microboot-activemq/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml new file mode 100644 index 0000000..6557a3a --- /dev/null +++ b/microboot-activemq/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml @@ -0,0 +1,11 @@ + + + + + + INSERT INTO dept(dname) VALUES (#{dname}) ; + + diff --git a/microboot-activemq/src/main/resources/mybatis/mybatis.cfg.xml b/microboot-activemq/src/main/resources/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4d128c0 --- /dev/null +++ b/microboot-activemq/src/main/resources/mybatis/mybatis.cfg.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/microboot-activemq/src/main/view/static/images/mldn.ico b/microboot-activemq/src/main/view/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-activemq/src/main/view/static/images/mldn.ico differ diff --git a/microboot-activemq/src/main/view/static/info/message_info.html b/microboot-activemq/src/main/view/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-activemq/src/main/view/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-activemq/src/main/view/static/js/main.js b/microboot-activemq/src/main/view/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-activemq/src/main/view/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-activemq/src/main/view/static/message_index.html b/microboot-activemq/src/main/view/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-activemq/src/main/view/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-activemq/src/main/view/templates/upload_page.html b/microboot-activemq/src/main/view/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-activemq/src/main/view/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-activemq/src/main/view/templates/upload_show.html b/microboot-activemq/src/main/view/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-activemq/src/main/view/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-activemq/src/test/java/cn/mldn/microboot/AppTest.java b/microboot-activemq/src/test/java/cn/mldn/microboot/AppTest.java new file mode 100644 index 0000000..a094258 --- /dev/null +++ b/microboot-activemq/src/test/java/cn/mldn/microboot/AppTest.java @@ -0,0 +1,38 @@ +package cn.mldn.microboot; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/microboot-activemq/src/test/java/cn/mldn/microboot/test/TestActiveMQ.java b/microboot-activemq/src/test/java/cn/mldn/microboot/test/TestActiveMQ.java new file mode 100644 index 0000000..a8c14b1 --- /dev/null +++ b/microboot-activemq/src/test/java/cn/mldn/microboot/test/TestActiveMQ.java @@ -0,0 +1,26 @@ +package cn.mldn.microboot.test; + +import javax.annotation.Resource; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +import cn.mldn.microboot.StartSpringBootMain; +import cn.mldn.microboot.producer.IMessageProducerService; + +@SpringBootTest(classes = StartSpringBootMain.class) +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +public class TestActiveMQ { + @Resource + private IMessageProducerService messageProducer; + @Test + public void testSend() throws Exception { + for (int x = 0; x < 100; x++) { + this.messageProducer.sendMessage("mldn - " + x); + } + } +} diff --git a/microboot-activemq/target/classes/META-INF/MANIFEST.MF b/microboot-activemq/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d4c16dd --- /dev/null +++ b/microboot-activemq/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Built-By: foreveriss +Build-Jdk: 1.8.0_121 +Created-By: Maven Integration for Eclipse + diff --git a/microboot-activemq/target/classes/META-INF/maven/cn.mldn/microboot-activemq/pom.properties b/microboot-activemq/target/classes/META-INF/maven/cn.mldn/microboot-activemq/pom.properties new file mode 100644 index 0000000..f1dab2d --- /dev/null +++ b/microboot-activemq/target/classes/META-INF/maven/cn.mldn/microboot-activemq/pom.properties @@ -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 diff --git a/microboot-activemq/target/classes/META-INF/maven/cn.mldn/microboot-activemq/pom.xml b/microboot-activemq/target/classes/META-INF/maven/cn.mldn/microboot-activemq/pom.xml new file mode 100644 index 0000000..971fc0e --- /dev/null +++ b/microboot-activemq/target/classes/META-INF/maven/cn.mldn/microboot-activemq/pom.xml @@ -0,0 +1,72 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-activemq + microboot-activemq + http://maven.apache.org + + UTF-8 + + + + mysql + mysql-connector-java + + + com.alibaba + druid + + + ch.qos.logback + logback-core + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + + + org.springframework.boot + spring-boot-starter-activemq + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-activemq/target/classes/application.yml b/microboot-activemq/target/classes/application.yml new file mode 100644 index 0000000..e6b73c2 --- /dev/null +++ b/microboot-activemq/target/classes/application.yml @@ -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 # 消息组件的连接主机信息 \ No newline at end of file diff --git a/microboot-activemq/target/classes/cn/mldn/microboot/StartSpringBootMain.class b/microboot-activemq/target/classes/cn/mldn/microboot/StartSpringBootMain.class new file mode 100644 index 0000000..e777efe Binary files /dev/null and b/microboot-activemq/target/classes/cn/mldn/microboot/StartSpringBootMain.class differ diff --git a/microboot-activemq/target/classes/cn/mldn/microboot/config/ActiveMQConfig.class b/microboot-activemq/target/classes/cn/mldn/microboot/config/ActiveMQConfig.class new file mode 100644 index 0000000..ad7dd03 Binary files /dev/null and b/microboot-activemq/target/classes/cn/mldn/microboot/config/ActiveMQConfig.class differ diff --git a/microboot-activemq/target/classes/cn/mldn/microboot/config/DruidConfig.class b/microboot-activemq/target/classes/cn/mldn/microboot/config/DruidConfig.class new file mode 100644 index 0000000..788d114 Binary files /dev/null and b/microboot-activemq/target/classes/cn/mldn/microboot/config/DruidConfig.class differ diff --git a/microboot-activemq/target/classes/cn/mldn/microboot/consumer/MessageConsumerService.class b/microboot-activemq/target/classes/cn/mldn/microboot/consumer/MessageConsumerService.class new file mode 100644 index 0000000..abd9e34 Binary files /dev/null and b/microboot-activemq/target/classes/cn/mldn/microboot/consumer/MessageConsumerService.class differ diff --git a/microboot-activemq/target/classes/cn/mldn/microboot/controller/DeptController.class b/microboot-activemq/target/classes/cn/mldn/microboot/controller/DeptController.class new file mode 100644 index 0000000..30d865c Binary files /dev/null and b/microboot-activemq/target/classes/cn/mldn/microboot/controller/DeptController.class differ diff --git a/microboot-activemq/target/classes/cn/mldn/microboot/dao/IDeptDAO.class b/microboot-activemq/target/classes/cn/mldn/microboot/dao/IDeptDAO.class new file mode 100644 index 0000000..c2964bd Binary files /dev/null and b/microboot-activemq/target/classes/cn/mldn/microboot/dao/IDeptDAO.class differ diff --git a/microboot-activemq/target/classes/cn/mldn/microboot/producer/IMessageProducerService.class b/microboot-activemq/target/classes/cn/mldn/microboot/producer/IMessageProducerService.class new file mode 100644 index 0000000..02782fc Binary files /dev/null and b/microboot-activemq/target/classes/cn/mldn/microboot/producer/IMessageProducerService.class differ diff --git a/microboot-activemq/target/classes/cn/mldn/microboot/producer/impl/MessageProducerServiceImpl.class b/microboot-activemq/target/classes/cn/mldn/microboot/producer/impl/MessageProducerServiceImpl.class new file mode 100644 index 0000000..f06d76c Binary files /dev/null and b/microboot-activemq/target/classes/cn/mldn/microboot/producer/impl/MessageProducerServiceImpl.class differ diff --git a/microboot-activemq/target/classes/cn/mldn/microboot/service/IDeptService.class b/microboot-activemq/target/classes/cn/mldn/microboot/service/IDeptService.class new file mode 100644 index 0000000..81cf889 Binary files /dev/null and b/microboot-activemq/target/classes/cn/mldn/microboot/service/IDeptService.class differ diff --git a/microboot-activemq/target/classes/cn/mldn/microboot/service/impl/DeptServiceImpl.class b/microboot-activemq/target/classes/cn/mldn/microboot/service/impl/DeptServiceImpl.class new file mode 100644 index 0000000..90323d4 Binary files /dev/null and b/microboot-activemq/target/classes/cn/mldn/microboot/service/impl/DeptServiceImpl.class differ diff --git a/microboot-activemq/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class b/microboot-activemq/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class new file mode 100644 index 0000000..57c2010 Binary files /dev/null and b/microboot-activemq/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class differ diff --git a/microboot-activemq/target/classes/cn/mldn/microboot/vo/Dept.class b/microboot-activemq/target/classes/cn/mldn/microboot/vo/Dept.class new file mode 100644 index 0000000..46f2356 Binary files /dev/null and b/microboot-activemq/target/classes/cn/mldn/microboot/vo/Dept.class differ diff --git a/microboot-activemq/target/classes/cn/mldn/microboot/vo/Member.class b/microboot-activemq/target/classes/cn/mldn/microboot/vo/Member.class new file mode 100644 index 0000000..59c00d5 Binary files /dev/null and b/microboot-activemq/target/classes/cn/mldn/microboot/vo/Member.class differ diff --git a/microboot-activemq/target/classes/i18n/Messages.properties b/microboot-activemq/target/classes/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-activemq/target/classes/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-activemq/target/classes/i18n/Pages.properties b/microboot-activemq/target/classes/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-activemq/target/classes/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-activemq/target/classes/logback.xml b/microboot-activemq/target/classes/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-activemq/target/classes/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-activemq/target/classes/mybatis/mapper/cn/mldn/Dept.xml b/microboot-activemq/target/classes/mybatis/mapper/cn/mldn/Dept.xml new file mode 100644 index 0000000..6557a3a --- /dev/null +++ b/microboot-activemq/target/classes/mybatis/mapper/cn/mldn/Dept.xml @@ -0,0 +1,11 @@ + + + + + + INSERT INTO dept(dname) VALUES (#{dname}) ; + + diff --git a/microboot-activemq/target/classes/mybatis/mybatis.cfg.xml b/microboot-activemq/target/classes/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4d128c0 --- /dev/null +++ b/microboot-activemq/target/classes/mybatis/mybatis.cfg.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/microboot-activemq/target/classes/static/images/mldn.ico b/microboot-activemq/target/classes/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-activemq/target/classes/static/images/mldn.ico differ diff --git a/microboot-activemq/target/classes/static/info/message_info.html b/microboot-activemq/target/classes/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-activemq/target/classes/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-activemq/target/classes/static/js/main.js b/microboot-activemq/target/classes/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-activemq/target/classes/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-activemq/target/classes/static/message_index.html b/microboot-activemq/target/classes/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-activemq/target/classes/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-activemq/target/classes/templates/upload_page.html b/microboot-activemq/target/classes/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-activemq/target/classes/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-activemq/target/classes/templates/upload_show.html b/microboot-activemq/target/classes/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-activemq/target/classes/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-activemq/target/test-classes/cn/mldn/microboot/AppTest.class b/microboot-activemq/target/test-classes/cn/mldn/microboot/AppTest.class new file mode 100644 index 0000000..d317ee0 Binary files /dev/null and b/microboot-activemq/target/test-classes/cn/mldn/microboot/AppTest.class differ diff --git a/microboot-activemq/target/test-classes/cn/mldn/microboot/test/TestActiveMQ.class b/microboot-activemq/target/test-classes/cn/mldn/microboot/test/TestActiveMQ.class new file mode 100644 index 0000000..ab3b71f Binary files /dev/null and b/microboot-activemq/target/test-classes/cn/mldn/microboot/test/TestActiveMQ.class differ diff --git a/microboot-actuator/.classpath b/microboot-actuator/.classpath new file mode 100644 index 0000000..a6f04e8 --- /dev/null +++ b/microboot-actuator/.classpath @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/microboot-actuator/.project b/microboot-actuator/.project new file mode 100644 index 0000000..cb97b43 --- /dev/null +++ b/microboot-actuator/.project @@ -0,0 +1,35 @@ + + + microboot-actuator + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/microboot-actuator/.settings/org.eclipse.core.resources.prefs b/microboot-actuator/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..a6dcfb7 --- /dev/null +++ b/microboot-actuator/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/main/view=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/microboot-actuator/.settings/org.eclipse.jdt.core.prefs b/microboot-actuator/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..d59e09c --- /dev/null +++ b/microboot-actuator/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/microboot-actuator/.settings/org.eclipse.m2e.core.prefs b/microboot-actuator/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/microboot-actuator/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/microboot-actuator/.settings/org.eclipse.wst.common.project.facet.core.xml b/microboot-actuator/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..e822977 --- /dev/null +++ b/microboot-actuator/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ + + + + diff --git a/microboot-actuator/pom.xml b/microboot-actuator/pom.xml new file mode 100644 index 0000000..93eb611 --- /dev/null +++ b/microboot-actuator/pom.xml @@ -0,0 +1,72 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-actuator + microboot-actuator + http://maven.apache.org + + UTF-8 + + + + org.springframework.boot + spring-boot-starter-actuator + + + + org.springframework.boot + spring-boot-starter-mail + + + + ch.qos.logback + logback-core + + + + org.springframework.kafka + spring-kafka + + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-actuator/src/main/java/cn/mldn/microboot/StartSpringBootMain.java b/microboot-actuator/src/main/java/cn/mldn/microboot/StartSpringBootMain.java new file mode 100644 index 0000000..9e9a3d4 --- /dev/null +++ b/microboot-actuator/src/main/java/cn/mldn/microboot/StartSpringBootMain.java @@ -0,0 +1,11 @@ +package cn.mldn.microboot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication // 启动SpringBoot程序,而后自带子包扫描 +public class StartSpringBootMain { + public static void main(String[] args) throws Exception { + SpringApplication.run(StartSpringBootMain.class, args); + } +} diff --git a/microboot-actuator/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java b/microboot-actuator/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java new file mode 100644 index 0000000..5127e93 --- /dev/null +++ b/microboot-actuator/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java @@ -0,0 +1,15 @@ +package cn.mldn.microboot.util.controller; + +import java.util.Locale; + +import javax.annotation.Resource; + +import org.springframework.context.MessageSource; + +public abstract class AbstractBaseController { + @Resource + private MessageSource messageSource; // 自动注入此资源对象 + public String getMessage(String key, String... args) { + return this.messageSource.getMessage(key, args, Locale.getDefault()); + } +} diff --git a/microboot-actuator/src/main/resources/application.yml b/microboot-actuator/src/main/resources/application.yml new file mode 100644 index 0000000..12c1326 --- /dev/null +++ b/microboot-actuator/src/main/resources/application.yml @@ -0,0 +1,5 @@ +server: + port: 80 +spring: + messages: + basename: i18n/Messages,i18n/Pages \ No newline at end of file diff --git a/microboot-actuator/src/main/resources/i18n/Messages.properties b/microboot-actuator/src/main/resources/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-actuator/src/main/resources/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-actuator/src/main/resources/i18n/Pages.properties b/microboot-actuator/src/main/resources/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-actuator/src/main/resources/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-actuator/src/main/resources/logback.xml b/microboot-actuator/src/main/resources/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-actuator/src/main/resources/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-actuator/src/main/view/static/images/mldn.ico b/microboot-actuator/src/main/view/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-actuator/src/main/view/static/images/mldn.ico differ diff --git a/microboot-actuator/src/main/view/static/info/message_info.html b/microboot-actuator/src/main/view/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-actuator/src/main/view/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-actuator/src/main/view/static/js/main.js b/microboot-actuator/src/main/view/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-actuator/src/main/view/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-actuator/src/main/view/static/message_index.html b/microboot-actuator/src/main/view/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-actuator/src/main/view/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-actuator/src/main/view/templates/upload_page.html b/microboot-actuator/src/main/view/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-actuator/src/main/view/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-actuator/src/main/view/templates/upload_show.html b/microboot-actuator/src/main/view/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-actuator/src/main/view/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-actuator/target/classes/META-INF/MANIFEST.MF b/microboot-actuator/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d4c16dd --- /dev/null +++ b/microboot-actuator/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Built-By: foreveriss +Build-Jdk: 1.8.0_121 +Created-By: Maven Integration for Eclipse + diff --git a/microboot-actuator/target/classes/META-INF/maven/cn.mldn/microboot-actuator/pom.properties b/microboot-actuator/target/classes/META-INF/maven/cn.mldn/microboot-actuator/pom.properties new file mode 100644 index 0000000..dd45771 --- /dev/null +++ b/microboot-actuator/target/classes/META-INF/maven/cn.mldn/microboot-actuator/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Thu Jun 29 23:44:59 CST 2017 +version=0.0.1-SNAPSHOT +groupId=cn.mldn +m2e.projectName=microboot-actuator +m2e.projectLocation=/Users/foreveriss/workspace/microboot/microboot-actuator +artifactId=microboot-actuator diff --git a/microboot-actuator/target/classes/META-INF/maven/cn.mldn/microboot-actuator/pom.xml b/microboot-actuator/target/classes/META-INF/maven/cn.mldn/microboot-actuator/pom.xml new file mode 100644 index 0000000..93eb611 --- /dev/null +++ b/microboot-actuator/target/classes/META-INF/maven/cn.mldn/microboot-actuator/pom.xml @@ -0,0 +1,72 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-actuator + microboot-actuator + http://maven.apache.org + + UTF-8 + + + + org.springframework.boot + spring-boot-starter-actuator + + + + org.springframework.boot + spring-boot-starter-mail + + + + ch.qos.logback + logback-core + + + + org.springframework.kafka + spring-kafka + + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-actuator/target/classes/application.yml b/microboot-actuator/target/classes/application.yml new file mode 100644 index 0000000..12c1326 --- /dev/null +++ b/microboot-actuator/target/classes/application.yml @@ -0,0 +1,5 @@ +server: + port: 80 +spring: + messages: + basename: i18n/Messages,i18n/Pages \ No newline at end of file diff --git a/microboot-actuator/target/classes/cn/mldn/microboot/StartSpringBootMain.class b/microboot-actuator/target/classes/cn/mldn/microboot/StartSpringBootMain.class new file mode 100644 index 0000000..eb9ab34 Binary files /dev/null and b/microboot-actuator/target/classes/cn/mldn/microboot/StartSpringBootMain.class differ diff --git a/microboot-actuator/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class b/microboot-actuator/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class new file mode 100644 index 0000000..57c2010 Binary files /dev/null and b/microboot-actuator/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class differ diff --git a/microboot-actuator/target/classes/i18n/Messages.properties b/microboot-actuator/target/classes/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-actuator/target/classes/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-actuator/target/classes/i18n/Pages.properties b/microboot-actuator/target/classes/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-actuator/target/classes/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-actuator/target/classes/logback.xml b/microboot-actuator/target/classes/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-actuator/target/classes/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-actuator/target/classes/static/images/mldn.ico b/microboot-actuator/target/classes/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-actuator/target/classes/static/images/mldn.ico differ diff --git a/microboot-actuator/target/classes/static/info/message_info.html b/microboot-actuator/target/classes/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-actuator/target/classes/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-actuator/target/classes/static/js/main.js b/microboot-actuator/target/classes/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-actuator/target/classes/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-actuator/target/classes/static/message_index.html b/microboot-actuator/target/classes/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-actuator/target/classes/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-actuator/target/classes/templates/upload_page.html b/microboot-actuator/target/classes/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-actuator/target/classes/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-actuator/target/classes/templates/upload_show.html b/microboot-actuator/target/classes/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-actuator/target/classes/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-advance/.classpath b/microboot-advance/.classpath new file mode 100644 index 0000000..12c67c9 --- /dev/null +++ b/microboot-advance/.classpath @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/microboot-advance/.project b/microboot-advance/.project new file mode 100644 index 0000000..edfb056 --- /dev/null +++ b/microboot-advance/.project @@ -0,0 +1,35 @@ + + + microboot-advance + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/microboot-advance/.settings/org.eclipse.core.resources.prefs b/microboot-advance/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..a6dcfb7 --- /dev/null +++ b/microboot-advance/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/main/view=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/microboot-advance/.settings/org.eclipse.jdt.core.prefs b/microboot-advance/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..d59e09c --- /dev/null +++ b/microboot-advance/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/microboot-advance/.settings/org.eclipse.m2e.core.prefs b/microboot-advance/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/microboot-advance/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/microboot-advance/.settings/org.eclipse.wst.common.project.facet.core.xml b/microboot-advance/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..e822977 --- /dev/null +++ b/microboot-advance/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ + + + + diff --git a/microboot-advance/.springBeans b/microboot-advance/.springBeans new file mode 100644 index 0000000..d3a2e9a --- /dev/null +++ b/microboot-advance/.springBeans @@ -0,0 +1,16 @@ + + + 1 + + + + + + + + + java:cn.mldn.microboot.StartSpringBootMain + + + + diff --git a/microboot-advance/pom.xml b/microboot-advance/pom.xml new file mode 100644 index 0000000..a93105c --- /dev/null +++ b/microboot-advance/pom.xml @@ -0,0 +1,52 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-advance + microboot-advance + http://maven.apache.org + + UTF-8 + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-advance/src/main/java/cn/mldn/microboot/StartSpringBootMain.java b/microboot-advance/src/main/java/cn/mldn/microboot/StartSpringBootMain.java new file mode 100644 index 0000000..87d91fa --- /dev/null +++ b/microboot-advance/src/main/java/cn/mldn/microboot/StartSpringBootMain.java @@ -0,0 +1,10 @@ +package cn.mldn.microboot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +@SpringBootApplication // 启动SpringBoot程序,而后自带子包扫描 +public class StartSpringBootMain { + public static void main(String[] args) throws Exception { + SpringApplication.run(StartSpringBootMain.class, args); + } +} diff --git a/microboot-advance/src/main/java/cn/mldn/microboot/controller/MessageController.java b/microboot-advance/src/main/java/cn/mldn/microboot/controller/MessageController.java new file mode 100644 index 0000000..b311264 --- /dev/null +++ b/microboot-advance/src/main/java/cn/mldn/microboot/controller/MessageController.java @@ -0,0 +1,26 @@ +package cn.mldn.microboot.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +import cn.mldn.microboot.util.controller.AbstractBaseController; + +@Controller +public class MessageController extends AbstractBaseController { + @RequestMapping(value = "/show", method = RequestMethod.GET) + public String show(String mid, Model model) { + model.addAttribute("url", "www.mldn.cn"); // request属性传递包装 + model.addAttribute("mid", mid); // request属性传递包装 + return "message/message_show"; // 此处只返回一个路径, 该路径没有设置后缀,后缀默认是*.html + } +} + + + + + + + + diff --git a/microboot-advance/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java b/microboot-advance/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java new file mode 100644 index 0000000..5127e93 --- /dev/null +++ b/microboot-advance/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java @@ -0,0 +1,15 @@ +package cn.mldn.microboot.util.controller; + +import java.util.Locale; + +import javax.annotation.Resource; + +import org.springframework.context.MessageSource; + +public abstract class AbstractBaseController { + @Resource + private MessageSource messageSource; // 自动注入此资源对象 + public String getMessage(String key, String... args) { + return this.messageSource.getMessage(key, args, Locale.getDefault()); + } +} diff --git a/microboot-advance/src/main/resources/application-beta.properties b/microboot-advance/src/main/resources/application-beta.properties new file mode 100644 index 0000000..e8f85d5 --- /dev/null +++ b/microboot-advance/src/main/resources/application-beta.properties @@ -0,0 +1,2 @@ +spring.messages.basename=i18n/Messages,i18n/Pages +server.port=9090 \ No newline at end of file diff --git a/microboot-advance/src/main/resources/application-dev.properties b/microboot-advance/src/main/resources/application-dev.properties new file mode 100644 index 0000000..6348e2e --- /dev/null +++ b/microboot-advance/src/main/resources/application-dev.properties @@ -0,0 +1,2 @@ +spring.messages.basename=i18n/Messages,i18n/Pages +server.port=8080 \ No newline at end of file diff --git a/microboot-advance/src/main/resources/application-product.properties b/microboot-advance/src/main/resources/application-product.properties new file mode 100644 index 0000000..70bcce4 --- /dev/null +++ b/microboot-advance/src/main/resources/application-product.properties @@ -0,0 +1,2 @@ +spring.messages.basename=i18n/Messages,i18n/Pages +server.port=80 \ No newline at end of file diff --git a/microboot-advance/src/main/resources/application.properties b/microboot-advance/src/main/resources/application.properties new file mode 100644 index 0000000..01308f4 --- /dev/null +++ b/microboot-advance/src/main/resources/application.properties @@ -0,0 +1 @@ +spring.profiles.active=product diff --git a/microboot-advance/src/main/resources/i18n/Messages.properties b/microboot-advance/src/main/resources/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-advance/src/main/resources/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-advance/src/main/resources/i18n/Pages.properties b/microboot-advance/src/main/resources/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-advance/src/main/resources/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-advance/src/main/view/static/images/mldn.ico b/microboot-advance/src/main/view/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-advance/src/main/view/static/images/mldn.ico differ diff --git a/microboot-advance/src/main/view/static/message_index.html b/microboot-advance/src/main/view/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-advance/src/main/view/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-advance/src/main/view/templates/message/message_show.html b/microboot-advance/src/main/view/templates/message/message_show.html new file mode 100644 index 0000000..9126f0b --- /dev/null +++ b/microboot-advance/src/main/view/templates/message/message_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + +

+

+ + \ No newline at end of file diff --git a/microboot-advance/src/test/java/cn/mldn/microboot/AppTest.java b/microboot-advance/src/test/java/cn/mldn/microboot/AppTest.java new file mode 100644 index 0000000..a094258 --- /dev/null +++ b/microboot-advance/src/test/java/cn/mldn/microboot/AppTest.java @@ -0,0 +1,38 @@ +package cn.mldn.microboot; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/microboot-advance/src/test/java/cn/mldn/microboot/test/TestMessageController.java b/microboot-advance/src/test/java/cn/mldn/microboot/test/TestMessageController.java new file mode 100644 index 0000000..21c04dd --- /dev/null +++ b/microboot-advance/src/test/java/cn/mldn/microboot/test/TestMessageController.java @@ -0,0 +1,19 @@ +package cn.mldn.microboot.test; + +import javax.annotation.Resource; + +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +import cn.mldn.microboot.StartSpringBootMain; +import cn.mldn.microboot.controller.MessageController; + +@SpringBootTest(classes = StartSpringBootMain.class) +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +public class TestMessageController { + @Resource + private MessageController messageController; +} diff --git a/microboot-advance/target/classes/META-INF/MANIFEST.MF b/microboot-advance/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d4c16dd --- /dev/null +++ b/microboot-advance/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Built-By: foreveriss +Build-Jdk: 1.8.0_121 +Created-By: Maven Integration for Eclipse + diff --git a/microboot-advance/target/classes/META-INF/maven/cn.mldn/microboot-advance/pom.properties b/microboot-advance/target/classes/META-INF/maven/cn.mldn/microboot-advance/pom.properties new file mode 100644 index 0000000..5ba01c7 --- /dev/null +++ b/microboot-advance/target/classes/META-INF/maven/cn.mldn/microboot-advance/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Thu Jun 29 23:45:00 CST 2017 +version=0.0.1-SNAPSHOT +groupId=cn.mldn +m2e.projectName=microboot-advance +m2e.projectLocation=/Users/foreveriss/workspace/microboot/microboot-advance +artifactId=microboot-advance diff --git a/microboot-advance/target/classes/META-INF/maven/cn.mldn/microboot-advance/pom.xml b/microboot-advance/target/classes/META-INF/maven/cn.mldn/microboot-advance/pom.xml new file mode 100644 index 0000000..a93105c --- /dev/null +++ b/microboot-advance/target/classes/META-INF/maven/cn.mldn/microboot-advance/pom.xml @@ -0,0 +1,52 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-advance + microboot-advance + http://maven.apache.org + + UTF-8 + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-advance/target/classes/application-beta.properties b/microboot-advance/target/classes/application-beta.properties new file mode 100644 index 0000000..e8f85d5 --- /dev/null +++ b/microboot-advance/target/classes/application-beta.properties @@ -0,0 +1,2 @@ +spring.messages.basename=i18n/Messages,i18n/Pages +server.port=9090 \ No newline at end of file diff --git a/microboot-advance/target/classes/application-dev.properties b/microboot-advance/target/classes/application-dev.properties new file mode 100644 index 0000000..6348e2e --- /dev/null +++ b/microboot-advance/target/classes/application-dev.properties @@ -0,0 +1,2 @@ +spring.messages.basename=i18n/Messages,i18n/Pages +server.port=8080 \ No newline at end of file diff --git a/microboot-advance/target/classes/application-product.properties b/microboot-advance/target/classes/application-product.properties new file mode 100644 index 0000000..70bcce4 --- /dev/null +++ b/microboot-advance/target/classes/application-product.properties @@ -0,0 +1,2 @@ +spring.messages.basename=i18n/Messages,i18n/Pages +server.port=80 \ No newline at end of file diff --git a/microboot-advance/target/classes/application.properties b/microboot-advance/target/classes/application.properties new file mode 100644 index 0000000..01308f4 --- /dev/null +++ b/microboot-advance/target/classes/application.properties @@ -0,0 +1 @@ +spring.profiles.active=product diff --git a/microboot-advance/target/classes/cn/mldn/microboot/StartSpringBootMain.class b/microboot-advance/target/classes/cn/mldn/microboot/StartSpringBootMain.class new file mode 100644 index 0000000..57c4fba Binary files /dev/null and b/microboot-advance/target/classes/cn/mldn/microboot/StartSpringBootMain.class differ diff --git a/microboot-advance/target/classes/cn/mldn/microboot/controller/MessageController.class b/microboot-advance/target/classes/cn/mldn/microboot/controller/MessageController.class new file mode 100644 index 0000000..9924444 Binary files /dev/null and b/microboot-advance/target/classes/cn/mldn/microboot/controller/MessageController.class differ diff --git a/microboot-advance/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class b/microboot-advance/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class new file mode 100644 index 0000000..57c2010 Binary files /dev/null and b/microboot-advance/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class differ diff --git a/microboot-advance/target/classes/i18n/Messages.properties b/microboot-advance/target/classes/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-advance/target/classes/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-advance/target/classes/i18n/Pages.properties b/microboot-advance/target/classes/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-advance/target/classes/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-advance/target/classes/static/images/mldn.ico b/microboot-advance/target/classes/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-advance/target/classes/static/images/mldn.ico differ diff --git a/microboot-advance/target/classes/static/message_index.html b/microboot-advance/target/classes/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-advance/target/classes/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-advance/target/classes/templates/message/message_show.html b/microboot-advance/target/classes/templates/message/message_show.html new file mode 100644 index 0000000..9126f0b --- /dev/null +++ b/microboot-advance/target/classes/templates/message/message_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + +

+

+ + \ No newline at end of file diff --git a/microboot-advance/target/test-classes/cn/mldn/microboot/AppTest.class b/microboot-advance/target/test-classes/cn/mldn/microboot/AppTest.class new file mode 100644 index 0000000..d317ee0 Binary files /dev/null and b/microboot-advance/target/test-classes/cn/mldn/microboot/AppTest.class differ diff --git a/microboot-advance/target/test-classes/cn/mldn/microboot/test/TestMessageController.class b/microboot-advance/target/test-classes/cn/mldn/microboot/test/TestMessageController.class new file mode 100644 index 0000000..c014017 Binary files /dev/null and b/microboot-advance/target/test-classes/cn/mldn/microboot/test/TestMessageController.class differ diff --git a/microboot-base/.classpath b/microboot-base/.classpath new file mode 100644 index 0000000..7200bb4 --- /dev/null +++ b/microboot-base/.classpath @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/microboot-base/.project b/microboot-base/.project new file mode 100644 index 0000000..0640b05 --- /dev/null +++ b/microboot-base/.project @@ -0,0 +1,35 @@ + + + microboot-base + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/microboot-base/.settings/org.eclipse.core.resources.prefs b/microboot-base/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..4c28b1a --- /dev/null +++ b/microboot-base/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/microboot-base/.settings/org.eclipse.jdt.core.prefs b/microboot-base/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..d59e09c --- /dev/null +++ b/microboot-base/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/microboot-base/.settings/org.eclipse.m2e.core.prefs b/microboot-base/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/microboot-base/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/microboot-base/.settings/org.eclipse.wst.common.project.facet.core.xml b/microboot-base/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..e822977 --- /dev/null +++ b/microboot-base/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ + + + + diff --git a/microboot-base/.springBeans b/microboot-base/.springBeans new file mode 100644 index 0000000..07cfecb --- /dev/null +++ b/microboot-base/.springBeans @@ -0,0 +1,16 @@ + + + 1 + + + + + + + java:cn.mldn.microboot.StartSpringBootMain + + + + + + diff --git a/microboot-base/pom.xml b/microboot-base/pom.xml new file mode 100644 index 0000000..54d1f23 --- /dev/null +++ b/microboot-base/pom.xml @@ -0,0 +1,42 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-base + microboot-base + http://maven.apache.org + + UTF-8 + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-base/src/main/java/cn/mldn/microboot/StartSpringBootMain.java b/microboot-base/src/main/java/cn/mldn/microboot/StartSpringBootMain.java new file mode 100644 index 0000000..87d91fa --- /dev/null +++ b/microboot-base/src/main/java/cn/mldn/microboot/StartSpringBootMain.java @@ -0,0 +1,10 @@ +package cn.mldn.microboot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +@SpringBootApplication // 启动SpringBoot程序,而后自带子包扫描 +public class StartSpringBootMain { + public static void main(String[] args) throws Exception { + SpringApplication.run(StartSpringBootMain.class, args); + } +} diff --git a/microboot-base/src/main/java/cn/mldn/microboot/controller/HelloController.java b/microboot-base/src/main/java/cn/mldn/microboot/controller/HelloController.java new file mode 100644 index 0000000..fda3229 --- /dev/null +++ b/microboot-base/src/main/java/cn/mldn/microboot/controller/HelloController.java @@ -0,0 +1,35 @@ +package cn.mldn.microboot.controller; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class HelloController { + @RequestMapping(value="/echo/{message}",method=RequestMethod.GET) + public String echo(@PathVariable("message") String msg) { + return "【ECHO】" + msg ; + } + @RequestMapping("/mul") + public Object mul(int num) { + return num * 2 ; + } + + @RequestMapping("/object") + public String object(HttpServletRequest request,HttpServletResponse response) { + System.out.println("*** 客户端IP地址:" + request.getRemoteAddr()); + System.out.println("*** 取得客户端响应编码:" + response.getCharacterEncoding()); + System.out.println("*** 取得SessionID:" + request.getSession().getId()); + System.out.println("*** 取得真实路径:" + request.getServletContext().getRealPath("/upload/")); + return "www.mldn.cn" ; + } + + @RequestMapping("/") + public String home() { + return "www.mldn.cn"; + } +} diff --git a/microboot-base/src/test/java/cn/mldn/microboot/AppTest.java b/microboot-base/src/test/java/cn/mldn/microboot/AppTest.java new file mode 100644 index 0000000..a094258 --- /dev/null +++ b/microboot-base/src/test/java/cn/mldn/microboot/AppTest.java @@ -0,0 +1,38 @@ +package cn.mldn.microboot; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/microboot-base/target/classes/META-INF/MANIFEST.MF b/microboot-base/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d4c16dd --- /dev/null +++ b/microboot-base/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Built-By: foreveriss +Build-Jdk: 1.8.0_121 +Created-By: Maven Integration for Eclipse + diff --git a/microboot-base/target/classes/META-INF/maven/cn.mldn/microboot-base/pom.properties b/microboot-base/target/classes/META-INF/maven/cn.mldn/microboot-base/pom.properties new file mode 100644 index 0000000..e2e2edf --- /dev/null +++ b/microboot-base/target/classes/META-INF/maven/cn.mldn/microboot-base/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Thu Jun 29 23:45:00 CST 2017 +version=0.0.1-SNAPSHOT +groupId=cn.mldn +m2e.projectName=microboot-base +m2e.projectLocation=/Users/foreveriss/workspace/microboot/microboot-base +artifactId=microboot-base diff --git a/microboot-base/target/classes/META-INF/maven/cn.mldn/microboot-base/pom.xml b/microboot-base/target/classes/META-INF/maven/cn.mldn/microboot-base/pom.xml new file mode 100644 index 0000000..54d1f23 --- /dev/null +++ b/microboot-base/target/classes/META-INF/maven/cn.mldn/microboot-base/pom.xml @@ -0,0 +1,42 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-base + microboot-base + http://maven.apache.org + + UTF-8 + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-base/target/classes/cn/mldn/microboot/StartSpringBootMain.class b/microboot-base/target/classes/cn/mldn/microboot/StartSpringBootMain.class new file mode 100644 index 0000000..57c4fba Binary files /dev/null and b/microboot-base/target/classes/cn/mldn/microboot/StartSpringBootMain.class differ diff --git a/microboot-base/target/classes/cn/mldn/microboot/controller/HelloController.class b/microboot-base/target/classes/cn/mldn/microboot/controller/HelloController.class new file mode 100644 index 0000000..01c30e6 Binary files /dev/null and b/microboot-base/target/classes/cn/mldn/microboot/controller/HelloController.class differ diff --git a/microboot-base/target/test-classes/cn/mldn/microboot/AppTest.class b/microboot-base/target/test-classes/cn/mldn/microboot/AppTest.class new file mode 100644 index 0000000..d317ee0 Binary files /dev/null and b/microboot-base/target/test-classes/cn/mldn/microboot/AppTest.class differ diff --git a/microboot-email/.classpath b/microboot-email/.classpath new file mode 100644 index 0000000..a6f04e8 --- /dev/null +++ b/microboot-email/.classpath @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/microboot-email/.project b/microboot-email/.project new file mode 100644 index 0000000..5edc880 --- /dev/null +++ b/microboot-email/.project @@ -0,0 +1,35 @@ + + + microboot-email + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/microboot-email/.settings/org.eclipse.core.resources.prefs b/microboot-email/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..a6dcfb7 --- /dev/null +++ b/microboot-email/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/main/view=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/microboot-email/.settings/org.eclipse.jdt.core.prefs b/microboot-email/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..d59e09c --- /dev/null +++ b/microboot-email/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/microboot-email/.settings/org.eclipse.m2e.core.prefs b/microboot-email/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/microboot-email/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/microboot-email/.settings/org.eclipse.wst.common.project.facet.core.xml b/microboot-email/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..e822977 --- /dev/null +++ b/microboot-email/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ + + + + diff --git a/microboot-email/pom.xml b/microboot-email/pom.xml new file mode 100644 index 0000000..f9ae343 --- /dev/null +++ b/microboot-email/pom.xml @@ -0,0 +1,67 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-email + microboot-email + http://maven.apache.org + + UTF-8 + + + + org.springframework.boot + spring-boot-starter-mail + + + + ch.qos.logback + logback-core + + + + org.springframework.kafka + spring-kafka + + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-email/src/main/java/cn/mldn/microboot/StartSpringBootMain.java b/microboot-email/src/main/java/cn/mldn/microboot/StartSpringBootMain.java new file mode 100644 index 0000000..8a58ff5 --- /dev/null +++ b/microboot-email/src/main/java/cn/mldn/microboot/StartSpringBootMain.java @@ -0,0 +1,15 @@ +package cn.mldn.microboot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication // 启动SpringBoot程序,而后自带子包扫描 +public class StartSpringBootMain { + static { + System.setProperty("java.security.auth.login.config", + "d:/kafka_client_jaas.conf"); // 表示系统环境属性 + } + public static void main(String[] args) throws Exception { + SpringApplication.run(StartSpringBootMain.class, args); + } +} diff --git a/microboot-email/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java b/microboot-email/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java new file mode 100644 index 0000000..5127e93 --- /dev/null +++ b/microboot-email/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java @@ -0,0 +1,15 @@ +package cn.mldn.microboot.util.controller; + +import java.util.Locale; + +import javax.annotation.Resource; + +import org.springframework.context.MessageSource; + +public abstract class AbstractBaseController { + @Resource + private MessageSource messageSource; // 自动注入此资源对象 + public String getMessage(String key, String... args) { + return this.messageSource.getMessage(key, args, Locale.getDefault()); + } +} diff --git a/microboot-email/src/main/java/cn/mldn/microboot/vo/Dept.java b/microboot-email/src/main/java/cn/mldn/microboot/vo/Dept.java new file mode 100644 index 0000000..7971469 --- /dev/null +++ b/microboot-email/src/main/java/cn/mldn/microboot/vo/Dept.java @@ -0,0 +1,25 @@ +package cn.mldn.microboot.vo; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class Dept implements Serializable { + private Long deptno ; + private String dname ; + public Long getDeptno() { + return deptno; + } + public void setDeptno(Long deptno) { + this.deptno = deptno; + } + public String getDname() { + return dname; + } + public void setDname(String dname) { + this.dname = dname; + } + @Override + public String toString() { + return "Dept [deptno=" + deptno + ", dname=" + dname + "]"; + } +} diff --git a/microboot-email/src/main/java/cn/mldn/microboot/vo/Member.java b/microboot-email/src/main/java/cn/mldn/microboot/vo/Member.java new file mode 100644 index 0000000..f6a9cd8 --- /dev/null +++ b/microboot-email/src/main/java/cn/mldn/microboot/vo/Member.java @@ -0,0 +1,44 @@ +package cn.mldn.microboot.vo; + +import java.io.Serializable; +import java.util.Date; + +@SuppressWarnings("serial") +public class Member implements Serializable { + private Long mid ; + private String name ; + private Integer age ; + private Date birthday ; + private Double salary ; + public Long getMid() { + return mid; + } + public void setMid(Long mid) { + this.mid = mid; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public Integer getAge() { + return age; + } + public void setAge(Integer age) { + this.age = age; + } + public Date getBirthday() { + return birthday; + } + public void setBirthday(Date birthday) { + this.birthday = birthday; + } + public Double getSalary() { + return salary; + } + public void setSalary(Double salary) { + this.salary = salary; + } +} + diff --git a/microboot-email/src/main/java/数据库创建脚本.sql b/microboot-email/src/main/java/数据库创建脚本.sql new file mode 100644 index 0000000..edd35b2 --- /dev/null +++ b/microboot-email/src/main/java/数据库创建脚本.sql @@ -0,0 +1,13 @@ +DROP DATBASE IF EXISTS mldn ; +CREATE DATBASE mldn CHARACTER SET UTF8 ; +USE mldn ; +CREATE TABLE dept ( + deptno BIGINT AUTO_INCREMENT , + dname VARCHAR(50) , + CONSTRAINT pk_deptno PRIMARY KEY(deptno) +) ; +INSERT INTO dept(dname) VALUES ('开发部') ; +INSERT INTO dept(dname) VALUES ('财务部') ; +INSERT INTO dept(dname) VALUES ('市场部') ; +INSERT INTO dept(dname) VALUES ('后勤部') ; +INSERT INTO dept(dname) VALUES ('公关部') ; \ No newline at end of file diff --git a/microboot-email/src/main/resources/application.yml b/microboot-email/src/main/resources/application.yml new file mode 100644 index 0000000..4a5738c --- /dev/null +++ b/microboot-email/src/main/resources/application.yml @@ -0,0 +1,11 @@ +spring: + messages: + basename: i18n/Messages,i18n/Pages + mail: + host: smtp.qq.com + username: 你自己的用户名,110@qq.com + password: xxxxx + properties: + mail.smtp.auth: true + mail.smtp.starttls.enable: true + mail.smtp.starttls.required: true diff --git a/microboot-email/src/main/resources/i18n/Messages.properties b/microboot-email/src/main/resources/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-email/src/main/resources/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-email/src/main/resources/i18n/Pages.properties b/microboot-email/src/main/resources/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-email/src/main/resources/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-email/src/main/resources/logback.xml b/microboot-email/src/main/resources/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-email/src/main/resources/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-email/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml b/microboot-email/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml new file mode 100644 index 0000000..6557a3a --- /dev/null +++ b/microboot-email/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml @@ -0,0 +1,11 @@ + + + + + + INSERT INTO dept(dname) VALUES (#{dname}) ; + + diff --git a/microboot-email/src/main/resources/mybatis/mybatis.cfg.xml b/microboot-email/src/main/resources/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4d128c0 --- /dev/null +++ b/microboot-email/src/main/resources/mybatis/mybatis.cfg.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/microboot-email/src/main/view/static/images/mldn.ico b/microboot-email/src/main/view/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-email/src/main/view/static/images/mldn.ico differ diff --git a/microboot-email/src/main/view/static/info/message_info.html b/microboot-email/src/main/view/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-email/src/main/view/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-email/src/main/view/static/js/main.js b/microboot-email/src/main/view/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-email/src/main/view/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-email/src/main/view/static/message_index.html b/microboot-email/src/main/view/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-email/src/main/view/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-email/src/main/view/templates/upload_page.html b/microboot-email/src/main/view/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-email/src/main/view/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-email/src/main/view/templates/upload_show.html b/microboot-email/src/main/view/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-email/src/main/view/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-email/src/test/java/cn/mldn/microboot/TestMail.java b/microboot-email/src/test/java/cn/mldn/microboot/TestMail.java new file mode 100644 index 0000000..be9a0bc --- /dev/null +++ b/microboot-email/src/test/java/cn/mldn/microboot/TestMail.java @@ -0,0 +1,25 @@ +package cn.mldn.microboot; +import javax.annotation.Resource; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.mail.SimpleMailMessage; +import org.springframework.mail.javamail.JavaMailSender; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; +@SpringBootTest(classes = StartSpringBootMain.class) +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +public class TestMail { + @Resource + private JavaMailSender javaMailSender ; + @Test + public void testSendMail() { + SimpleMailMessage message = new SimpleMailMessage() ; // 要发送的消息内容 + message.setFrom("你自己的邮箱地址,110@qq.com"); + message.setTo("接收者的邮箱地址,220@qq.com"); + message.setSubject("测试邮件(来自老李的祝福,www.mldn.cn)"); + message.setText("好好学习,天天向上,学习就登录www.mldn.cn"); + this.javaMailSender.send(message); + } +} diff --git a/microboot-email/target/classes/META-INF/MANIFEST.MF b/microboot-email/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d4c16dd --- /dev/null +++ b/microboot-email/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Built-By: foreveriss +Build-Jdk: 1.8.0_121 +Created-By: Maven Integration for Eclipse + diff --git a/microboot-email/target/classes/META-INF/maven/cn.mldn/microboot-email/pom.properties b/microboot-email/target/classes/META-INF/maven/cn.mldn/microboot-email/pom.properties new file mode 100644 index 0000000..fb95e4e --- /dev/null +++ b/microboot-email/target/classes/META-INF/maven/cn.mldn/microboot-email/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Thu Jun 29 23:45:01 CST 2017 +version=0.0.1-SNAPSHOT +groupId=cn.mldn +m2e.projectName=microboot-email +m2e.projectLocation=/Users/foreveriss/workspace/microboot/microboot-email +artifactId=microboot-email diff --git a/microboot-email/target/classes/META-INF/maven/cn.mldn/microboot-email/pom.xml b/microboot-email/target/classes/META-INF/maven/cn.mldn/microboot-email/pom.xml new file mode 100644 index 0000000..f9ae343 --- /dev/null +++ b/microboot-email/target/classes/META-INF/maven/cn.mldn/microboot-email/pom.xml @@ -0,0 +1,67 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-email + microboot-email + http://maven.apache.org + + UTF-8 + + + + org.springframework.boot + spring-boot-starter-mail + + + + ch.qos.logback + logback-core + + + + org.springframework.kafka + spring-kafka + + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-email/target/classes/application.yml b/microboot-email/target/classes/application.yml new file mode 100644 index 0000000..4a5738c --- /dev/null +++ b/microboot-email/target/classes/application.yml @@ -0,0 +1,11 @@ +spring: + messages: + basename: i18n/Messages,i18n/Pages + mail: + host: smtp.qq.com + username: 你自己的用户名,110@qq.com + password: xxxxx + properties: + mail.smtp.auth: true + mail.smtp.starttls.enable: true + mail.smtp.starttls.required: true diff --git a/microboot-email/target/classes/cn/mldn/microboot/StartSpringBootMain.class b/microboot-email/target/classes/cn/mldn/microboot/StartSpringBootMain.class new file mode 100644 index 0000000..18bb195 Binary files /dev/null and b/microboot-email/target/classes/cn/mldn/microboot/StartSpringBootMain.class differ diff --git a/microboot-email/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class b/microboot-email/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class new file mode 100644 index 0000000..57c2010 Binary files /dev/null and b/microboot-email/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class differ diff --git a/microboot-email/target/classes/cn/mldn/microboot/vo/Dept.class b/microboot-email/target/classes/cn/mldn/microboot/vo/Dept.class new file mode 100644 index 0000000..46f2356 Binary files /dev/null and b/microboot-email/target/classes/cn/mldn/microboot/vo/Dept.class differ diff --git a/microboot-email/target/classes/cn/mldn/microboot/vo/Member.class b/microboot-email/target/classes/cn/mldn/microboot/vo/Member.class new file mode 100644 index 0000000..59c00d5 Binary files /dev/null and b/microboot-email/target/classes/cn/mldn/microboot/vo/Member.class differ diff --git a/microboot-email/target/classes/i18n/Messages.properties b/microboot-email/target/classes/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-email/target/classes/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-email/target/classes/i18n/Pages.properties b/microboot-email/target/classes/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-email/target/classes/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-email/target/classes/logback.xml b/microboot-email/target/classes/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-email/target/classes/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-email/target/classes/mybatis/mapper/cn/mldn/Dept.xml b/microboot-email/target/classes/mybatis/mapper/cn/mldn/Dept.xml new file mode 100644 index 0000000..6557a3a --- /dev/null +++ b/microboot-email/target/classes/mybatis/mapper/cn/mldn/Dept.xml @@ -0,0 +1,11 @@ + + + + + + INSERT INTO dept(dname) VALUES (#{dname}) ; + + diff --git a/microboot-email/target/classes/mybatis/mybatis.cfg.xml b/microboot-email/target/classes/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4d128c0 --- /dev/null +++ b/microboot-email/target/classes/mybatis/mybatis.cfg.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/microboot-email/target/classes/static/images/mldn.ico b/microboot-email/target/classes/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-email/target/classes/static/images/mldn.ico differ diff --git a/microboot-email/target/classes/static/info/message_info.html b/microboot-email/target/classes/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-email/target/classes/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-email/target/classes/static/js/main.js b/microboot-email/target/classes/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-email/target/classes/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-email/target/classes/static/message_index.html b/microboot-email/target/classes/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-email/target/classes/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-email/target/classes/templates/upload_page.html b/microboot-email/target/classes/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-email/target/classes/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-email/target/classes/templates/upload_show.html b/microboot-email/target/classes/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-email/target/classes/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-email/target/test-classes/cn/mldn/microboot/TestMail.class b/microboot-email/target/test-classes/cn/mldn/microboot/TestMail.class new file mode 100644 index 0000000..1be632e Binary files /dev/null and b/microboot-email/target/test-classes/cn/mldn/microboot/TestMail.class differ diff --git a/microboot-error/.classpath b/microboot-error/.classpath new file mode 100644 index 0000000..a6f04e8 --- /dev/null +++ b/microboot-error/.classpath @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/microboot-error/.project b/microboot-error/.project new file mode 100644 index 0000000..17e6874 --- /dev/null +++ b/microboot-error/.project @@ -0,0 +1,35 @@ + + + microboot-error + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/microboot-error/.settings/org.eclipse.core.resources.prefs b/microboot-error/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..a6dcfb7 --- /dev/null +++ b/microboot-error/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/main/view=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/microboot-error/.settings/org.eclipse.jdt.core.prefs b/microboot-error/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..d59e09c --- /dev/null +++ b/microboot-error/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/microboot-error/.settings/org.eclipse.m2e.core.prefs b/microboot-error/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/microboot-error/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/microboot-error/.settings/org.eclipse.wst.common.project.facet.core.xml b/microboot-error/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..e822977 --- /dev/null +++ b/microboot-error/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ + + + + diff --git a/microboot-error/pom.xml b/microboot-error/pom.xml new file mode 100644 index 0000000..8be6ac4 --- /dev/null +++ b/microboot-error/pom.xml @@ -0,0 +1,52 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-error + microboot-error + http://maven.apache.org + + UTF-8 + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-error/src/main/java/cn/mldn/microboot/StartSpringBootMain.java b/microboot-error/src/main/java/cn/mldn/microboot/StartSpringBootMain.java new file mode 100644 index 0000000..9b39a0d --- /dev/null +++ b/microboot-error/src/main/java/cn/mldn/microboot/StartSpringBootMain.java @@ -0,0 +1,14 @@ +package cn.mldn.microboot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer; +import org.springframework.context.annotation.ComponentScan; +@SpringBootApplication // 启动SpringBoot程序,而后自带子包扫描 +@ComponentScan("cn.mldn.microboot") +public class StartSpringBootMain { + + public static void main(String[] args) throws Exception { + SpringApplication.run(StartSpringBootMain.class, args); + } +} diff --git a/microboot-error/src/main/java/cn/mldn/microboot/advice/GlobalExceptionHandler.java b/microboot-error/src/main/java/cn/mldn/microboot/advice/GlobalExceptionHandler.java new file mode 100644 index 0000000..1214c4b --- /dev/null +++ b/microboot-error/src/main/java/cn/mldn/microboot/advice/GlobalExceptionHandler.java @@ -0,0 +1,50 @@ +package cn.mldn.microboot.advice; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; + +//@ControllerAdvice// 作为一个控制层的切面处理 +@RestControllerAdvice +public class GlobalExceptionHandler { + public static final String DEFAULT_ERROR_VIEW = "error"; // 定义错误显示页,error.html + @ExceptionHandler(Exception.class) // 所有的异常都是Exception子类 + public Object defaultErrorHandler(HttpServletRequest request,Exception e) { + class ErrorInfo { + private Integer code ; + private String message ; + private String url ; + public Integer getCode() { + return code; + } + public void setCode(Integer code) { + this.code = code; + } + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + public String getUrl() { + return url; + } + public void setUrl(String url) { + this.url = url; + } + } + ErrorInfo info = new ErrorInfo() ; + info.setCode(100); // 标记一个错误信息类型 + info.setMessage(e.getMessage()); + info.setUrl(request.getRequestURL().toString()); + return info ; + } +// public ModelAndView defaultErrorHandler(HttpServletRequest request, +// Exception e) { // 出现异常之后会跳转到此方法 +// ModelAndView mav = new ModelAndView(DEFAULT_ERROR_VIEW); // 设置跳转路径 +// mav.addObject("exception", e); // 将异常对象传递过去 +// mav.addObject("url", request.getRequestURL()); // 获得请求的路径 +// return mav; +// } +} diff --git a/microboot-error/src/main/java/cn/mldn/microboot/config/ErrorPageConfig.java b/microboot-error/src/main/java/cn/mldn/microboot/config/ErrorPageConfig.java new file mode 100644 index 0000000..0a02b4b --- /dev/null +++ b/microboot-error/src/main/java/cn/mldn/microboot/config/ErrorPageConfig.java @@ -0,0 +1,29 @@ +package cn.mldn.microboot.config; + +import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; +import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer; +import org.springframework.boot.web.servlet.ErrorPage; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.HttpStatus; + +@Configuration +public class ErrorPageConfig { + //@Bean +// public EmbeddedServletContainerCustomizer containerCustomizer() { +// return new EmbeddedServletContainerCustomizer() { +// @Override +// public void customize( +// ConfigurableEmbeddedServletContainer container) { +// ErrorPage errorPage400 = new ErrorPage(HttpStatus.BAD_REQUEST, +// "/error-400.html"); +// ErrorPage errorPage404 = new ErrorPage(HttpStatus.NOT_FOUND, +// "/error-404.html"); +// ErrorPage errorPage500 = new ErrorPage( +// HttpStatus.INTERNAL_SERVER_ERROR, "/error-500.html"); +// container.addErrorPages(errorPage400, errorPage404, +// errorPage500); +// } +// }; +// } +} diff --git a/microboot-error/src/main/java/cn/mldn/microboot/controller/MemberController.java b/microboot-error/src/main/java/cn/mldn/microboot/controller/MemberController.java new file mode 100644 index 0000000..00c719c --- /dev/null +++ b/microboot-error/src/main/java/cn/mldn/microboot/controller/MemberController.java @@ -0,0 +1,29 @@ +package cn.mldn.microboot.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import cn.mldn.microboot.util.controller.AbstractBaseController; +import cn.mldn.microboot.vo.Member; + +@Controller +public class MemberController extends AbstractBaseController { + @RequestMapping(value="/get") + @ResponseBody + public String get() { + System.out.println("除法计算:" + (10 / 0)); + return "hello world" ; + } + + @RequestMapping(value = "/add", method = RequestMethod.POST) + @ResponseBody + public Object add(Member vo) { // 增加前的准备操作路径 + return vo; + } + @RequestMapping(value = "/addPre", method = RequestMethod.GET) + public String addPre() { // 增加前的准备操作路径 + return "member_add"; + } +} diff --git a/microboot-error/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java b/microboot-error/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java new file mode 100644 index 0000000..93c1b2c --- /dev/null +++ b/microboot-error/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java @@ -0,0 +1,27 @@ +package cn.mldn.microboot.util.controller; + +import java.text.SimpleDateFormat; +import java.util.Locale; + +import javax.annotation.Resource; + +import org.springframework.beans.propertyeditors.CustomDateEditor; +import org.springframework.context.MessageSource; +import org.springframework.web.bind.WebDataBinder; +import org.springframework.web.bind.annotation.InitBinder; + +public abstract class AbstractBaseController { + @Resource + private MessageSource messageSource; // 自动注入此资源对象 + public String getMessage(String key, String... args) { + return this.messageSource.getMessage(key, args, Locale.getDefault()); + } + @InitBinder + public void initBinder(WebDataBinder binder) { // 在本程序里面需要针对于日期格式进行处理 + // 首先建立一个可以将字符串转换为日期的工具程序类 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd") ; + // 明确的描述此时需要注册一个日期格式的转化处理程序类 + binder.registerCustomEditor(java.util.Date.class, new CustomDateEditor(sdf, true)); + } + +} diff --git a/microboot-error/src/main/java/cn/mldn/microboot/vo/Member.java b/microboot-error/src/main/java/cn/mldn/microboot/vo/Member.java new file mode 100644 index 0000000..d3ac3ad --- /dev/null +++ b/microboot-error/src/main/java/cn/mldn/microboot/vo/Member.java @@ -0,0 +1,41 @@ +package cn.mldn.microboot.vo; + +import java.io.Serializable; +import java.util.Date; + +@SuppressWarnings("serial") +public class Member implements Serializable { + private String mid; + private Integer age; + private Double salary; + private Date birthday; + public String getMid() { + return mid; + } + public void setMid(String mid) { + this.mid = mid; + } + public Integer getAge() { + return age; + } + public void setAge(Integer age) { + this.age = age; + } + public Double getSalary() { + return salary; + } + public void setSalary(Double salary) { + this.salary = salary; + } + public Date getBirthday() { + return birthday; + } + public void setBirthday(Date birthday) { + this.birthday = birthday; + } + @Override + public String toString() { + return "Member [mid=" + mid + ", age=" + age + ", salary=" + salary + + ", birthday=" + birthday + "]"; + } +} diff --git a/microboot-error/src/main/resources/application.yml b/microboot-error/src/main/resources/application.yml new file mode 100644 index 0000000..f133cf8 --- /dev/null +++ b/microboot-error/src/main/resources/application.yml @@ -0,0 +1,2 @@ +server: + port: 80 \ No newline at end of file diff --git a/microboot-error/src/main/resources/i18n/Messages.properties b/microboot-error/src/main/resources/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-error/src/main/resources/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-error/src/main/resources/i18n/Pages.properties b/microboot-error/src/main/resources/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-error/src/main/resources/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-error/src/main/view/static/error-400.html b/microboot-error/src/main/view/static/error-400.html new file mode 100644 index 0000000..b2c0354 --- /dev/null +++ b/microboot-error/src/main/view/static/error-400.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + +

对不起,出现了400错误!

+ + + \ No newline at end of file diff --git a/microboot-error/src/main/view/static/error-404.html b/microboot-error/src/main/view/static/error-404.html new file mode 100644 index 0000000..b8c630a --- /dev/null +++ b/microboot-error/src/main/view/static/error-404.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + +

对不起,出现了404错误!

+ + + \ No newline at end of file diff --git a/microboot-error/src/main/view/static/error-500.html b/microboot-error/src/main/view/static/error-500.html new file mode 100644 index 0000000..5e115ec --- /dev/null +++ b/microboot-error/src/main/view/static/error-500.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + +

对不起,出现了500错误!

+ + + \ No newline at end of file diff --git a/microboot-error/src/main/view/static/images/dog.jpg b/microboot-error/src/main/view/static/images/dog.jpg new file mode 100644 index 0000000..07753f6 Binary files /dev/null and b/microboot-error/src/main/view/static/images/dog.jpg differ diff --git a/microboot-error/src/main/view/static/images/mldn.ico b/microboot-error/src/main/view/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-error/src/main/view/static/images/mldn.ico differ diff --git a/microboot-error/src/main/view/static/message_index.html b/microboot-error/src/main/view/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-error/src/main/view/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-error/src/main/view/templates/error.html b/microboot-error/src/main/view/templates/error.html new file mode 100644 index 0000000..844ac14 --- /dev/null +++ b/microboot-error/src/main/view/templates/error.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + +

+

+ + \ No newline at end of file diff --git a/microboot-error/src/main/view/templates/member_add.html b/microboot-error/src/main/view/templates/member_add.html new file mode 100644 index 0000000..bf0ff61 --- /dev/null +++ b/microboot-error/src/main/view/templates/member_add.html @@ -0,0 +1,18 @@ + + + + SpringBoot模版渲染 + + + + +

+ 用户邮箱:
+ 用户年龄:
+ 用户工资:
+ 用户生日:
+ + +
+ + \ No newline at end of file diff --git a/microboot-error/src/main/view/templates/message/message_show.html b/microboot-error/src/main/view/templates/message/message_show.html new file mode 100644 index 0000000..9126f0b --- /dev/null +++ b/microboot-error/src/main/view/templates/message/message_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + +

+

+ + \ No newline at end of file diff --git a/microboot-error/src/test/java/cn/mldn/microboot/AppTest.java b/microboot-error/src/test/java/cn/mldn/microboot/AppTest.java new file mode 100644 index 0000000..a094258 --- /dev/null +++ b/microboot-error/src/test/java/cn/mldn/microboot/AppTest.java @@ -0,0 +1,38 @@ +package cn.mldn.microboot; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/microboot-error/src/test/java/cn/mldn/microboot/test/TestMessageController.java b/microboot-error/src/test/java/cn/mldn/microboot/test/TestMessageController.java new file mode 100644 index 0000000..2f21c5d --- /dev/null +++ b/microboot-error/src/test/java/cn/mldn/microboot/test/TestMessageController.java @@ -0,0 +1,19 @@ +package cn.mldn.microboot.test; + +import javax.annotation.Resource; + +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +import cn.mldn.microboot.StartSpringBootMain; +import cn.mldn.microboot.controller.MemberController; + +@SpringBootTest(classes = StartSpringBootMain.class) +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +public class TestMessageController { + @Resource + private MemberController messageController; +} diff --git a/microboot-error/target/classes/META-INF/MANIFEST.MF b/microboot-error/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d4c16dd --- /dev/null +++ b/microboot-error/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Built-By: foreveriss +Build-Jdk: 1.8.0_121 +Created-By: Maven Integration for Eclipse + diff --git a/microboot-error/target/classes/META-INF/maven/cn.mldn/microboot-error/pom.properties b/microboot-error/target/classes/META-INF/maven/cn.mldn/microboot-error/pom.properties new file mode 100644 index 0000000..3e1aaac --- /dev/null +++ b/microboot-error/target/classes/META-INF/maven/cn.mldn/microboot-error/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Thu Jun 29 23:45:02 CST 2017 +version=0.0.1-SNAPSHOT +groupId=cn.mldn +m2e.projectName=microboot-error +m2e.projectLocation=/Users/foreveriss/workspace/microboot/microboot-error +artifactId=microboot-error diff --git a/microboot-error/target/classes/META-INF/maven/cn.mldn/microboot-error/pom.xml b/microboot-error/target/classes/META-INF/maven/cn.mldn/microboot-error/pom.xml new file mode 100644 index 0000000..8be6ac4 --- /dev/null +++ b/microboot-error/target/classes/META-INF/maven/cn.mldn/microboot-error/pom.xml @@ -0,0 +1,52 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-error + microboot-error + http://maven.apache.org + + UTF-8 + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-error/target/classes/application.yml b/microboot-error/target/classes/application.yml new file mode 100644 index 0000000..f133cf8 --- /dev/null +++ b/microboot-error/target/classes/application.yml @@ -0,0 +1,2 @@ +server: + port: 80 \ No newline at end of file diff --git a/microboot-error/target/classes/cn/mldn/microboot/StartSpringBootMain.class b/microboot-error/target/classes/cn/mldn/microboot/StartSpringBootMain.class new file mode 100644 index 0000000..f510f9b Binary files /dev/null and b/microboot-error/target/classes/cn/mldn/microboot/StartSpringBootMain.class differ diff --git a/microboot-error/target/classes/cn/mldn/microboot/advice/GlobalExceptionHandler$1ErrorInfo.class b/microboot-error/target/classes/cn/mldn/microboot/advice/GlobalExceptionHandler$1ErrorInfo.class new file mode 100644 index 0000000..75991a7 Binary files /dev/null and b/microboot-error/target/classes/cn/mldn/microboot/advice/GlobalExceptionHandler$1ErrorInfo.class differ diff --git a/microboot-error/target/classes/cn/mldn/microboot/advice/GlobalExceptionHandler.class b/microboot-error/target/classes/cn/mldn/microboot/advice/GlobalExceptionHandler.class new file mode 100644 index 0000000..7d764b7 Binary files /dev/null and b/microboot-error/target/classes/cn/mldn/microboot/advice/GlobalExceptionHandler.class differ diff --git a/microboot-error/target/classes/cn/mldn/microboot/config/ErrorPageConfig.class b/microboot-error/target/classes/cn/mldn/microboot/config/ErrorPageConfig.class new file mode 100644 index 0000000..f074ab1 Binary files /dev/null and b/microboot-error/target/classes/cn/mldn/microboot/config/ErrorPageConfig.class differ diff --git a/microboot-error/target/classes/cn/mldn/microboot/controller/MemberController.class b/microboot-error/target/classes/cn/mldn/microboot/controller/MemberController.class new file mode 100644 index 0000000..725898e Binary files /dev/null and b/microboot-error/target/classes/cn/mldn/microboot/controller/MemberController.class differ diff --git a/microboot-error/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class b/microboot-error/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class new file mode 100644 index 0000000..e043da7 Binary files /dev/null and b/microboot-error/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class differ diff --git a/microboot-error/target/classes/cn/mldn/microboot/vo/Member.class b/microboot-error/target/classes/cn/mldn/microboot/vo/Member.class new file mode 100644 index 0000000..d4a21c9 Binary files /dev/null and b/microboot-error/target/classes/cn/mldn/microboot/vo/Member.class differ diff --git a/microboot-error/target/classes/i18n/Messages.properties b/microboot-error/target/classes/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-error/target/classes/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-error/target/classes/i18n/Pages.properties b/microboot-error/target/classes/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-error/target/classes/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-error/target/classes/static/error-400.html b/microboot-error/target/classes/static/error-400.html new file mode 100644 index 0000000..b2c0354 --- /dev/null +++ b/microboot-error/target/classes/static/error-400.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + +

对不起,出现了400错误!

+ + + \ No newline at end of file diff --git a/microboot-error/target/classes/static/error-404.html b/microboot-error/target/classes/static/error-404.html new file mode 100644 index 0000000..b8c630a --- /dev/null +++ b/microboot-error/target/classes/static/error-404.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + +

对不起,出现了404错误!

+ + + \ No newline at end of file diff --git a/microboot-error/target/classes/static/error-500.html b/microboot-error/target/classes/static/error-500.html new file mode 100644 index 0000000..5e115ec --- /dev/null +++ b/microboot-error/target/classes/static/error-500.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + +

对不起,出现了500错误!

+ + + \ No newline at end of file diff --git a/microboot-error/target/classes/static/images/dog.jpg b/microboot-error/target/classes/static/images/dog.jpg new file mode 100644 index 0000000..07753f6 Binary files /dev/null and b/microboot-error/target/classes/static/images/dog.jpg differ diff --git a/microboot-error/target/classes/static/images/mldn.ico b/microboot-error/target/classes/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-error/target/classes/static/images/mldn.ico differ diff --git a/microboot-error/target/classes/static/message_index.html b/microboot-error/target/classes/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-error/target/classes/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-error/target/classes/templates/error.html b/microboot-error/target/classes/templates/error.html new file mode 100644 index 0000000..844ac14 --- /dev/null +++ b/microboot-error/target/classes/templates/error.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + +

+

+ + \ No newline at end of file diff --git a/microboot-error/target/classes/templates/member_add.html b/microboot-error/target/classes/templates/member_add.html new file mode 100644 index 0000000..bf0ff61 --- /dev/null +++ b/microboot-error/target/classes/templates/member_add.html @@ -0,0 +1,18 @@ + + + + SpringBoot模版渲染 + + + + +

+ 用户邮箱:
+ 用户年龄:
+ 用户工资:
+ 用户生日:
+ + +
+ + \ No newline at end of file diff --git a/microboot-error/target/classes/templates/message/message_show.html b/microboot-error/target/classes/templates/message/message_show.html new file mode 100644 index 0000000..9126f0b --- /dev/null +++ b/microboot-error/target/classes/templates/message/message_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + +

+

+ + \ No newline at end of file diff --git a/microboot-error/target/test-classes/cn/mldn/microboot/AppTest.class b/microboot-error/target/test-classes/cn/mldn/microboot/AppTest.class new file mode 100644 index 0000000..d317ee0 Binary files /dev/null and b/microboot-error/target/test-classes/cn/mldn/microboot/AppTest.class differ diff --git a/microboot-error/target/test-classes/cn/mldn/microboot/test/TestMessageController.class b/microboot-error/target/test-classes/cn/mldn/microboot/test/TestMessageController.class new file mode 100644 index 0000000..d803ec7 Binary files /dev/null and b/microboot-error/target/test-classes/cn/mldn/microboot/test/TestMessageController.class differ diff --git a/microboot-interceptor/.classpath b/microboot-interceptor/.classpath new file mode 100644 index 0000000..a6f04e8 --- /dev/null +++ b/microboot-interceptor/.classpath @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/microboot-interceptor/.project b/microboot-interceptor/.project new file mode 100644 index 0000000..2182486 --- /dev/null +++ b/microboot-interceptor/.project @@ -0,0 +1,35 @@ + + + microboot-interceptor + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/microboot-interceptor/.settings/org.eclipse.core.resources.prefs b/microboot-interceptor/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..a6dcfb7 --- /dev/null +++ b/microboot-interceptor/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/main/view=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/microboot-interceptor/.settings/org.eclipse.jdt.core.prefs b/microboot-interceptor/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..d59e09c --- /dev/null +++ b/microboot-interceptor/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/microboot-interceptor/.settings/org.eclipse.m2e.core.prefs b/microboot-interceptor/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/microboot-interceptor/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/microboot-interceptor/.settings/org.eclipse.wst.common.project.facet.core.xml b/microboot-interceptor/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..e822977 --- /dev/null +++ b/microboot-interceptor/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ + + + + diff --git a/microboot-interceptor/pom.xml b/microboot-interceptor/pom.xml new file mode 100644 index 0000000..bd18012 --- /dev/null +++ b/microboot-interceptor/pom.xml @@ -0,0 +1,63 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-interceptor + microboot-interceptor + http://maven.apache.org + + UTF-8 + + + + org.springframework.boot + spring-boot-starter-aop + + + + com.github.kischang + fastdfs-client + 0.1 + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-interceptor/src/main/java/cn/mldn/microboot/StartSpringBootMain.java b/microboot-interceptor/src/main/java/cn/mldn/microboot/StartSpringBootMain.java new file mode 100644 index 0000000..3e42f08 --- /dev/null +++ b/microboot-interceptor/src/main/java/cn/mldn/microboot/StartSpringBootMain.java @@ -0,0 +1,11 @@ +package cn.mldn.microboot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.web.multipart.MultipartFile; +@SpringBootApplication // 启动SpringBoot程序,而后自带子包扫描 +public class StartSpringBootMain { + public static void main(String[] args) throws Exception { + SpringApplication.run(StartSpringBootMain.class, args); + } +} diff --git a/microboot-interceptor/src/main/java/cn/mldn/microboot/config/MyWebApplicationConfig.java b/microboot-interceptor/src/main/java/cn/mldn/microboot/config/MyWebApplicationConfig.java new file mode 100644 index 0000000..6b6ed2c --- /dev/null +++ b/microboot-interceptor/src/main/java/cn/mldn/microboot/config/MyWebApplicationConfig.java @@ -0,0 +1,16 @@ +package cn.mldn.microboot.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; + +import cn.mldn.util.MyInterceptor; + +@Configuration +public class MyWebApplicationConfig extends WebMvcConfigurerAdapter { // 定义MVC配置 + @Override + public void addInterceptors(InterceptorRegistry registry) { // 进行拦截器的注册处理操作 + registry.addInterceptor(new MyInterceptor()).addPathPatterns("/**") ; // 匹配路径 + super.addInterceptors(registry); + } +} diff --git a/microboot-interceptor/src/main/java/cn/mldn/microboot/config/ServiceAspect.java b/microboot-interceptor/src/main/java/cn/mldn/microboot/config/ServiceAspect.java new file mode 100644 index 0000000..b68283e --- /dev/null +++ b/microboot-interceptor/src/main/java/cn/mldn/microboot/config/ServiceAspect.java @@ -0,0 +1,24 @@ +package cn.mldn.microboot.config; + +import java.util.Arrays; + +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +@Aspect +@Component +public class ServiceAspect { // 此时定义有一个业务层的拦截处理 + private Logger log = LoggerFactory.getLogger(ServiceAspect.class); + @Around("execution(* cn.mldn..service..*.*(..))") + public Object arroundInvoke(ProceedingJoinPoint point) throws Throwable { + this.log.info("【*** Service-Before ***】执行参数:" + + Arrays.toString(point.getArgs())); + Object obj = point.proceed(point.getArgs()); // 进行具体业务调用 + this.log.info("【*** Service-After ***】返回结果:" + obj); + return obj; + } +} diff --git a/microboot-interceptor/src/main/java/cn/mldn/microboot/controller/MemberController.java b/microboot-interceptor/src/main/java/cn/mldn/microboot/controller/MemberController.java new file mode 100644 index 0000000..743236f --- /dev/null +++ b/microboot-interceptor/src/main/java/cn/mldn/microboot/controller/MemberController.java @@ -0,0 +1,32 @@ +package cn.mldn.microboot.controller; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import cn.mldn.microboot.service.IMemberService; +import cn.mldn.microboot.util.controller.AbstractBaseController; +import cn.mldn.microboot.vo.Member; + +@Controller +public class MemberController extends AbstractBaseController { + @RequestMapping(value = "/member_add_pre", method = RequestMethod.GET) + public String memberAddPre() { + return "member_add"; + } + @RequestMapping(value = "/member_add", method = RequestMethod.POST) + @ResponseBody + public Object memberAdd(Member member) { + return member ; + } + @Resource + private IMemberService memberService ; + @RequestMapping(value = "/member_get", method = RequestMethod.GET) + @ResponseBody + public Object get(long mid) { + return this.memberService.get(mid) ; + } +} diff --git a/microboot-interceptor/src/main/java/cn/mldn/microboot/service/IMemberService.java b/microboot-interceptor/src/main/java/cn/mldn/microboot/service/IMemberService.java new file mode 100644 index 0000000..617f8d0 --- /dev/null +++ b/microboot-interceptor/src/main/java/cn/mldn/microboot/service/IMemberService.java @@ -0,0 +1,7 @@ +package cn.mldn.microboot.service; + +import cn.mldn.microboot.vo.Member; + +public interface IMemberService { + public Member get(long mid) ; +} diff --git a/microboot-interceptor/src/main/java/cn/mldn/microboot/service/impl/MemberServiceImpl.java b/microboot-interceptor/src/main/java/cn/mldn/microboot/service/impl/MemberServiceImpl.java new file mode 100644 index 0000000..9796615 --- /dev/null +++ b/microboot-interceptor/src/main/java/cn/mldn/microboot/service/impl/MemberServiceImpl.java @@ -0,0 +1,19 @@ +package cn.mldn.microboot.service.impl; + +import org.springframework.stereotype.Service; + +import cn.mldn.microboot.service.IMemberService; +import cn.mldn.microboot.vo.Member; + +@Service +public class MemberServiceImpl implements IMemberService { + @Override + public Member get(long mid) { + Member vo = new Member(); + vo.setMid(mid); + vo.setName("KING"); + vo.setSalary(50000.00); + return vo; + } + +} diff --git a/microboot-interceptor/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java b/microboot-interceptor/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java new file mode 100644 index 0000000..5127e93 --- /dev/null +++ b/microboot-interceptor/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java @@ -0,0 +1,15 @@ +package cn.mldn.microboot.util.controller; + +import java.util.Locale; + +import javax.annotation.Resource; + +import org.springframework.context.MessageSource; + +public abstract class AbstractBaseController { + @Resource + private MessageSource messageSource; // 自动注入此资源对象 + public String getMessage(String key, String... args) { + return this.messageSource.getMessage(key, args, Locale.getDefault()); + } +} diff --git a/microboot-interceptor/src/main/java/cn/mldn/microboot/vo/Member.java b/microboot-interceptor/src/main/java/cn/mldn/microboot/vo/Member.java new file mode 100644 index 0000000..f6a9cd8 --- /dev/null +++ b/microboot-interceptor/src/main/java/cn/mldn/microboot/vo/Member.java @@ -0,0 +1,44 @@ +package cn.mldn.microboot.vo; + +import java.io.Serializable; +import java.util.Date; + +@SuppressWarnings("serial") +public class Member implements Serializable { + private Long mid ; + private String name ; + private Integer age ; + private Date birthday ; + private Double salary ; + public Long getMid() { + return mid; + } + public void setMid(Long mid) { + this.mid = mid; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public Integer getAge() { + return age; + } + public void setAge(Integer age) { + this.age = age; + } + public Date getBirthday() { + return birthday; + } + public void setBirthday(Date birthday) { + this.birthday = birthday; + } + public Double getSalary() { + return salary; + } + public void setSalary(Double salary) { + this.salary = salary; + } +} + diff --git a/microboot-interceptor/src/main/java/cn/mldn/util/MyInterceptor.java b/microboot-interceptor/src/main/java/cn/mldn/util/MyInterceptor.java new file mode 100644 index 0000000..008cb21 --- /dev/null +++ b/microboot-interceptor/src/main/java/cn/mldn/util/MyInterceptor.java @@ -0,0 +1,38 @@ +package cn.mldn.util; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.method.HandlerMethod; +import org.springframework.web.servlet.HandlerInterceptor; +import org.springframework.web.servlet.ModelAndView; + +public class MyInterceptor implements HandlerInterceptor { + private Logger log = LoggerFactory.getLogger(MyInterceptor.class) ; + @Override + public boolean preHandle(HttpServletRequest request, + HttpServletResponse response, Object handler) throws Exception { + HandlerMethod handlerMethod = (HandlerMethod) handler ; + this.log.info("【*** MyInterceptor.preHandle() ***】" + handlerMethod.getBean().getClass().getSimpleName()); + return true; // 如果返回false表示不继续请求,如果返回true表示继续请求 + } + + @Override + public void postHandle(HttpServletRequest request, + HttpServletResponse response, Object handler, + ModelAndView modelAndView) throws Exception { + HandlerMethod handlerMethod = (HandlerMethod) handler ; + this.log.info("【*** MyInterceptor.postHandle() ***】" + handlerMethod.getBean().getClass().getSimpleName()); + this.log.info("【*** MyInterceptor.postHandle() ***】" + modelAndView); + } + + @Override + public void afterCompletion(HttpServletRequest request, + HttpServletResponse response, Object handler, Exception ex) + throws Exception { + this.log.info("【*** MyInterceptor.afterCompletion() ***】拦截处理完毕" ); + } + +} diff --git a/microboot-interceptor/src/main/resources/application.yml b/microboot-interceptor/src/main/resources/application.yml new file mode 100644 index 0000000..3fcd375 --- /dev/null +++ b/microboot-interceptor/src/main/resources/application.yml @@ -0,0 +1,12 @@ +server: + port: 80 +spring: + messages: + basename: i18n/Messages,i18n/Pages +# http: +# multipart: +# enabled: true # 可以启用http上传 +# max-file-size: 1KB # 设置支持的单个上传文件的大小限制 +# max-request-size: 20MB # 设置最大的请求的文件大小,设置总体大小请求 +# file-size-threshold: 512KB # 当上传文件达到指定配置量的时候会将文件内容写入磁盘 +# location: / # 设置上传的临时目录 \ No newline at end of file diff --git a/microboot-interceptor/src/main/resources/fastdfs_client.conf b/microboot-interceptor/src/main/resources/fastdfs_client.conf new file mode 100644 index 0000000..3f0fbb0 --- /dev/null +++ b/microboot-interceptor/src/main/resources/fastdfs_client.conf @@ -0,0 +1,6 @@ +# 配置上你tracker的连接地址 +tracker_server=fastdfs-tracker:22122 +# 表示现在要进行token检测 +http.anti_steal_token=true +# 进行认证的密码处理 +http.secret_key=mldnhelloworldhahheihanhheiehinajueduicaibudao \ No newline at end of file diff --git a/microboot-interceptor/src/main/resources/i18n/Messages.properties b/microboot-interceptor/src/main/resources/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-interceptor/src/main/resources/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-interceptor/src/main/resources/i18n/Pages.properties b/microboot-interceptor/src/main/resources/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-interceptor/src/main/resources/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-interceptor/src/main/view/static/images/mldn.ico b/microboot-interceptor/src/main/view/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-interceptor/src/main/view/static/images/mldn.ico differ diff --git a/microboot-interceptor/src/main/view/static/info/message_info.html b/microboot-interceptor/src/main/view/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-interceptor/src/main/view/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-interceptor/src/main/view/static/js/main.js b/microboot-interceptor/src/main/view/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-interceptor/src/main/view/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-interceptor/src/main/view/static/message_index.html b/microboot-interceptor/src/main/view/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-interceptor/src/main/view/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-interceptor/src/main/view/templates/member_add.html b/microboot-interceptor/src/main/view/templates/member_add.html new file mode 100644 index 0000000..82de372 --- /dev/null +++ b/microboot-interceptor/src/main/view/templates/member_add.html @@ -0,0 +1,14 @@ + + + + SpringBoot模版渲染 + + + +
+ 用户编号:
+ 用户姓名:
+ +
+ + \ No newline at end of file diff --git a/microboot-interceptor/src/test/java/cn/mldn/microboot/AppTest.java b/microboot-interceptor/src/test/java/cn/mldn/microboot/AppTest.java new file mode 100644 index 0000000..a094258 --- /dev/null +++ b/microboot-interceptor/src/test/java/cn/mldn/microboot/AppTest.java @@ -0,0 +1,38 @@ +package cn.mldn.microboot; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/microboot-interceptor/src/test/java/cn/mldn/microboot/test/TestMessageController.java b/microboot-interceptor/src/test/java/cn/mldn/microboot/test/TestMessageController.java new file mode 100644 index 0000000..2f21c5d --- /dev/null +++ b/microboot-interceptor/src/test/java/cn/mldn/microboot/test/TestMessageController.java @@ -0,0 +1,19 @@ +package cn.mldn.microboot.test; + +import javax.annotation.Resource; + +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +import cn.mldn.microboot.StartSpringBootMain; +import cn.mldn.microboot.controller.MemberController; + +@SpringBootTest(classes = StartSpringBootMain.class) +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +public class TestMessageController { + @Resource + private MemberController messageController; +} diff --git a/microboot-interceptor/target/classes/META-INF/MANIFEST.MF b/microboot-interceptor/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d4c16dd --- /dev/null +++ b/microboot-interceptor/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Built-By: foreveriss +Build-Jdk: 1.8.0_121 +Created-By: Maven Integration for Eclipse + diff --git a/microboot-interceptor/target/classes/META-INF/maven/cn.mldn/microboot-interceptor/pom.properties b/microboot-interceptor/target/classes/META-INF/maven/cn.mldn/microboot-interceptor/pom.properties new file mode 100644 index 0000000..478a282 --- /dev/null +++ b/microboot-interceptor/target/classes/META-INF/maven/cn.mldn/microboot-interceptor/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Thu Jun 29 23:45:03 CST 2017 +version=0.0.1-SNAPSHOT +groupId=cn.mldn +m2e.projectName=microboot-interceptor +m2e.projectLocation=/Users/foreveriss/workspace/microboot/microboot-interceptor +artifactId=microboot-interceptor diff --git a/microboot-interceptor/target/classes/META-INF/maven/cn.mldn/microboot-interceptor/pom.xml b/microboot-interceptor/target/classes/META-INF/maven/cn.mldn/microboot-interceptor/pom.xml new file mode 100644 index 0000000..bd18012 --- /dev/null +++ b/microboot-interceptor/target/classes/META-INF/maven/cn.mldn/microboot-interceptor/pom.xml @@ -0,0 +1,63 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-interceptor + microboot-interceptor + http://maven.apache.org + + UTF-8 + + + + org.springframework.boot + spring-boot-starter-aop + + + + com.github.kischang + fastdfs-client + 0.1 + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-interceptor/target/classes/application.yml b/microboot-interceptor/target/classes/application.yml new file mode 100644 index 0000000..3fcd375 --- /dev/null +++ b/microboot-interceptor/target/classes/application.yml @@ -0,0 +1,12 @@ +server: + port: 80 +spring: + messages: + basename: i18n/Messages,i18n/Pages +# http: +# multipart: +# enabled: true # 可以启用http上传 +# max-file-size: 1KB # 设置支持的单个上传文件的大小限制 +# max-request-size: 20MB # 设置最大的请求的文件大小,设置总体大小请求 +# file-size-threshold: 512KB # 当上传文件达到指定配置量的时候会将文件内容写入磁盘 +# location: / # 设置上传的临时目录 \ No newline at end of file diff --git a/microboot-interceptor/target/classes/cn/mldn/microboot/StartSpringBootMain.class b/microboot-interceptor/target/classes/cn/mldn/microboot/StartSpringBootMain.class new file mode 100644 index 0000000..eb9ab34 Binary files /dev/null and b/microboot-interceptor/target/classes/cn/mldn/microboot/StartSpringBootMain.class differ diff --git a/microboot-interceptor/target/classes/cn/mldn/microboot/config/MyWebApplicationConfig.class b/microboot-interceptor/target/classes/cn/mldn/microboot/config/MyWebApplicationConfig.class new file mode 100644 index 0000000..c8a47ee Binary files /dev/null and b/microboot-interceptor/target/classes/cn/mldn/microboot/config/MyWebApplicationConfig.class differ diff --git a/microboot-interceptor/target/classes/cn/mldn/microboot/config/ServiceAspect.class b/microboot-interceptor/target/classes/cn/mldn/microboot/config/ServiceAspect.class new file mode 100644 index 0000000..bd3ae32 Binary files /dev/null and b/microboot-interceptor/target/classes/cn/mldn/microboot/config/ServiceAspect.class differ diff --git a/microboot-interceptor/target/classes/cn/mldn/microboot/controller/MemberController.class b/microboot-interceptor/target/classes/cn/mldn/microboot/controller/MemberController.class new file mode 100644 index 0000000..1a5fc3b Binary files /dev/null and b/microboot-interceptor/target/classes/cn/mldn/microboot/controller/MemberController.class differ diff --git a/microboot-interceptor/target/classes/cn/mldn/microboot/service/IMemberService.class b/microboot-interceptor/target/classes/cn/mldn/microboot/service/IMemberService.class new file mode 100644 index 0000000..75cdd6e Binary files /dev/null and b/microboot-interceptor/target/classes/cn/mldn/microboot/service/IMemberService.class differ diff --git a/microboot-interceptor/target/classes/cn/mldn/microboot/service/impl/MemberServiceImpl.class b/microboot-interceptor/target/classes/cn/mldn/microboot/service/impl/MemberServiceImpl.class new file mode 100644 index 0000000..fec5721 Binary files /dev/null and b/microboot-interceptor/target/classes/cn/mldn/microboot/service/impl/MemberServiceImpl.class differ diff --git a/microboot-interceptor/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class b/microboot-interceptor/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class new file mode 100644 index 0000000..57c2010 Binary files /dev/null and b/microboot-interceptor/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class differ diff --git a/microboot-interceptor/target/classes/cn/mldn/microboot/vo/Member.class b/microboot-interceptor/target/classes/cn/mldn/microboot/vo/Member.class new file mode 100644 index 0000000..59c00d5 Binary files /dev/null and b/microboot-interceptor/target/classes/cn/mldn/microboot/vo/Member.class differ diff --git a/microboot-interceptor/target/classes/cn/mldn/util/MyInterceptor.class b/microboot-interceptor/target/classes/cn/mldn/util/MyInterceptor.class new file mode 100644 index 0000000..89032d3 Binary files /dev/null and b/microboot-interceptor/target/classes/cn/mldn/util/MyInterceptor.class differ diff --git a/microboot-interceptor/target/classes/fastdfs_client.conf b/microboot-interceptor/target/classes/fastdfs_client.conf new file mode 100644 index 0000000..3f0fbb0 --- /dev/null +++ b/microboot-interceptor/target/classes/fastdfs_client.conf @@ -0,0 +1,6 @@ +# 配置上你tracker的连接地址 +tracker_server=fastdfs-tracker:22122 +# 表示现在要进行token检测 +http.anti_steal_token=true +# 进行认证的密码处理 +http.secret_key=mldnhelloworldhahheihanhheiehinajueduicaibudao \ No newline at end of file diff --git a/microboot-interceptor/target/classes/i18n/Messages.properties b/microboot-interceptor/target/classes/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-interceptor/target/classes/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-interceptor/target/classes/i18n/Pages.properties b/microboot-interceptor/target/classes/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-interceptor/target/classes/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-interceptor/target/classes/static/images/mldn.ico b/microboot-interceptor/target/classes/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-interceptor/target/classes/static/images/mldn.ico differ diff --git a/microboot-interceptor/target/classes/static/info/message_info.html b/microboot-interceptor/target/classes/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-interceptor/target/classes/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-interceptor/target/classes/static/js/main.js b/microboot-interceptor/target/classes/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-interceptor/target/classes/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-interceptor/target/classes/static/message_index.html b/microboot-interceptor/target/classes/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-interceptor/target/classes/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-interceptor/target/classes/templates/member_add.html b/microboot-interceptor/target/classes/templates/member_add.html new file mode 100644 index 0000000..82de372 --- /dev/null +++ b/microboot-interceptor/target/classes/templates/member_add.html @@ -0,0 +1,14 @@ + + + + SpringBoot模版渲染 + + + +
+ 用户编号:
+ 用户姓名:
+ +
+ + \ No newline at end of file diff --git a/microboot-interceptor/target/test-classes/cn/mldn/microboot/AppTest.class b/microboot-interceptor/target/test-classes/cn/mldn/microboot/AppTest.class new file mode 100644 index 0000000..d317ee0 Binary files /dev/null and b/microboot-interceptor/target/test-classes/cn/mldn/microboot/AppTest.class differ diff --git a/microboot-interceptor/target/test-classes/cn/mldn/microboot/test/TestMessageController.class b/microboot-interceptor/target/test-classes/cn/mldn/microboot/test/TestMessageController.class new file mode 100644 index 0000000..d803ec7 Binary files /dev/null and b/microboot-interceptor/target/test-classes/cn/mldn/microboot/test/TestMessageController.class differ diff --git a/microboot-kafka-consumer/.classpath b/microboot-kafka-consumer/.classpath new file mode 100644 index 0000000..a6f04e8 --- /dev/null +++ b/microboot-kafka-consumer/.classpath @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/microboot-kafka-consumer/.project b/microboot-kafka-consumer/.project new file mode 100644 index 0000000..230186f --- /dev/null +++ b/microboot-kafka-consumer/.project @@ -0,0 +1,35 @@ + + + microboot-kafka-consumer + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/microboot-kafka-consumer/.settings/org.eclipse.core.resources.prefs b/microboot-kafka-consumer/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..a6dcfb7 --- /dev/null +++ b/microboot-kafka-consumer/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/main/view=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/microboot-kafka-consumer/.settings/org.eclipse.jdt.core.prefs b/microboot-kafka-consumer/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..d59e09c --- /dev/null +++ b/microboot-kafka-consumer/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/microboot-kafka-consumer/.settings/org.eclipse.m2e.core.prefs b/microboot-kafka-consumer/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/microboot-kafka-consumer/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/microboot-kafka-consumer/.settings/org.eclipse.wst.common.project.facet.core.xml b/microboot-kafka-consumer/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..e822977 --- /dev/null +++ b/microboot-kafka-consumer/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ + + + + diff --git a/microboot-kafka-consumer/pom.xml b/microboot-kafka-consumer/pom.xml new file mode 100644 index 0000000..752f295 --- /dev/null +++ b/microboot-kafka-consumer/pom.xml @@ -0,0 +1,62 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-kafka-consumer + microboot-kafka-consumer + http://maven.apache.org + + UTF-8 + + + + ch.qos.logback + logback-core + + + + org.springframework.kafka + spring-kafka + + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-kafka-consumer/src/main/java/cn/mldn/microboot/StartSpringBootMain.java b/microboot-kafka-consumer/src/main/java/cn/mldn/microboot/StartSpringBootMain.java new file mode 100644 index 0000000..8a58ff5 --- /dev/null +++ b/microboot-kafka-consumer/src/main/java/cn/mldn/microboot/StartSpringBootMain.java @@ -0,0 +1,15 @@ +package cn.mldn.microboot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication // 启动SpringBoot程序,而后自带子包扫描 +public class StartSpringBootMain { + static { + System.setProperty("java.security.auth.login.config", + "d:/kafka_client_jaas.conf"); // 表示系统环境属性 + } + public static void main(String[] args) throws Exception { + SpringApplication.run(StartSpringBootMain.class, args); + } +} diff --git a/microboot-kafka-consumer/src/main/java/cn/mldn/microboot/consumer/MessageConsumerService.java b/microboot-kafka-consumer/src/main/java/cn/mldn/microboot/consumer/MessageConsumerService.java new file mode 100644 index 0000000..3c02d1d --- /dev/null +++ b/microboot-kafka-consumer/src/main/java/cn/mldn/microboot/consumer/MessageConsumerService.java @@ -0,0 +1,14 @@ +package cn.mldn.microboot.consumer; + +import org.apache.kafka.clients.consumer.ConsumerRecord; +import org.springframework.kafka.annotation.KafkaListener; +import org.springframework.stereotype.Service; + +@Service +public class MessageConsumerService { + @KafkaListener(topics = {"mldn-microboot"}) + public void receiveMessage(ConsumerRecord record) { // 进行消息接收处理 + System.err.println("【*** 接收消息 ***】key = " + record.key() + "、value = " + + record.value()); + } +} diff --git a/microboot-kafka-consumer/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java b/microboot-kafka-consumer/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java new file mode 100644 index 0000000..5127e93 --- /dev/null +++ b/microboot-kafka-consumer/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java @@ -0,0 +1,15 @@ +package cn.mldn.microboot.util.controller; + +import java.util.Locale; + +import javax.annotation.Resource; + +import org.springframework.context.MessageSource; + +public abstract class AbstractBaseController { + @Resource + private MessageSource messageSource; // 自动注入此资源对象 + public String getMessage(String key, String... args) { + return this.messageSource.getMessage(key, args, Locale.getDefault()); + } +} diff --git a/microboot-kafka-consumer/src/main/java/cn/mldn/microboot/vo/Dept.java b/microboot-kafka-consumer/src/main/java/cn/mldn/microboot/vo/Dept.java new file mode 100644 index 0000000..7971469 --- /dev/null +++ b/microboot-kafka-consumer/src/main/java/cn/mldn/microboot/vo/Dept.java @@ -0,0 +1,25 @@ +package cn.mldn.microboot.vo; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class Dept implements Serializable { + private Long deptno ; + private String dname ; + public Long getDeptno() { + return deptno; + } + public void setDeptno(Long deptno) { + this.deptno = deptno; + } + public String getDname() { + return dname; + } + public void setDname(String dname) { + this.dname = dname; + } + @Override + public String toString() { + return "Dept [deptno=" + deptno + ", dname=" + dname + "]"; + } +} diff --git a/microboot-kafka-consumer/src/main/java/cn/mldn/microboot/vo/Member.java b/microboot-kafka-consumer/src/main/java/cn/mldn/microboot/vo/Member.java new file mode 100644 index 0000000..f6a9cd8 --- /dev/null +++ b/microboot-kafka-consumer/src/main/java/cn/mldn/microboot/vo/Member.java @@ -0,0 +1,44 @@ +package cn.mldn.microboot.vo; + +import java.io.Serializable; +import java.util.Date; + +@SuppressWarnings("serial") +public class Member implements Serializable { + private Long mid ; + private String name ; + private Integer age ; + private Date birthday ; + private Double salary ; + public Long getMid() { + return mid; + } + public void setMid(Long mid) { + this.mid = mid; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public Integer getAge() { + return age; + } + public void setAge(Integer age) { + this.age = age; + } + public Date getBirthday() { + return birthday; + } + public void setBirthday(Date birthday) { + this.birthday = birthday; + } + public Double getSalary() { + return salary; + } + public void setSalary(Double salary) { + this.salary = salary; + } +} + diff --git a/microboot-kafka-consumer/src/main/java/数据库创建脚本.sql b/microboot-kafka-consumer/src/main/java/数据库创建脚本.sql new file mode 100644 index 0000000..edd35b2 --- /dev/null +++ b/microboot-kafka-consumer/src/main/java/数据库创建脚本.sql @@ -0,0 +1,13 @@ +DROP DATBASE IF EXISTS mldn ; +CREATE DATBASE mldn CHARACTER SET UTF8 ; +USE mldn ; +CREATE TABLE dept ( + deptno BIGINT AUTO_INCREMENT , + dname VARCHAR(50) , + CONSTRAINT pk_deptno PRIMARY KEY(deptno) +) ; +INSERT INTO dept(dname) VALUES ('开发部') ; +INSERT INTO dept(dname) VALUES ('财务部') ; +INSERT INTO dept(dname) VALUES ('市场部') ; +INSERT INTO dept(dname) VALUES ('后勤部') ; +INSERT INTO dept(dname) VALUES ('公关部') ; \ No newline at end of file diff --git a/microboot-kafka-consumer/src/main/resources/application.yml b/microboot-kafka-consumer/src/main/resources/application.yml new file mode 100644 index 0000000..d3d220e --- /dev/null +++ b/microboot-kafka-consumer/src/main/resources/application.yml @@ -0,0 +1,17 @@ +server: + port: 80 +spring: + messages: + basename: i18n/Messages,i18n/Pages + kafka: + bootstrap-servers: + - kafka-single:9095 + template: + default-topic: mldn-microboot + consumer: + key-deserializer: org.apache.kafka.common.serialization.StringDeserializer + value-deserializer: org.apache.kafka.common.serialization.StringDeserializer + group-id: group-1 + properties: + sasl.mechanism: PLAIN + security.protocol: SASL_PLAINTEXT \ No newline at end of file diff --git a/microboot-kafka-consumer/src/main/resources/i18n/Messages.properties b/microboot-kafka-consumer/src/main/resources/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-kafka-consumer/src/main/resources/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-kafka-consumer/src/main/resources/i18n/Pages.properties b/microboot-kafka-consumer/src/main/resources/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-kafka-consumer/src/main/resources/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-kafka-consumer/src/main/resources/logback.xml b/microboot-kafka-consumer/src/main/resources/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-kafka-consumer/src/main/resources/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-kafka-consumer/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml b/microboot-kafka-consumer/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml new file mode 100644 index 0000000..6557a3a --- /dev/null +++ b/microboot-kafka-consumer/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml @@ -0,0 +1,11 @@ + + + + + + INSERT INTO dept(dname) VALUES (#{dname}) ; + + diff --git a/microboot-kafka-consumer/src/main/resources/mybatis/mybatis.cfg.xml b/microboot-kafka-consumer/src/main/resources/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4d128c0 --- /dev/null +++ b/microboot-kafka-consumer/src/main/resources/mybatis/mybatis.cfg.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/microboot-kafka-consumer/src/main/view/static/images/mldn.ico b/microboot-kafka-consumer/src/main/view/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-kafka-consumer/src/main/view/static/images/mldn.ico differ diff --git a/microboot-kafka-consumer/src/main/view/static/info/message_info.html b/microboot-kafka-consumer/src/main/view/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-kafka-consumer/src/main/view/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-kafka-consumer/src/main/view/static/js/main.js b/microboot-kafka-consumer/src/main/view/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-kafka-consumer/src/main/view/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-kafka-consumer/src/main/view/static/message_index.html b/microboot-kafka-consumer/src/main/view/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-kafka-consumer/src/main/view/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-kafka-consumer/src/main/view/templates/upload_page.html b/microboot-kafka-consumer/src/main/view/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-kafka-consumer/src/main/view/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-kafka-consumer/src/main/view/templates/upload_show.html b/microboot-kafka-consumer/src/main/view/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-kafka-consumer/src/main/view/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-kafka-consumer/src/test/java/cn/mldn/microboot/AppTest.java b/microboot-kafka-consumer/src/test/java/cn/mldn/microboot/AppTest.java new file mode 100644 index 0000000..97f5814 --- /dev/null +++ b/microboot-kafka-consumer/src/test/java/cn/mldn/microboot/AppTest.java @@ -0,0 +1,16 @@ +package cn.mldn.microboot; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; +@SpringBootTest(classes = StartSpringBootMain.class) +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +public class AppTest { + @Test + public void testStart() throws Exception { + Thread.sleep(Long.MAX_VALUE); + } +} diff --git a/microboot-kafka-consumer/target/classes/META-INF/MANIFEST.MF b/microboot-kafka-consumer/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d4c16dd --- /dev/null +++ b/microboot-kafka-consumer/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Built-By: foreveriss +Build-Jdk: 1.8.0_121 +Created-By: Maven Integration for Eclipse + diff --git a/microboot-kafka-consumer/target/classes/META-INF/maven/cn.mldn/microboot-kafka-consumer/pom.properties b/microboot-kafka-consumer/target/classes/META-INF/maven/cn.mldn/microboot-kafka-consumer/pom.properties new file mode 100644 index 0000000..1e76704 --- /dev/null +++ b/microboot-kafka-consumer/target/classes/META-INF/maven/cn.mldn/microboot-kafka-consumer/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Thu Jun 29 23:45:04 CST 2017 +version=0.0.1-SNAPSHOT +groupId=cn.mldn +m2e.projectName=microboot-kafka-consumer +m2e.projectLocation=/Users/foreveriss/workspace/microboot/microboot-kafka-consumer +artifactId=microboot-kafka-consumer diff --git a/microboot-kafka-consumer/target/classes/META-INF/maven/cn.mldn/microboot-kafka-consumer/pom.xml b/microboot-kafka-consumer/target/classes/META-INF/maven/cn.mldn/microboot-kafka-consumer/pom.xml new file mode 100644 index 0000000..752f295 --- /dev/null +++ b/microboot-kafka-consumer/target/classes/META-INF/maven/cn.mldn/microboot-kafka-consumer/pom.xml @@ -0,0 +1,62 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-kafka-consumer + microboot-kafka-consumer + http://maven.apache.org + + UTF-8 + + + + ch.qos.logback + logback-core + + + + org.springframework.kafka + spring-kafka + + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-kafka-consumer/target/classes/application.yml b/microboot-kafka-consumer/target/classes/application.yml new file mode 100644 index 0000000..d3d220e --- /dev/null +++ b/microboot-kafka-consumer/target/classes/application.yml @@ -0,0 +1,17 @@ +server: + port: 80 +spring: + messages: + basename: i18n/Messages,i18n/Pages + kafka: + bootstrap-servers: + - kafka-single:9095 + template: + default-topic: mldn-microboot + consumer: + key-deserializer: org.apache.kafka.common.serialization.StringDeserializer + value-deserializer: org.apache.kafka.common.serialization.StringDeserializer + group-id: group-1 + properties: + sasl.mechanism: PLAIN + security.protocol: SASL_PLAINTEXT \ No newline at end of file diff --git a/microboot-kafka-consumer/target/classes/cn/mldn/microboot/StartSpringBootMain.class b/microboot-kafka-consumer/target/classes/cn/mldn/microboot/StartSpringBootMain.class new file mode 100644 index 0000000..18bb195 Binary files /dev/null and b/microboot-kafka-consumer/target/classes/cn/mldn/microboot/StartSpringBootMain.class differ diff --git a/microboot-kafka-consumer/target/classes/cn/mldn/microboot/consumer/MessageConsumerService.class b/microboot-kafka-consumer/target/classes/cn/mldn/microboot/consumer/MessageConsumerService.class new file mode 100644 index 0000000..9b6eda8 Binary files /dev/null and b/microboot-kafka-consumer/target/classes/cn/mldn/microboot/consumer/MessageConsumerService.class differ diff --git a/microboot-kafka-consumer/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class b/microboot-kafka-consumer/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class new file mode 100644 index 0000000..57c2010 Binary files /dev/null and b/microboot-kafka-consumer/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class differ diff --git a/microboot-kafka-consumer/target/classes/cn/mldn/microboot/vo/Dept.class b/microboot-kafka-consumer/target/classes/cn/mldn/microboot/vo/Dept.class new file mode 100644 index 0000000..46f2356 Binary files /dev/null and b/microboot-kafka-consumer/target/classes/cn/mldn/microboot/vo/Dept.class differ diff --git a/microboot-kafka-consumer/target/classes/cn/mldn/microboot/vo/Member.class b/microboot-kafka-consumer/target/classes/cn/mldn/microboot/vo/Member.class new file mode 100644 index 0000000..59c00d5 Binary files /dev/null and b/microboot-kafka-consumer/target/classes/cn/mldn/microboot/vo/Member.class differ diff --git a/microboot-kafka-consumer/target/classes/i18n/Messages.properties b/microboot-kafka-consumer/target/classes/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-kafka-consumer/target/classes/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-kafka-consumer/target/classes/i18n/Pages.properties b/microboot-kafka-consumer/target/classes/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-kafka-consumer/target/classes/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-kafka-consumer/target/classes/logback.xml b/microboot-kafka-consumer/target/classes/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-kafka-consumer/target/classes/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-kafka-consumer/target/classes/mybatis/mapper/cn/mldn/Dept.xml b/microboot-kafka-consumer/target/classes/mybatis/mapper/cn/mldn/Dept.xml new file mode 100644 index 0000000..6557a3a --- /dev/null +++ b/microboot-kafka-consumer/target/classes/mybatis/mapper/cn/mldn/Dept.xml @@ -0,0 +1,11 @@ + + + + + + INSERT INTO dept(dname) VALUES (#{dname}) ; + + diff --git a/microboot-kafka-consumer/target/classes/mybatis/mybatis.cfg.xml b/microboot-kafka-consumer/target/classes/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4d128c0 --- /dev/null +++ b/microboot-kafka-consumer/target/classes/mybatis/mybatis.cfg.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/microboot-kafka-consumer/target/classes/static/images/mldn.ico b/microboot-kafka-consumer/target/classes/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-kafka-consumer/target/classes/static/images/mldn.ico differ diff --git a/microboot-kafka-consumer/target/classes/static/info/message_info.html b/microboot-kafka-consumer/target/classes/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-kafka-consumer/target/classes/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-kafka-consumer/target/classes/static/js/main.js b/microboot-kafka-consumer/target/classes/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-kafka-consumer/target/classes/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-kafka-consumer/target/classes/static/message_index.html b/microboot-kafka-consumer/target/classes/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-kafka-consumer/target/classes/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-kafka-consumer/target/classes/templates/upload_page.html b/microboot-kafka-consumer/target/classes/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-kafka-consumer/target/classes/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-kafka-consumer/target/classes/templates/upload_show.html b/microboot-kafka-consumer/target/classes/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-kafka-consumer/target/classes/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-kafka-consumer/target/test-classes/cn/mldn/microboot/AppTest.class b/microboot-kafka-consumer/target/test-classes/cn/mldn/microboot/AppTest.class new file mode 100644 index 0000000..95c2ba7 Binary files /dev/null and b/microboot-kafka-consumer/target/test-classes/cn/mldn/microboot/AppTest.class differ diff --git a/microboot-kafka-producer/.classpath b/microboot-kafka-producer/.classpath new file mode 100644 index 0000000..a6f04e8 --- /dev/null +++ b/microboot-kafka-producer/.classpath @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/microboot-kafka-producer/.project b/microboot-kafka-producer/.project new file mode 100644 index 0000000..fbd4370 --- /dev/null +++ b/microboot-kafka-producer/.project @@ -0,0 +1,35 @@ + + + microboot-kafka-producer + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/microboot-kafka-producer/.settings/org.eclipse.core.resources.prefs b/microboot-kafka-producer/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..a6dcfb7 --- /dev/null +++ b/microboot-kafka-producer/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/main/view=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/microboot-kafka-producer/.settings/org.eclipse.jdt.core.prefs b/microboot-kafka-producer/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..d59e09c --- /dev/null +++ b/microboot-kafka-producer/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/microboot-kafka-producer/.settings/org.eclipse.m2e.core.prefs b/microboot-kafka-producer/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/microboot-kafka-producer/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/microboot-kafka-producer/.settings/org.eclipse.wst.common.project.facet.core.xml b/microboot-kafka-producer/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..e822977 --- /dev/null +++ b/microboot-kafka-producer/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ + + + + diff --git a/microboot-kafka-producer/pom.xml b/microboot-kafka-producer/pom.xml new file mode 100644 index 0000000..fdab2ab --- /dev/null +++ b/microboot-kafka-producer/pom.xml @@ -0,0 +1,61 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-kafka-producer + microboot-kafka-producer + http://maven.apache.org + + UTF-8 + + + + ch.qos.logback + logback-core + + + + org.springframework.kafka + spring-kafka + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-kafka-producer/src/main/java/cn/mldn/microboot/StartSpringBootMain.java b/microboot-kafka-producer/src/main/java/cn/mldn/microboot/StartSpringBootMain.java new file mode 100644 index 0000000..11c29cf --- /dev/null +++ b/microboot-kafka-producer/src/main/java/cn/mldn/microboot/StartSpringBootMain.java @@ -0,0 +1,15 @@ +package cn.mldn.microboot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication // 启动SpringBoot程序,而后自带子包扫描 +public class StartSpringBootMain { + static { + System.setProperty("java.security.auth.login.config", + "d:/kafka_client_jaas.conf"); // 表示系统环境属性 + } + public static void main(String[] args) throws Exception { + SpringApplication.run(StartSpringBootMain.class, args); + } +} diff --git a/microboot-kafka-producer/src/main/java/cn/mldn/microboot/service/IMessageProducerService.java b/microboot-kafka-producer/src/main/java/cn/mldn/microboot/service/IMessageProducerService.java new file mode 100644 index 0000000..66fe7ed --- /dev/null +++ b/microboot-kafka-producer/src/main/java/cn/mldn/microboot/service/IMessageProducerService.java @@ -0,0 +1,5 @@ +package cn.mldn.microboot.service; + +public interface IMessageProducerService { + public void send(String msg); +} diff --git a/microboot-kafka-producer/src/main/java/cn/mldn/microboot/service/impl/MessageProducerServiceImpl.java b/microboot-kafka-producer/src/main/java/cn/mldn/microboot/service/impl/MessageProducerServiceImpl.java new file mode 100644 index 0000000..d5b581a --- /dev/null +++ b/microboot-kafka-producer/src/main/java/cn/mldn/microboot/service/impl/MessageProducerServiceImpl.java @@ -0,0 +1,19 @@ +package cn.mldn.microboot.service.impl; + +import javax.annotation.Resource; + +import org.springframework.kafka.core.KafkaTemplate; +import org.springframework.stereotype.Service; + +import cn.mldn.microboot.service.IMessageProducerService; + +@Service +public class MessageProducerServiceImpl implements IMessageProducerService { + @Resource + private KafkaTemplate kafkaTemplate; + @Override + public void send(String msg) { + this.kafkaTemplate.sendDefault("mldn-key", msg); + } + +} diff --git a/microboot-kafka-producer/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java b/microboot-kafka-producer/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java new file mode 100644 index 0000000..5127e93 --- /dev/null +++ b/microboot-kafka-producer/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java @@ -0,0 +1,15 @@ +package cn.mldn.microboot.util.controller; + +import java.util.Locale; + +import javax.annotation.Resource; + +import org.springframework.context.MessageSource; + +public abstract class AbstractBaseController { + @Resource + private MessageSource messageSource; // 自动注入此资源对象 + public String getMessage(String key, String... args) { + return this.messageSource.getMessage(key, args, Locale.getDefault()); + } +} diff --git a/microboot-kafka-producer/src/main/java/cn/mldn/microboot/vo/Dept.java b/microboot-kafka-producer/src/main/java/cn/mldn/microboot/vo/Dept.java new file mode 100644 index 0000000..7971469 --- /dev/null +++ b/microboot-kafka-producer/src/main/java/cn/mldn/microboot/vo/Dept.java @@ -0,0 +1,25 @@ +package cn.mldn.microboot.vo; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class Dept implements Serializable { + private Long deptno ; + private String dname ; + public Long getDeptno() { + return deptno; + } + public void setDeptno(Long deptno) { + this.deptno = deptno; + } + public String getDname() { + return dname; + } + public void setDname(String dname) { + this.dname = dname; + } + @Override + public String toString() { + return "Dept [deptno=" + deptno + ", dname=" + dname + "]"; + } +} diff --git a/microboot-kafka-producer/src/main/java/cn/mldn/microboot/vo/Member.java b/microboot-kafka-producer/src/main/java/cn/mldn/microboot/vo/Member.java new file mode 100644 index 0000000..f6a9cd8 --- /dev/null +++ b/microboot-kafka-producer/src/main/java/cn/mldn/microboot/vo/Member.java @@ -0,0 +1,44 @@ +package cn.mldn.microboot.vo; + +import java.io.Serializable; +import java.util.Date; + +@SuppressWarnings("serial") +public class Member implements Serializable { + private Long mid ; + private String name ; + private Integer age ; + private Date birthday ; + private Double salary ; + public Long getMid() { + return mid; + } + public void setMid(Long mid) { + this.mid = mid; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public Integer getAge() { + return age; + } + public void setAge(Integer age) { + this.age = age; + } + public Date getBirthday() { + return birthday; + } + public void setBirthday(Date birthday) { + this.birthday = birthday; + } + public Double getSalary() { + return salary; + } + public void setSalary(Double salary) { + this.salary = salary; + } +} + diff --git a/microboot-kafka-producer/src/main/java/数据库创建脚本.sql b/microboot-kafka-producer/src/main/java/数据库创建脚本.sql new file mode 100644 index 0000000..edd35b2 --- /dev/null +++ b/microboot-kafka-producer/src/main/java/数据库创建脚本.sql @@ -0,0 +1,13 @@ +DROP DATBASE IF EXISTS mldn ; +CREATE DATBASE mldn CHARACTER SET UTF8 ; +USE mldn ; +CREATE TABLE dept ( + deptno BIGINT AUTO_INCREMENT , + dname VARCHAR(50) , + CONSTRAINT pk_deptno PRIMARY KEY(deptno) +) ; +INSERT INTO dept(dname) VALUES ('开发部') ; +INSERT INTO dept(dname) VALUES ('财务部') ; +INSERT INTO dept(dname) VALUES ('市场部') ; +INSERT INTO dept(dname) VALUES ('后勤部') ; +INSERT INTO dept(dname) VALUES ('公关部') ; \ No newline at end of file diff --git a/microboot-kafka-producer/src/main/resources/application.yml b/microboot-kafka-producer/src/main/resources/application.yml new file mode 100644 index 0000000..8e6b49d --- /dev/null +++ b/microboot-kafka-producer/src/main/resources/application.yml @@ -0,0 +1,16 @@ +server: + port: 80 +spring: + messages: + basename: i18n/Messages,i18n/Pages + kafka: + bootstrap-servers: + - kafka-single:9095 + template: + default-topic: mldn-microboot + producer: + key-serializer: org.apache.kafka.common.serialization.StringSerializer + value-serializer: org.apache.kafka.common.serialization.StringSerializer + properties: + sasl.mechanism: PLAIN + security.protocol: SASL_PLAINTEXT \ No newline at end of file diff --git a/microboot-kafka-producer/src/main/resources/i18n/Messages.properties b/microboot-kafka-producer/src/main/resources/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-kafka-producer/src/main/resources/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-kafka-producer/src/main/resources/i18n/Pages.properties b/microboot-kafka-producer/src/main/resources/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-kafka-producer/src/main/resources/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-kafka-producer/src/main/resources/logback.xml b/microboot-kafka-producer/src/main/resources/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-kafka-producer/src/main/resources/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-kafka-producer/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml b/microboot-kafka-producer/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml new file mode 100644 index 0000000..6557a3a --- /dev/null +++ b/microboot-kafka-producer/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml @@ -0,0 +1,11 @@ + + + + + + INSERT INTO dept(dname) VALUES (#{dname}) ; + + diff --git a/microboot-kafka-producer/src/main/resources/mybatis/mybatis.cfg.xml b/microboot-kafka-producer/src/main/resources/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4d128c0 --- /dev/null +++ b/microboot-kafka-producer/src/main/resources/mybatis/mybatis.cfg.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/microboot-kafka-producer/src/main/view/static/images/mldn.ico b/microboot-kafka-producer/src/main/view/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-kafka-producer/src/main/view/static/images/mldn.ico differ diff --git a/microboot-kafka-producer/src/main/view/static/info/message_info.html b/microboot-kafka-producer/src/main/view/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-kafka-producer/src/main/view/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-kafka-producer/src/main/view/static/js/main.js b/microboot-kafka-producer/src/main/view/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-kafka-producer/src/main/view/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-kafka-producer/src/main/view/static/message_index.html b/microboot-kafka-producer/src/main/view/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-kafka-producer/src/main/view/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-kafka-producer/src/main/view/templates/upload_page.html b/microboot-kafka-producer/src/main/view/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-kafka-producer/src/main/view/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-kafka-producer/src/main/view/templates/upload_show.html b/microboot-kafka-producer/src/main/view/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-kafka-producer/src/main/view/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-kafka-producer/src/test/java/cn/mldn/microboot/TestMessageService.java b/microboot-kafka-producer/src/test/java/cn/mldn/microboot/TestMessageService.java new file mode 100644 index 0000000..e028de3 --- /dev/null +++ b/microboot-kafka-producer/src/test/java/cn/mldn/microboot/TestMessageService.java @@ -0,0 +1,24 @@ +package cn.mldn.microboot; + +import javax.annotation.Resource; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +import cn.mldn.microboot.service.IMessageProducerService; +@SpringBootTest(classes = StartSpringBootMain.class) +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +public class TestMessageService { + @Resource + private IMessageProducerService messageService; + @Test + public void testStart() throws Exception { + for (int x = 0; x < 100; x++) { + this.messageService.send("mldn - " + x); + } + } +} diff --git a/microboot-kafka-producer/target/classes/META-INF/MANIFEST.MF b/microboot-kafka-producer/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d4c16dd --- /dev/null +++ b/microboot-kafka-producer/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Built-By: foreveriss +Build-Jdk: 1.8.0_121 +Created-By: Maven Integration for Eclipse + diff --git a/microboot-kafka-producer/target/classes/META-INF/maven/cn.mldn/microboot-kafka-producer/pom.properties b/microboot-kafka-producer/target/classes/META-INF/maven/cn.mldn/microboot-kafka-producer/pom.properties new file mode 100644 index 0000000..f5d6b02 --- /dev/null +++ b/microboot-kafka-producer/target/classes/META-INF/maven/cn.mldn/microboot-kafka-producer/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Thu Jun 29 23:45:05 CST 2017 +version=0.0.1-SNAPSHOT +groupId=cn.mldn +m2e.projectName=microboot-kafka-producer +m2e.projectLocation=/Users/foreveriss/workspace/microboot/microboot-kafka-producer +artifactId=microboot-kafka-producer diff --git a/microboot-kafka-producer/target/classes/META-INF/maven/cn.mldn/microboot-kafka-producer/pom.xml b/microboot-kafka-producer/target/classes/META-INF/maven/cn.mldn/microboot-kafka-producer/pom.xml new file mode 100644 index 0000000..fdab2ab --- /dev/null +++ b/microboot-kafka-producer/target/classes/META-INF/maven/cn.mldn/microboot-kafka-producer/pom.xml @@ -0,0 +1,61 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-kafka-producer + microboot-kafka-producer + http://maven.apache.org + + UTF-8 + + + + ch.qos.logback + logback-core + + + + org.springframework.kafka + spring-kafka + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-kafka-producer/target/classes/application.yml b/microboot-kafka-producer/target/classes/application.yml new file mode 100644 index 0000000..8e6b49d --- /dev/null +++ b/microboot-kafka-producer/target/classes/application.yml @@ -0,0 +1,16 @@ +server: + port: 80 +spring: + messages: + basename: i18n/Messages,i18n/Pages + kafka: + bootstrap-servers: + - kafka-single:9095 + template: + default-topic: mldn-microboot + producer: + key-serializer: org.apache.kafka.common.serialization.StringSerializer + value-serializer: org.apache.kafka.common.serialization.StringSerializer + properties: + sasl.mechanism: PLAIN + security.protocol: SASL_PLAINTEXT \ No newline at end of file diff --git a/microboot-kafka-producer/target/classes/cn/mldn/microboot/StartSpringBootMain.class b/microboot-kafka-producer/target/classes/cn/mldn/microboot/StartSpringBootMain.class new file mode 100644 index 0000000..18bb195 Binary files /dev/null and b/microboot-kafka-producer/target/classes/cn/mldn/microboot/StartSpringBootMain.class differ diff --git a/microboot-kafka-producer/target/classes/cn/mldn/microboot/service/IMessageProducerService.class b/microboot-kafka-producer/target/classes/cn/mldn/microboot/service/IMessageProducerService.class new file mode 100644 index 0000000..1c69cc6 Binary files /dev/null and b/microboot-kafka-producer/target/classes/cn/mldn/microboot/service/IMessageProducerService.class differ diff --git a/microboot-kafka-producer/target/classes/cn/mldn/microboot/service/impl/MessageProducerServiceImpl.class b/microboot-kafka-producer/target/classes/cn/mldn/microboot/service/impl/MessageProducerServiceImpl.class new file mode 100644 index 0000000..1e3fd7a Binary files /dev/null and b/microboot-kafka-producer/target/classes/cn/mldn/microboot/service/impl/MessageProducerServiceImpl.class differ diff --git a/microboot-kafka-producer/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class b/microboot-kafka-producer/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class new file mode 100644 index 0000000..57c2010 Binary files /dev/null and b/microboot-kafka-producer/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class differ diff --git a/microboot-kafka-producer/target/classes/cn/mldn/microboot/vo/Dept.class b/microboot-kafka-producer/target/classes/cn/mldn/microboot/vo/Dept.class new file mode 100644 index 0000000..46f2356 Binary files /dev/null and b/microboot-kafka-producer/target/classes/cn/mldn/microboot/vo/Dept.class differ diff --git a/microboot-kafka-producer/target/classes/cn/mldn/microboot/vo/Member.class b/microboot-kafka-producer/target/classes/cn/mldn/microboot/vo/Member.class new file mode 100644 index 0000000..59c00d5 Binary files /dev/null and b/microboot-kafka-producer/target/classes/cn/mldn/microboot/vo/Member.class differ diff --git a/microboot-kafka-producer/target/classes/i18n/Messages.properties b/microboot-kafka-producer/target/classes/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-kafka-producer/target/classes/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-kafka-producer/target/classes/i18n/Pages.properties b/microboot-kafka-producer/target/classes/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-kafka-producer/target/classes/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-kafka-producer/target/classes/logback.xml b/microboot-kafka-producer/target/classes/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-kafka-producer/target/classes/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-kafka-producer/target/classes/mybatis/mapper/cn/mldn/Dept.xml b/microboot-kafka-producer/target/classes/mybatis/mapper/cn/mldn/Dept.xml new file mode 100644 index 0000000..6557a3a --- /dev/null +++ b/microboot-kafka-producer/target/classes/mybatis/mapper/cn/mldn/Dept.xml @@ -0,0 +1,11 @@ + + + + + + INSERT INTO dept(dname) VALUES (#{dname}) ; + + diff --git a/microboot-kafka-producer/target/classes/mybatis/mybatis.cfg.xml b/microboot-kafka-producer/target/classes/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4d128c0 --- /dev/null +++ b/microboot-kafka-producer/target/classes/mybatis/mybatis.cfg.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/microboot-kafka-producer/target/classes/static/images/mldn.ico b/microboot-kafka-producer/target/classes/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-kafka-producer/target/classes/static/images/mldn.ico differ diff --git a/microboot-kafka-producer/target/classes/static/info/message_info.html b/microboot-kafka-producer/target/classes/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-kafka-producer/target/classes/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-kafka-producer/target/classes/static/js/main.js b/microboot-kafka-producer/target/classes/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-kafka-producer/target/classes/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-kafka-producer/target/classes/static/message_index.html b/microboot-kafka-producer/target/classes/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-kafka-producer/target/classes/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-kafka-producer/target/classes/templates/upload_page.html b/microboot-kafka-producer/target/classes/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-kafka-producer/target/classes/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-kafka-producer/target/classes/templates/upload_show.html b/microboot-kafka-producer/target/classes/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-kafka-producer/target/classes/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-kafka-producer/target/test-classes/cn/mldn/microboot/TestMessageService.class b/microboot-kafka-producer/target/test-classes/cn/mldn/microboot/TestMessageService.class new file mode 100644 index 0000000..fddd17f Binary files /dev/null and b/microboot-kafka-producer/target/test-classes/cn/mldn/microboot/TestMessageService.class differ diff --git a/microboot-mybatis/.classpath b/microboot-mybatis/.classpath new file mode 100644 index 0000000..a6f04e8 --- /dev/null +++ b/microboot-mybatis/.classpath @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/microboot-mybatis/.project b/microboot-mybatis/.project new file mode 100644 index 0000000..82215d1 --- /dev/null +++ b/microboot-mybatis/.project @@ -0,0 +1,35 @@ + + + microboot-mybatis + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/microboot-mybatis/.settings/org.eclipse.core.resources.prefs b/microboot-mybatis/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..a6dcfb7 --- /dev/null +++ b/microboot-mybatis/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/main/view=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/microboot-mybatis/.settings/org.eclipse.jdt.core.prefs b/microboot-mybatis/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..d59e09c --- /dev/null +++ b/microboot-mybatis/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/microboot-mybatis/.settings/org.eclipse.m2e.core.prefs b/microboot-mybatis/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/microboot-mybatis/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/microboot-mybatis/.settings/org.eclipse.wst.common.project.facet.core.xml b/microboot-mybatis/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..e822977 --- /dev/null +++ b/microboot-mybatis/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ + + + + diff --git a/microboot-mybatis/pom.xml b/microboot-mybatis/pom.xml new file mode 100644 index 0000000..275af75 --- /dev/null +++ b/microboot-mybatis/pom.xml @@ -0,0 +1,69 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-mybatis + microboot-mybatis + http://maven.apache.org + + UTF-8 + + + + mysql + mysql-connector-java + + + com.alibaba + druid + + + ch.qos.logback + logback-core + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-mybatis/src/main/java/cn/mldn/microboot/StartSpringBootMain.java b/microboot-mybatis/src/main/java/cn/mldn/microboot/StartSpringBootMain.java new file mode 100644 index 0000000..beb472b --- /dev/null +++ b/microboot-mybatis/src/main/java/cn/mldn/microboot/StartSpringBootMain.java @@ -0,0 +1,13 @@ +package cn.mldn.microboot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +@SpringBootApplication // 启动SpringBoot程序,而后自带子包扫描 +@EnableTransactionManagement +public class StartSpringBootMain { + public static void main(String[] args) throws Exception { + SpringApplication.run(StartSpringBootMain.class, args); + } +} diff --git a/microboot-mybatis/src/main/java/cn/mldn/microboot/config/DruidConfig.java b/microboot-mybatis/src/main/java/cn/mldn/microboot/config/DruidConfig.java new file mode 100644 index 0000000..1512a62 --- /dev/null +++ b/microboot-mybatis/src/main/java/cn/mldn/microboot/config/DruidConfig.java @@ -0,0 +1,42 @@ +package cn.mldn.microboot.config; + +import javax.sql.DataSource; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.boot.web.servlet.ServletRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import com.alibaba.druid.pool.DruidDataSource; +import com.alibaba.druid.support.http.StatViewServlet; +import com.alibaba.druid.support.http.WebStatFilter; + +@Configuration +public class DruidConfig { + @Bean + public ServletRegistrationBean druidServlet() { // 主要实现WEB监控的配置处理 + ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean( + new StatViewServlet(), "/druid/*"); // 现在要进行druid监控的配置处理操作 + servletRegistrationBean.addInitParameter("allow", + "127.0.0.1,192.168.28.159"); // 白名单 + servletRegistrationBean.addInitParameter("deny", "192.168.28.200"); // 黑名单 + servletRegistrationBean.addInitParameter("loginUsername", "mldnjava"); // 用户名 + servletRegistrationBean.addInitParameter("loginPassword", "hello"); // 密码 + servletRegistrationBean.addInitParameter("resetEnable", "false"); // 是否可以重置数据源 + return servletRegistrationBean ; + } + @Bean + public FilterRegistrationBean filterRegistrationBean() { + FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean() ; + filterRegistrationBean.setFilter(new WebStatFilter()); + filterRegistrationBean.addUrlPatterns("/*"); // 所有请求进行监控处理 + filterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.css,/druid/*"); + return filterRegistrationBean ; + } + @Bean + @ConfigurationProperties(prefix = "spring.datasource") + public DataSource druidDataSource() { + return new DruidDataSource(); + } +} diff --git a/microboot-mybatis/src/main/java/cn/mldn/microboot/controller/DeptController.java b/microboot-mybatis/src/main/java/cn/mldn/microboot/controller/DeptController.java new file mode 100644 index 0000000..452782e --- /dev/null +++ b/microboot-mybatis/src/main/java/cn/mldn/microboot/controller/DeptController.java @@ -0,0 +1,20 @@ +package cn.mldn.microboot.controller; + +import javax.annotation.Resource; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import cn.mldn.microboot.service.IDeptService; +import cn.mldn.microboot.util.controller.AbstractBaseController; + +@RestController +public class DeptController extends AbstractBaseController { + @Resource + private IDeptService deptService ; + @RequestMapping(value = "/list", method = RequestMethod.GET) + public Object list() { // 通过model可以实现内容的传递 + return this.deptService.list() ; + } +} diff --git a/microboot-mybatis/src/main/java/cn/mldn/microboot/dao/IDeptDAO.java b/microboot-mybatis/src/main/java/cn/mldn/microboot/dao/IDeptDAO.java new file mode 100644 index 0000000..758693b --- /dev/null +++ b/microboot-mybatis/src/main/java/cn/mldn/microboot/dao/IDeptDAO.java @@ -0,0 +1,12 @@ +package cn.mldn.microboot.dao; + +import java.util.List; + +import org.apache.ibatis.annotations.Mapper; + +import cn.mldn.microboot.vo.Dept; +@Mapper +public interface IDeptDAO { + public List findAll(); + public boolean doCreate(Dept vo) ; +} diff --git a/microboot-mybatis/src/main/java/cn/mldn/microboot/service/IDeptService.java b/microboot-mybatis/src/main/java/cn/mldn/microboot/service/IDeptService.java new file mode 100644 index 0000000..2f10d1e --- /dev/null +++ b/microboot-mybatis/src/main/java/cn/mldn/microboot/service/IDeptService.java @@ -0,0 +1,15 @@ +package cn.mldn.microboot.service; + +import java.util.List; + +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import cn.mldn.microboot.vo.Dept; + +public interface IDeptService { + @Transactional(readOnly = true) + public List list() ; + @Transactional(propagation=Propagation.REQUIRED) + public boolean add(Dept vo) ; +} diff --git a/microboot-mybatis/src/main/java/cn/mldn/microboot/service/impl/DeptServiceImpl.java b/microboot-mybatis/src/main/java/cn/mldn/microboot/service/impl/DeptServiceImpl.java new file mode 100644 index 0000000..ba710b7 --- /dev/null +++ b/microboot-mybatis/src/main/java/cn/mldn/microboot/service/impl/DeptServiceImpl.java @@ -0,0 +1,25 @@ +package cn.mldn.microboot.service.impl; + +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import cn.mldn.microboot.dao.IDeptDAO; +import cn.mldn.microboot.service.IDeptService; +import cn.mldn.microboot.vo.Dept; +import cn.mldn.microboot.vo.Member; +@Service +public class DeptServiceImpl implements IDeptService { + @Resource + private IDeptDAO deptDAO; + @Override + public List list() { + return this.deptDAO.findAll(); + } + @Override + public boolean add(Dept vo) { + return this.deptDAO.doCreate(vo); + } +} diff --git a/microboot-mybatis/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java b/microboot-mybatis/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java new file mode 100644 index 0000000..5127e93 --- /dev/null +++ b/microboot-mybatis/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java @@ -0,0 +1,15 @@ +package cn.mldn.microboot.util.controller; + +import java.util.Locale; + +import javax.annotation.Resource; + +import org.springframework.context.MessageSource; + +public abstract class AbstractBaseController { + @Resource + private MessageSource messageSource; // 自动注入此资源对象 + public String getMessage(String key, String... args) { + return this.messageSource.getMessage(key, args, Locale.getDefault()); + } +} diff --git a/microboot-mybatis/src/main/java/cn/mldn/microboot/vo/Dept.java b/microboot-mybatis/src/main/java/cn/mldn/microboot/vo/Dept.java new file mode 100644 index 0000000..7971469 --- /dev/null +++ b/microboot-mybatis/src/main/java/cn/mldn/microboot/vo/Dept.java @@ -0,0 +1,25 @@ +package cn.mldn.microboot.vo; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class Dept implements Serializable { + private Long deptno ; + private String dname ; + public Long getDeptno() { + return deptno; + } + public void setDeptno(Long deptno) { + this.deptno = deptno; + } + public String getDname() { + return dname; + } + public void setDname(String dname) { + this.dname = dname; + } + @Override + public String toString() { + return "Dept [deptno=" + deptno + ", dname=" + dname + "]"; + } +} diff --git a/microboot-mybatis/src/main/java/cn/mldn/microboot/vo/Member.java b/microboot-mybatis/src/main/java/cn/mldn/microboot/vo/Member.java new file mode 100644 index 0000000..f6a9cd8 --- /dev/null +++ b/microboot-mybatis/src/main/java/cn/mldn/microboot/vo/Member.java @@ -0,0 +1,44 @@ +package cn.mldn.microboot.vo; + +import java.io.Serializable; +import java.util.Date; + +@SuppressWarnings("serial") +public class Member implements Serializable { + private Long mid ; + private String name ; + private Integer age ; + private Date birthday ; + private Double salary ; + public Long getMid() { + return mid; + } + public void setMid(Long mid) { + this.mid = mid; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public Integer getAge() { + return age; + } + public void setAge(Integer age) { + this.age = age; + } + public Date getBirthday() { + return birthday; + } + public void setBirthday(Date birthday) { + this.birthday = birthday; + } + public Double getSalary() { + return salary; + } + public void setSalary(Double salary) { + this.salary = salary; + } +} + diff --git a/microboot-mybatis/src/main/java/数据库创建脚本.sql b/microboot-mybatis/src/main/java/数据库创建脚本.sql new file mode 100644 index 0000000..edd35b2 --- /dev/null +++ b/microboot-mybatis/src/main/java/数据库创建脚本.sql @@ -0,0 +1,13 @@ +DROP DATBASE IF EXISTS mldn ; +CREATE DATBASE mldn CHARACTER SET UTF8 ; +USE mldn ; +CREATE TABLE dept ( + deptno BIGINT AUTO_INCREMENT , + dname VARCHAR(50) , + CONSTRAINT pk_deptno PRIMARY KEY(deptno) +) ; +INSERT INTO dept(dname) VALUES ('开发部') ; +INSERT INTO dept(dname) VALUES ('财务部') ; +INSERT INTO dept(dname) VALUES ('市场部') ; +INSERT INTO dept(dname) VALUES ('后勤部') ; +INSERT INTO dept(dname) VALUES ('公关部') ; \ No newline at end of file diff --git a/microboot-mybatis/src/main/resources/application.yml b/microboot-mybatis/src/main/resources/application.yml new file mode 100644 index 0000000..3693575 --- /dev/null +++ b/microboot-mybatis/src/main/resources/application.yml @@ -0,0 +1,22 @@ +server: + port: 80 +mybatis: + config-location: classpath:mybatis/mybatis.cfg.xml # mybatis配置文件所在路径 + type-aliases-package: cn.mldn.microboot.vo # 定义所有操作类的别名所在包 + mapper-locations: # 所有的mapper映射文件 + - classpath:mybatis/mapper/**/*.xml +spring: + messages: + basename: i18n/Messages,i18n/Pages + datasource: + type: com.alibaba.druid.pool.DruidDataSource # 配置当前要使用的数据源的操作类型 + driver-class-name: org.gjt.mm.mysql.Driver # 配置MySQL的驱动程序类 + url: jdbc:mysql://localhost:3306/mldn # 数据库连接地址 + username: root # 数据库用户名 + password: mysqladmin # 数据库连接密码 + filters: stat,wall,log4j + dbcp2: # 进行数据库连接池的配置 + min-idle: 5 # 数据库连接池的最小维持连接数 + initial-size: 5 # 初始化提供的连接数 + max-total: 5 # 最大的连接数 + max-wait-millis: 200 # 等待连接获取的最大超时时间 \ No newline at end of file diff --git a/microboot-mybatis/src/main/resources/i18n/Messages.properties b/microboot-mybatis/src/main/resources/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-mybatis/src/main/resources/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-mybatis/src/main/resources/i18n/Pages.properties b/microboot-mybatis/src/main/resources/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-mybatis/src/main/resources/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-mybatis/src/main/resources/logback.xml b/microboot-mybatis/src/main/resources/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-mybatis/src/main/resources/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-mybatis/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml b/microboot-mybatis/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml new file mode 100644 index 0000000..6557a3a --- /dev/null +++ b/microboot-mybatis/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml @@ -0,0 +1,11 @@ + + + + + + INSERT INTO dept(dname) VALUES (#{dname}) ; + + diff --git a/microboot-mybatis/src/main/resources/mybatis/mybatis.cfg.xml b/microboot-mybatis/src/main/resources/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4d128c0 --- /dev/null +++ b/microboot-mybatis/src/main/resources/mybatis/mybatis.cfg.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/microboot-mybatis/src/main/view/static/images/mldn.ico b/microboot-mybatis/src/main/view/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-mybatis/src/main/view/static/images/mldn.ico differ diff --git a/microboot-mybatis/src/main/view/static/info/message_info.html b/microboot-mybatis/src/main/view/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-mybatis/src/main/view/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-mybatis/src/main/view/static/js/main.js b/microboot-mybatis/src/main/view/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-mybatis/src/main/view/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-mybatis/src/main/view/static/message_index.html b/microboot-mybatis/src/main/view/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-mybatis/src/main/view/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-mybatis/src/main/view/templates/upload_page.html b/microboot-mybatis/src/main/view/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-mybatis/src/main/view/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-mybatis/src/main/view/templates/upload_show.html b/microboot-mybatis/src/main/view/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-mybatis/src/main/view/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-mybatis/src/test/java/cn/mldn/microboot/AppTest.java b/microboot-mybatis/src/test/java/cn/mldn/microboot/AppTest.java new file mode 100644 index 0000000..a094258 --- /dev/null +++ b/microboot-mybatis/src/test/java/cn/mldn/microboot/AppTest.java @@ -0,0 +1,38 @@ +package cn.mldn.microboot; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/microboot-mybatis/src/test/java/cn/mldn/microboot/test/TestDataSource.java b/microboot-mybatis/src/test/java/cn/mldn/microboot/test/TestDataSource.java new file mode 100644 index 0000000..5a04c75 --- /dev/null +++ b/microboot-mybatis/src/test/java/cn/mldn/microboot/test/TestDataSource.java @@ -0,0 +1,24 @@ +package cn.mldn.microboot.test; + +import javax.annotation.Resource; +import javax.sql.DataSource; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +import cn.mldn.microboot.StartSpringBootMain; + +@SpringBootTest(classes = StartSpringBootMain.class) +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +public class TestDataSource { + @Resource + private DataSource dataSource; + @Test + public void testConnection() throws Exception { + System.out.println(this.dataSource); + } +} diff --git a/microboot-mybatis/src/test/java/cn/mldn/microboot/test/TestDeptService.java b/microboot-mybatis/src/test/java/cn/mldn/microboot/test/TestDeptService.java new file mode 100644 index 0000000..46636a4 --- /dev/null +++ b/microboot-mybatis/src/test/java/cn/mldn/microboot/test/TestDeptService.java @@ -0,0 +1,31 @@ +package cn.mldn.microboot.test; + +import javax.annotation.Resource; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +import cn.mldn.microboot.StartSpringBootMain; +import cn.mldn.microboot.service.IDeptService; +import cn.mldn.microboot.vo.Dept; + +@SpringBootTest(classes = StartSpringBootMain.class) +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +public class TestDeptService { + @Resource + private IDeptService deptService; + @Test + public void testList() throws Exception { + System.out.println(this.deptService.list()); + } + @Test + public void testAdd() throws Exception { + Dept dept = new Dept(); + dept.setDname("测试部"); + System.out.println(this.deptService.add(dept)); + } +} diff --git a/microboot-mybatis/target/classes/META-INF/MANIFEST.MF b/microboot-mybatis/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d4c16dd --- /dev/null +++ b/microboot-mybatis/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Built-By: foreveriss +Build-Jdk: 1.8.0_121 +Created-By: Maven Integration for Eclipse + diff --git a/microboot-mybatis/target/classes/META-INF/maven/cn.mldn/microboot-mybatis/pom.properties b/microboot-mybatis/target/classes/META-INF/maven/cn.mldn/microboot-mybatis/pom.properties new file mode 100644 index 0000000..ecc6272 --- /dev/null +++ b/microboot-mybatis/target/classes/META-INF/maven/cn.mldn/microboot-mybatis/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Thu Jun 29 23:45:07 CST 2017 +version=0.0.1-SNAPSHOT +groupId=cn.mldn +m2e.projectName=microboot-mybatis +m2e.projectLocation=/Users/foreveriss/workspace/microboot/microboot-mybatis +artifactId=microboot-mybatis diff --git a/microboot-mybatis/target/classes/META-INF/maven/cn.mldn/microboot-mybatis/pom.xml b/microboot-mybatis/target/classes/META-INF/maven/cn.mldn/microboot-mybatis/pom.xml new file mode 100644 index 0000000..275af75 --- /dev/null +++ b/microboot-mybatis/target/classes/META-INF/maven/cn.mldn/microboot-mybatis/pom.xml @@ -0,0 +1,69 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-mybatis + microboot-mybatis + http://maven.apache.org + + UTF-8 + + + + mysql + mysql-connector-java + + + com.alibaba + druid + + + ch.qos.logback + logback-core + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-mybatis/target/classes/application.yml b/microboot-mybatis/target/classes/application.yml new file mode 100644 index 0000000..3693575 --- /dev/null +++ b/microboot-mybatis/target/classes/application.yml @@ -0,0 +1,22 @@ +server: + port: 80 +mybatis: + config-location: classpath:mybatis/mybatis.cfg.xml # mybatis配置文件所在路径 + type-aliases-package: cn.mldn.microboot.vo # 定义所有操作类的别名所在包 + mapper-locations: # 所有的mapper映射文件 + - classpath:mybatis/mapper/**/*.xml +spring: + messages: + basename: i18n/Messages,i18n/Pages + datasource: + type: com.alibaba.druid.pool.DruidDataSource # 配置当前要使用的数据源的操作类型 + driver-class-name: org.gjt.mm.mysql.Driver # 配置MySQL的驱动程序类 + url: jdbc:mysql://localhost:3306/mldn # 数据库连接地址 + username: root # 数据库用户名 + password: mysqladmin # 数据库连接密码 + filters: stat,wall,log4j + dbcp2: # 进行数据库连接池的配置 + min-idle: 5 # 数据库连接池的最小维持连接数 + initial-size: 5 # 初始化提供的连接数 + max-total: 5 # 最大的连接数 + max-wait-millis: 200 # 等待连接获取的最大超时时间 \ No newline at end of file diff --git a/microboot-mybatis/target/classes/cn/mldn/microboot/StartSpringBootMain.class b/microboot-mybatis/target/classes/cn/mldn/microboot/StartSpringBootMain.class new file mode 100644 index 0000000..e777efe Binary files /dev/null and b/microboot-mybatis/target/classes/cn/mldn/microboot/StartSpringBootMain.class differ diff --git a/microboot-mybatis/target/classes/cn/mldn/microboot/config/DruidConfig.class b/microboot-mybatis/target/classes/cn/mldn/microboot/config/DruidConfig.class new file mode 100644 index 0000000..788d114 Binary files /dev/null and b/microboot-mybatis/target/classes/cn/mldn/microboot/config/DruidConfig.class differ diff --git a/microboot-mybatis/target/classes/cn/mldn/microboot/controller/DeptController.class b/microboot-mybatis/target/classes/cn/mldn/microboot/controller/DeptController.class new file mode 100644 index 0000000..30d865c Binary files /dev/null and b/microboot-mybatis/target/classes/cn/mldn/microboot/controller/DeptController.class differ diff --git a/microboot-mybatis/target/classes/cn/mldn/microboot/dao/IDeptDAO.class b/microboot-mybatis/target/classes/cn/mldn/microboot/dao/IDeptDAO.class new file mode 100644 index 0000000..c2964bd Binary files /dev/null and b/microboot-mybatis/target/classes/cn/mldn/microboot/dao/IDeptDAO.class differ diff --git a/microboot-mybatis/target/classes/cn/mldn/microboot/service/IDeptService.class b/microboot-mybatis/target/classes/cn/mldn/microboot/service/IDeptService.class new file mode 100644 index 0000000..81cf889 Binary files /dev/null and b/microboot-mybatis/target/classes/cn/mldn/microboot/service/IDeptService.class differ diff --git a/microboot-mybatis/target/classes/cn/mldn/microboot/service/impl/DeptServiceImpl.class b/microboot-mybatis/target/classes/cn/mldn/microboot/service/impl/DeptServiceImpl.class new file mode 100644 index 0000000..90323d4 Binary files /dev/null and b/microboot-mybatis/target/classes/cn/mldn/microboot/service/impl/DeptServiceImpl.class differ diff --git a/microboot-mybatis/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class b/microboot-mybatis/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class new file mode 100644 index 0000000..57c2010 Binary files /dev/null and b/microboot-mybatis/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class differ diff --git a/microboot-mybatis/target/classes/cn/mldn/microboot/vo/Dept.class b/microboot-mybatis/target/classes/cn/mldn/microboot/vo/Dept.class new file mode 100644 index 0000000..46f2356 Binary files /dev/null and b/microboot-mybatis/target/classes/cn/mldn/microboot/vo/Dept.class differ diff --git a/microboot-mybatis/target/classes/cn/mldn/microboot/vo/Member.class b/microboot-mybatis/target/classes/cn/mldn/microboot/vo/Member.class new file mode 100644 index 0000000..59c00d5 Binary files /dev/null and b/microboot-mybatis/target/classes/cn/mldn/microboot/vo/Member.class differ diff --git a/microboot-mybatis/target/classes/i18n/Messages.properties b/microboot-mybatis/target/classes/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-mybatis/target/classes/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-mybatis/target/classes/i18n/Pages.properties b/microboot-mybatis/target/classes/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-mybatis/target/classes/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-mybatis/target/classes/logback.xml b/microboot-mybatis/target/classes/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-mybatis/target/classes/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-mybatis/target/classes/mybatis/mapper/cn/mldn/Dept.xml b/microboot-mybatis/target/classes/mybatis/mapper/cn/mldn/Dept.xml new file mode 100644 index 0000000..6557a3a --- /dev/null +++ b/microboot-mybatis/target/classes/mybatis/mapper/cn/mldn/Dept.xml @@ -0,0 +1,11 @@ + + + + + + INSERT INTO dept(dname) VALUES (#{dname}) ; + + diff --git a/microboot-mybatis/target/classes/mybatis/mybatis.cfg.xml b/microboot-mybatis/target/classes/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4d128c0 --- /dev/null +++ b/microboot-mybatis/target/classes/mybatis/mybatis.cfg.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/microboot-mybatis/target/classes/static/images/mldn.ico b/microboot-mybatis/target/classes/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-mybatis/target/classes/static/images/mldn.ico differ diff --git a/microboot-mybatis/target/classes/static/info/message_info.html b/microboot-mybatis/target/classes/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-mybatis/target/classes/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-mybatis/target/classes/static/js/main.js b/microboot-mybatis/target/classes/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-mybatis/target/classes/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-mybatis/target/classes/static/message_index.html b/microboot-mybatis/target/classes/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-mybatis/target/classes/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-mybatis/target/classes/templates/upload_page.html b/microboot-mybatis/target/classes/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-mybatis/target/classes/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-mybatis/target/classes/templates/upload_show.html b/microboot-mybatis/target/classes/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-mybatis/target/classes/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-mybatis/target/test-classes/cn/mldn/microboot/AppTest.class b/microboot-mybatis/target/test-classes/cn/mldn/microboot/AppTest.class new file mode 100644 index 0000000..d317ee0 Binary files /dev/null and b/microboot-mybatis/target/test-classes/cn/mldn/microboot/AppTest.class differ diff --git a/microboot-mybatis/target/test-classes/cn/mldn/microboot/test/TestDataSource.class b/microboot-mybatis/target/test-classes/cn/mldn/microboot/test/TestDataSource.class new file mode 100644 index 0000000..476e0ec Binary files /dev/null and b/microboot-mybatis/target/test-classes/cn/mldn/microboot/test/TestDataSource.class differ diff --git a/microboot-mybatis/target/test-classes/cn/mldn/microboot/test/TestDeptService.class b/microboot-mybatis/target/test-classes/cn/mldn/microboot/test/TestDeptService.class new file mode 100644 index 0000000..1b3379a Binary files /dev/null and b/microboot-mybatis/target/test-classes/cn/mldn/microboot/test/TestDeptService.class differ diff --git a/microboot-rabbitmq-consumer/.classpath b/microboot-rabbitmq-consumer/.classpath new file mode 100644 index 0000000..a6f04e8 --- /dev/null +++ b/microboot-rabbitmq-consumer/.classpath @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/microboot-rabbitmq-consumer/.project b/microboot-rabbitmq-consumer/.project new file mode 100644 index 0000000..fd8375e --- /dev/null +++ b/microboot-rabbitmq-consumer/.project @@ -0,0 +1,35 @@ + + + microboot-rabbitmq-consumer + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/microboot-rabbitmq-consumer/.settings/org.eclipse.core.resources.prefs b/microboot-rabbitmq-consumer/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..a6dcfb7 --- /dev/null +++ b/microboot-rabbitmq-consumer/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/main/view=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/microboot-rabbitmq-consumer/.settings/org.eclipse.jdt.core.prefs b/microboot-rabbitmq-consumer/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..d59e09c --- /dev/null +++ b/microboot-rabbitmq-consumer/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/microboot-rabbitmq-consumer/.settings/org.eclipse.m2e.core.prefs b/microboot-rabbitmq-consumer/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/microboot-rabbitmq-consumer/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/microboot-rabbitmq-consumer/.settings/org.eclipse.wst.common.project.facet.core.xml b/microboot-rabbitmq-consumer/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..e822977 --- /dev/null +++ b/microboot-rabbitmq-consumer/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ + + + + diff --git a/microboot-rabbitmq-consumer/pom.xml b/microboot-rabbitmq-consumer/pom.xml new file mode 100644 index 0000000..9aa2870 --- /dev/null +++ b/microboot-rabbitmq-consumer/pom.xml @@ -0,0 +1,61 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-rabbitmq-consumer + microboot-rabbitmq-consumer + http://maven.apache.org + + UTF-8 + + + + ch.qos.logback + logback-core + + + + org.springframework.boot + spring-boot-starter-amqp + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-rabbitmq-consumer/src/main/java/cn/mldn/microboot/StartSpringBootMain.java b/microboot-rabbitmq-consumer/src/main/java/cn/mldn/microboot/StartSpringBootMain.java new file mode 100644 index 0000000..beb472b --- /dev/null +++ b/microboot-rabbitmq-consumer/src/main/java/cn/mldn/microboot/StartSpringBootMain.java @@ -0,0 +1,13 @@ +package cn.mldn.microboot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +@SpringBootApplication // 启动SpringBoot程序,而后自带子包扫描 +@EnableTransactionManagement +public class StartSpringBootMain { + public static void main(String[] args) throws Exception { + SpringApplication.run(StartSpringBootMain.class, args); + } +} diff --git a/microboot-rabbitmq-consumer/src/main/java/cn/mldn/microboot/config/ConsumerConfig.java b/microboot-rabbitmq-consumer/src/main/java/cn/mldn/microboot/config/ConsumerConfig.java new file mode 100644 index 0000000..b6e76a4 --- /dev/null +++ b/microboot-rabbitmq-consumer/src/main/java/cn/mldn/microboot/config/ConsumerConfig.java @@ -0,0 +1,27 @@ +package cn.mldn.microboot.config; + +import org.springframework.amqp.core.Binding; +import org.springframework.amqp.core.BindingBuilder; +import org.springframework.amqp.core.DirectExchange; +import org.springframework.amqp.core.Queue; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class ConsumerConfig { + public static final String EXCHANGE = "mldn.microboot.exchange"; // 交换空间名称 + public static final String ROUTINGKEY = "mldn.microboot.routingkey"; // 设置路由key + public static final String QUEUE_NAME = "mldn.microboot.queue"; // 队列名称 + @Bean + public Queue queue() { // 要穿件的队列信息 + return new Queue(QUEUE_NAME); + } + @Bean + public DirectExchange getDirectExchange() { // 使用直连的模式 + return new DirectExchange(EXCHANGE, true, true); + } + @Bean + public Binding bindingExchangeQueue(DirectExchange exchange,Queue queue) { + return BindingBuilder.bind(queue).to(exchange).with(ROUTINGKEY) ; + } +} diff --git a/microboot-rabbitmq-consumer/src/main/java/cn/mldn/microboot/consumer/MessageConsumerService.java b/microboot-rabbitmq-consumer/src/main/java/cn/mldn/microboot/consumer/MessageConsumerService.java new file mode 100644 index 0000000..3f985fd --- /dev/null +++ b/microboot-rabbitmq-consumer/src/main/java/cn/mldn/microboot/consumer/MessageConsumerService.java @@ -0,0 +1,12 @@ +package cn.mldn.microboot.consumer; + +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.stereotype.Service; + +@Service +public class MessageConsumerService { + @RabbitListener(queues="mldn.microboot.queue") + public void receiveMessage(String text) { // 进行消息接收处理 + System.err.println("【*** 接收消息 ***】" + text); + } +} diff --git a/microboot-rabbitmq-consumer/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java b/microboot-rabbitmq-consumer/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java new file mode 100644 index 0000000..5127e93 --- /dev/null +++ b/microboot-rabbitmq-consumer/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java @@ -0,0 +1,15 @@ +package cn.mldn.microboot.util.controller; + +import java.util.Locale; + +import javax.annotation.Resource; + +import org.springframework.context.MessageSource; + +public abstract class AbstractBaseController { + @Resource + private MessageSource messageSource; // 自动注入此资源对象 + public String getMessage(String key, String... args) { + return this.messageSource.getMessage(key, args, Locale.getDefault()); + } +} diff --git a/microboot-rabbitmq-consumer/src/main/java/cn/mldn/microboot/vo/Dept.java b/microboot-rabbitmq-consumer/src/main/java/cn/mldn/microboot/vo/Dept.java new file mode 100644 index 0000000..7971469 --- /dev/null +++ b/microboot-rabbitmq-consumer/src/main/java/cn/mldn/microboot/vo/Dept.java @@ -0,0 +1,25 @@ +package cn.mldn.microboot.vo; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class Dept implements Serializable { + private Long deptno ; + private String dname ; + public Long getDeptno() { + return deptno; + } + public void setDeptno(Long deptno) { + this.deptno = deptno; + } + public String getDname() { + return dname; + } + public void setDname(String dname) { + this.dname = dname; + } + @Override + public String toString() { + return "Dept [deptno=" + deptno + ", dname=" + dname + "]"; + } +} diff --git a/microboot-rabbitmq-consumer/src/main/java/cn/mldn/microboot/vo/Member.java b/microboot-rabbitmq-consumer/src/main/java/cn/mldn/microboot/vo/Member.java new file mode 100644 index 0000000..f6a9cd8 --- /dev/null +++ b/microboot-rabbitmq-consumer/src/main/java/cn/mldn/microboot/vo/Member.java @@ -0,0 +1,44 @@ +package cn.mldn.microboot.vo; + +import java.io.Serializable; +import java.util.Date; + +@SuppressWarnings("serial") +public class Member implements Serializable { + private Long mid ; + private String name ; + private Integer age ; + private Date birthday ; + private Double salary ; + public Long getMid() { + return mid; + } + public void setMid(Long mid) { + this.mid = mid; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public Integer getAge() { + return age; + } + public void setAge(Integer age) { + this.age = age; + } + public Date getBirthday() { + return birthday; + } + public void setBirthday(Date birthday) { + this.birthday = birthday; + } + public Double getSalary() { + return salary; + } + public void setSalary(Double salary) { + this.salary = salary; + } +} + diff --git a/microboot-rabbitmq-consumer/src/main/java/数据库创建脚本.sql b/microboot-rabbitmq-consumer/src/main/java/数据库创建脚本.sql new file mode 100644 index 0000000..edd35b2 --- /dev/null +++ b/microboot-rabbitmq-consumer/src/main/java/数据库创建脚本.sql @@ -0,0 +1,13 @@ +DROP DATBASE IF EXISTS mldn ; +CREATE DATBASE mldn CHARACTER SET UTF8 ; +USE mldn ; +CREATE TABLE dept ( + deptno BIGINT AUTO_INCREMENT , + dname VARCHAR(50) , + CONSTRAINT pk_deptno PRIMARY KEY(deptno) +) ; +INSERT INTO dept(dname) VALUES ('开发部') ; +INSERT INTO dept(dname) VALUES ('财务部') ; +INSERT INTO dept(dname) VALUES ('市场部') ; +INSERT INTO dept(dname) VALUES ('后勤部') ; +INSERT INTO dept(dname) VALUES ('公关部') ; \ No newline at end of file diff --git a/microboot-rabbitmq-consumer/src/main/resources/application.yml b/microboot-rabbitmq-consumer/src/main/resources/application.yml new file mode 100644 index 0000000..6f20146 --- /dev/null +++ b/microboot-rabbitmq-consumer/src/main/resources/application.yml @@ -0,0 +1,10 @@ +server: + port: 80 +spring: + messages: + basename: i18n/Messages,i18n/Pages + rabbitmq: + addresses: rabbitmq-server + username: mldnjava + password: hello + virtual-host: / diff --git a/microboot-rabbitmq-consumer/src/main/resources/i18n/Messages.properties b/microboot-rabbitmq-consumer/src/main/resources/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-rabbitmq-consumer/src/main/resources/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-rabbitmq-consumer/src/main/resources/i18n/Pages.properties b/microboot-rabbitmq-consumer/src/main/resources/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-rabbitmq-consumer/src/main/resources/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-rabbitmq-consumer/src/main/resources/logback.xml b/microboot-rabbitmq-consumer/src/main/resources/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-rabbitmq-consumer/src/main/resources/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-rabbitmq-consumer/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml b/microboot-rabbitmq-consumer/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml new file mode 100644 index 0000000..6557a3a --- /dev/null +++ b/microboot-rabbitmq-consumer/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml @@ -0,0 +1,11 @@ + + + + + + INSERT INTO dept(dname) VALUES (#{dname}) ; + + diff --git a/microboot-rabbitmq-consumer/src/main/resources/mybatis/mybatis.cfg.xml b/microboot-rabbitmq-consumer/src/main/resources/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4d128c0 --- /dev/null +++ b/microboot-rabbitmq-consumer/src/main/resources/mybatis/mybatis.cfg.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/microboot-rabbitmq-consumer/src/main/view/static/images/mldn.ico b/microboot-rabbitmq-consumer/src/main/view/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-rabbitmq-consumer/src/main/view/static/images/mldn.ico differ diff --git a/microboot-rabbitmq-consumer/src/main/view/static/info/message_info.html b/microboot-rabbitmq-consumer/src/main/view/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-rabbitmq-consumer/src/main/view/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-rabbitmq-consumer/src/main/view/static/js/main.js b/microboot-rabbitmq-consumer/src/main/view/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-rabbitmq-consumer/src/main/view/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-rabbitmq-consumer/src/main/view/static/message_index.html b/microboot-rabbitmq-consumer/src/main/view/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-rabbitmq-consumer/src/main/view/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-rabbitmq-consumer/src/main/view/templates/upload_page.html b/microboot-rabbitmq-consumer/src/main/view/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-rabbitmq-consumer/src/main/view/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-rabbitmq-consumer/src/main/view/templates/upload_show.html b/microboot-rabbitmq-consumer/src/main/view/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-rabbitmq-consumer/src/main/view/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-rabbitmq-consumer/src/test/java/cn/mldn/microboot/AppTest.java b/microboot-rabbitmq-consumer/src/test/java/cn/mldn/microboot/AppTest.java new file mode 100644 index 0000000..97f5814 --- /dev/null +++ b/microboot-rabbitmq-consumer/src/test/java/cn/mldn/microboot/AppTest.java @@ -0,0 +1,16 @@ +package cn.mldn.microboot; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; +@SpringBootTest(classes = StartSpringBootMain.class) +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +public class AppTest { + @Test + public void testStart() throws Exception { + Thread.sleep(Long.MAX_VALUE); + } +} diff --git a/microboot-rabbitmq-consumer/target/classes/META-INF/MANIFEST.MF b/microboot-rabbitmq-consumer/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d4c16dd --- /dev/null +++ b/microboot-rabbitmq-consumer/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Built-By: foreveriss +Build-Jdk: 1.8.0_121 +Created-By: Maven Integration for Eclipse + diff --git a/microboot-rabbitmq-consumer/target/classes/META-INF/maven/cn.mldn/microboot-rabbitmq-consumer/pom.properties b/microboot-rabbitmq-consumer/target/classes/META-INF/maven/cn.mldn/microboot-rabbitmq-consumer/pom.properties new file mode 100644 index 0000000..991e6f5 --- /dev/null +++ b/microboot-rabbitmq-consumer/target/classes/META-INF/maven/cn.mldn/microboot-rabbitmq-consumer/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Thu Jun 29 23:45:08 CST 2017 +version=0.0.1-SNAPSHOT +groupId=cn.mldn +m2e.projectName=microboot-rabbitmq-consumer +m2e.projectLocation=/Users/foreveriss/workspace/microboot/microboot-rabbitmq-consumer +artifactId=microboot-rabbitmq-consumer diff --git a/microboot-rabbitmq-consumer/target/classes/META-INF/maven/cn.mldn/microboot-rabbitmq-consumer/pom.xml b/microboot-rabbitmq-consumer/target/classes/META-INF/maven/cn.mldn/microboot-rabbitmq-consumer/pom.xml new file mode 100644 index 0000000..9aa2870 --- /dev/null +++ b/microboot-rabbitmq-consumer/target/classes/META-INF/maven/cn.mldn/microboot-rabbitmq-consumer/pom.xml @@ -0,0 +1,61 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-rabbitmq-consumer + microboot-rabbitmq-consumer + http://maven.apache.org + + UTF-8 + + + + ch.qos.logback + logback-core + + + + org.springframework.boot + spring-boot-starter-amqp + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-rabbitmq-consumer/target/classes/application.yml b/microboot-rabbitmq-consumer/target/classes/application.yml new file mode 100644 index 0000000..6f20146 --- /dev/null +++ b/microboot-rabbitmq-consumer/target/classes/application.yml @@ -0,0 +1,10 @@ +server: + port: 80 +spring: + messages: + basename: i18n/Messages,i18n/Pages + rabbitmq: + addresses: rabbitmq-server + username: mldnjava + password: hello + virtual-host: / diff --git a/microboot-rabbitmq-consumer/target/classes/cn/mldn/microboot/StartSpringBootMain.class b/microboot-rabbitmq-consumer/target/classes/cn/mldn/microboot/StartSpringBootMain.class new file mode 100644 index 0000000..e777efe Binary files /dev/null and b/microboot-rabbitmq-consumer/target/classes/cn/mldn/microboot/StartSpringBootMain.class differ diff --git a/microboot-rabbitmq-consumer/target/classes/cn/mldn/microboot/config/ConsumerConfig.class b/microboot-rabbitmq-consumer/target/classes/cn/mldn/microboot/config/ConsumerConfig.class new file mode 100644 index 0000000..fcc5038 Binary files /dev/null and b/microboot-rabbitmq-consumer/target/classes/cn/mldn/microboot/config/ConsumerConfig.class differ diff --git a/microboot-rabbitmq-consumer/target/classes/cn/mldn/microboot/consumer/MessageConsumerService.class b/microboot-rabbitmq-consumer/target/classes/cn/mldn/microboot/consumer/MessageConsumerService.class new file mode 100644 index 0000000..34d1b90 Binary files /dev/null and b/microboot-rabbitmq-consumer/target/classes/cn/mldn/microboot/consumer/MessageConsumerService.class differ diff --git a/microboot-rabbitmq-consumer/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class b/microboot-rabbitmq-consumer/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class new file mode 100644 index 0000000..57c2010 Binary files /dev/null and b/microboot-rabbitmq-consumer/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class differ diff --git a/microboot-rabbitmq-consumer/target/classes/cn/mldn/microboot/vo/Dept.class b/microboot-rabbitmq-consumer/target/classes/cn/mldn/microboot/vo/Dept.class new file mode 100644 index 0000000..46f2356 Binary files /dev/null and b/microboot-rabbitmq-consumer/target/classes/cn/mldn/microboot/vo/Dept.class differ diff --git a/microboot-rabbitmq-consumer/target/classes/cn/mldn/microboot/vo/Member.class b/microboot-rabbitmq-consumer/target/classes/cn/mldn/microboot/vo/Member.class new file mode 100644 index 0000000..59c00d5 Binary files /dev/null and b/microboot-rabbitmq-consumer/target/classes/cn/mldn/microboot/vo/Member.class differ diff --git a/microboot-rabbitmq-consumer/target/classes/i18n/Messages.properties b/microboot-rabbitmq-consumer/target/classes/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-rabbitmq-consumer/target/classes/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-rabbitmq-consumer/target/classes/i18n/Pages.properties b/microboot-rabbitmq-consumer/target/classes/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-rabbitmq-consumer/target/classes/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-rabbitmq-consumer/target/classes/logback.xml b/microboot-rabbitmq-consumer/target/classes/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-rabbitmq-consumer/target/classes/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-rabbitmq-consumer/target/classes/mybatis/mapper/cn/mldn/Dept.xml b/microboot-rabbitmq-consumer/target/classes/mybatis/mapper/cn/mldn/Dept.xml new file mode 100644 index 0000000..6557a3a --- /dev/null +++ b/microboot-rabbitmq-consumer/target/classes/mybatis/mapper/cn/mldn/Dept.xml @@ -0,0 +1,11 @@ + + + + + + INSERT INTO dept(dname) VALUES (#{dname}) ; + + diff --git a/microboot-rabbitmq-consumer/target/classes/mybatis/mybatis.cfg.xml b/microboot-rabbitmq-consumer/target/classes/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4d128c0 --- /dev/null +++ b/microboot-rabbitmq-consumer/target/classes/mybatis/mybatis.cfg.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/microboot-rabbitmq-consumer/target/classes/static/images/mldn.ico b/microboot-rabbitmq-consumer/target/classes/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-rabbitmq-consumer/target/classes/static/images/mldn.ico differ diff --git a/microboot-rabbitmq-consumer/target/classes/static/info/message_info.html b/microboot-rabbitmq-consumer/target/classes/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-rabbitmq-consumer/target/classes/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-rabbitmq-consumer/target/classes/static/js/main.js b/microboot-rabbitmq-consumer/target/classes/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-rabbitmq-consumer/target/classes/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-rabbitmq-consumer/target/classes/static/message_index.html b/microboot-rabbitmq-consumer/target/classes/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-rabbitmq-consumer/target/classes/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-rabbitmq-consumer/target/classes/templates/upload_page.html b/microboot-rabbitmq-consumer/target/classes/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-rabbitmq-consumer/target/classes/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-rabbitmq-consumer/target/classes/templates/upload_show.html b/microboot-rabbitmq-consumer/target/classes/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-rabbitmq-consumer/target/classes/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-rabbitmq-consumer/target/test-classes/cn/mldn/microboot/AppTest.class b/microboot-rabbitmq-consumer/target/test-classes/cn/mldn/microboot/AppTest.class new file mode 100644 index 0000000..95c2ba7 Binary files /dev/null and b/microboot-rabbitmq-consumer/target/test-classes/cn/mldn/microboot/AppTest.class differ diff --git a/microboot-rabbitmq-producer/.classpath b/microboot-rabbitmq-producer/.classpath new file mode 100644 index 0000000..a6f04e8 --- /dev/null +++ b/microboot-rabbitmq-producer/.classpath @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/microboot-rabbitmq-producer/.project b/microboot-rabbitmq-producer/.project new file mode 100644 index 0000000..0e7bd30 --- /dev/null +++ b/microboot-rabbitmq-producer/.project @@ -0,0 +1,35 @@ + + + microboot-rabbitmq-producer + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/microboot-rabbitmq-producer/.settings/org.eclipse.core.resources.prefs b/microboot-rabbitmq-producer/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..a6dcfb7 --- /dev/null +++ b/microboot-rabbitmq-producer/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/main/view=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/microboot-rabbitmq-producer/.settings/org.eclipse.jdt.core.prefs b/microboot-rabbitmq-producer/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..d59e09c --- /dev/null +++ b/microboot-rabbitmq-producer/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/microboot-rabbitmq-producer/.settings/org.eclipse.m2e.core.prefs b/microboot-rabbitmq-producer/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/microboot-rabbitmq-producer/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/microboot-rabbitmq-producer/.settings/org.eclipse.wst.common.project.facet.core.xml b/microboot-rabbitmq-producer/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..e822977 --- /dev/null +++ b/microboot-rabbitmq-producer/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ + + + + diff --git a/microboot-rabbitmq-producer/pom.xml b/microboot-rabbitmq-producer/pom.xml new file mode 100644 index 0000000..766b4ea --- /dev/null +++ b/microboot-rabbitmq-producer/pom.xml @@ -0,0 +1,55 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-rabbitmq-producer + microboot-rabbitmq-producer + http://maven.apache.org + + UTF-8 + + + + org.springframework.boot + spring-boot-starter-amqp + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-rabbitmq-producer/src/main/java/cn/mldn/microboot/StartSpringBootMain.java b/microboot-rabbitmq-producer/src/main/java/cn/mldn/microboot/StartSpringBootMain.java new file mode 100644 index 0000000..beb472b --- /dev/null +++ b/microboot-rabbitmq-producer/src/main/java/cn/mldn/microboot/StartSpringBootMain.java @@ -0,0 +1,13 @@ +package cn.mldn.microboot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +@SpringBootApplication // 启动SpringBoot程序,而后自带子包扫描 +@EnableTransactionManagement +public class StartSpringBootMain { + public static void main(String[] args) throws Exception { + SpringApplication.run(StartSpringBootMain.class, args); + } +} diff --git a/microboot-rabbitmq-producer/src/main/java/cn/mldn/microboot/config/ProducerConfig.java b/microboot-rabbitmq-producer/src/main/java/cn/mldn/microboot/config/ProducerConfig.java new file mode 100644 index 0000000..8302cc2 --- /dev/null +++ b/microboot-rabbitmq-producer/src/main/java/cn/mldn/microboot/config/ProducerConfig.java @@ -0,0 +1,27 @@ +package cn.mldn.microboot.config; + +import org.springframework.amqp.core.Binding; +import org.springframework.amqp.core.BindingBuilder; +import org.springframework.amqp.core.DirectExchange; +import org.springframework.amqp.core.Queue; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class ProducerConfig { + public static final String EXCHANGE = "mldn.microboot.exchange"; // 交换空间名称 + public static final String ROUTINGKEY = "mldn.microboot.routingkey"; // 设置路由key + public static final String QUEUE_NAME = "mldn.microboot.queue"; // 队列名称 + @Bean + public Binding bindingExchangeQueue(DirectExchange exchange,Queue queue) { + return BindingBuilder.bind(queue).to(exchange).with(ROUTINGKEY) ; + } + @Bean + public DirectExchange getDirectExchange() { // 使用直连的模式 + return new DirectExchange(EXCHANGE, true, true); + } + @Bean + public Queue queue() { // 要穿件的队列信息 + return new Queue(QUEUE_NAME); + } +} diff --git a/microboot-rabbitmq-producer/src/main/java/cn/mldn/microboot/producer/IMessageProducerService.java b/microboot-rabbitmq-producer/src/main/java/cn/mldn/microboot/producer/IMessageProducerService.java new file mode 100644 index 0000000..5621950 --- /dev/null +++ b/microboot-rabbitmq-producer/src/main/java/cn/mldn/microboot/producer/IMessageProducerService.java @@ -0,0 +1,5 @@ +package cn.mldn.microboot.producer; + +public interface IMessageProducerService { + public void sendMessage(String msg) ; +} diff --git a/microboot-rabbitmq-producer/src/main/java/cn/mldn/microboot/producer/impl/MessageProducerServiceImpl.java b/microboot-rabbitmq-producer/src/main/java/cn/mldn/microboot/producer/impl/MessageProducerServiceImpl.java new file mode 100644 index 0000000..2a20a2c --- /dev/null +++ b/microboot-rabbitmq-producer/src/main/java/cn/mldn/microboot/producer/impl/MessageProducerServiceImpl.java @@ -0,0 +1,20 @@ +package cn.mldn.microboot.producer.impl; + +import javax.annotation.Resource; + +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.stereotype.Service; + +import cn.mldn.microboot.config.ProducerConfig; +import cn.mldn.microboot.producer.IMessageProducerService; +@Service +public class MessageProducerServiceImpl implements IMessageProducerService { + @Resource + private RabbitTemplate rabbitTemplate; + @Override + public void sendMessage(String msg) { + this.rabbitTemplate.convertAndSend(ProducerConfig.EXCHANGE, + ProducerConfig.ROUTINGKEY, msg); + } + +} diff --git a/microboot-rabbitmq-producer/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java b/microboot-rabbitmq-producer/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java new file mode 100644 index 0000000..5127e93 --- /dev/null +++ b/microboot-rabbitmq-producer/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java @@ -0,0 +1,15 @@ +package cn.mldn.microboot.util.controller; + +import java.util.Locale; + +import javax.annotation.Resource; + +import org.springframework.context.MessageSource; + +public abstract class AbstractBaseController { + @Resource + private MessageSource messageSource; // 自动注入此资源对象 + public String getMessage(String key, String... args) { + return this.messageSource.getMessage(key, args, Locale.getDefault()); + } +} diff --git a/microboot-rabbitmq-producer/src/main/java/cn/mldn/microboot/vo/Dept.java b/microboot-rabbitmq-producer/src/main/java/cn/mldn/microboot/vo/Dept.java new file mode 100644 index 0000000..7971469 --- /dev/null +++ b/microboot-rabbitmq-producer/src/main/java/cn/mldn/microboot/vo/Dept.java @@ -0,0 +1,25 @@ +package cn.mldn.microboot.vo; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class Dept implements Serializable { + private Long deptno ; + private String dname ; + public Long getDeptno() { + return deptno; + } + public void setDeptno(Long deptno) { + this.deptno = deptno; + } + public String getDname() { + return dname; + } + public void setDname(String dname) { + this.dname = dname; + } + @Override + public String toString() { + return "Dept [deptno=" + deptno + ", dname=" + dname + "]"; + } +} diff --git a/microboot-rabbitmq-producer/src/main/java/cn/mldn/microboot/vo/Member.java b/microboot-rabbitmq-producer/src/main/java/cn/mldn/microboot/vo/Member.java new file mode 100644 index 0000000..f6a9cd8 --- /dev/null +++ b/microboot-rabbitmq-producer/src/main/java/cn/mldn/microboot/vo/Member.java @@ -0,0 +1,44 @@ +package cn.mldn.microboot.vo; + +import java.io.Serializable; +import java.util.Date; + +@SuppressWarnings("serial") +public class Member implements Serializable { + private Long mid ; + private String name ; + private Integer age ; + private Date birthday ; + private Double salary ; + public Long getMid() { + return mid; + } + public void setMid(Long mid) { + this.mid = mid; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public Integer getAge() { + return age; + } + public void setAge(Integer age) { + this.age = age; + } + public Date getBirthday() { + return birthday; + } + public void setBirthday(Date birthday) { + this.birthday = birthday; + } + public Double getSalary() { + return salary; + } + public void setSalary(Double salary) { + this.salary = salary; + } +} + diff --git a/microboot-rabbitmq-producer/src/main/java/数据库创建脚本.sql b/microboot-rabbitmq-producer/src/main/java/数据库创建脚本.sql new file mode 100644 index 0000000..edd35b2 --- /dev/null +++ b/microboot-rabbitmq-producer/src/main/java/数据库创建脚本.sql @@ -0,0 +1,13 @@ +DROP DATBASE IF EXISTS mldn ; +CREATE DATBASE mldn CHARACTER SET UTF8 ; +USE mldn ; +CREATE TABLE dept ( + deptno BIGINT AUTO_INCREMENT , + dname VARCHAR(50) , + CONSTRAINT pk_deptno PRIMARY KEY(deptno) +) ; +INSERT INTO dept(dname) VALUES ('开发部') ; +INSERT INTO dept(dname) VALUES ('财务部') ; +INSERT INTO dept(dname) VALUES ('市场部') ; +INSERT INTO dept(dname) VALUES ('后勤部') ; +INSERT INTO dept(dname) VALUES ('公关部') ; \ No newline at end of file diff --git a/microboot-rabbitmq-producer/src/main/resources/application.yml b/microboot-rabbitmq-producer/src/main/resources/application.yml new file mode 100644 index 0000000..6f20146 --- /dev/null +++ b/microboot-rabbitmq-producer/src/main/resources/application.yml @@ -0,0 +1,10 @@ +server: + port: 80 +spring: + messages: + basename: i18n/Messages,i18n/Pages + rabbitmq: + addresses: rabbitmq-server + username: mldnjava + password: hello + virtual-host: / diff --git a/microboot-rabbitmq-producer/src/main/resources/i18n/Messages.properties b/microboot-rabbitmq-producer/src/main/resources/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-rabbitmq-producer/src/main/resources/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-rabbitmq-producer/src/main/resources/i18n/Pages.properties b/microboot-rabbitmq-producer/src/main/resources/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-rabbitmq-producer/src/main/resources/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-rabbitmq-producer/src/main/resources/logback.xml b/microboot-rabbitmq-producer/src/main/resources/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-rabbitmq-producer/src/main/resources/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-rabbitmq-producer/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml b/microboot-rabbitmq-producer/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml new file mode 100644 index 0000000..6557a3a --- /dev/null +++ b/microboot-rabbitmq-producer/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml @@ -0,0 +1,11 @@ + + + + + + INSERT INTO dept(dname) VALUES (#{dname}) ; + + diff --git a/microboot-rabbitmq-producer/src/main/resources/mybatis/mybatis.cfg.xml b/microboot-rabbitmq-producer/src/main/resources/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4d128c0 --- /dev/null +++ b/microboot-rabbitmq-producer/src/main/resources/mybatis/mybatis.cfg.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/microboot-rabbitmq-producer/src/main/view/static/images/mldn.ico b/microboot-rabbitmq-producer/src/main/view/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-rabbitmq-producer/src/main/view/static/images/mldn.ico differ diff --git a/microboot-rabbitmq-producer/src/main/view/static/info/message_info.html b/microboot-rabbitmq-producer/src/main/view/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-rabbitmq-producer/src/main/view/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-rabbitmq-producer/src/main/view/static/js/main.js b/microboot-rabbitmq-producer/src/main/view/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-rabbitmq-producer/src/main/view/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-rabbitmq-producer/src/main/view/static/message_index.html b/microboot-rabbitmq-producer/src/main/view/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-rabbitmq-producer/src/main/view/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-rabbitmq-producer/src/main/view/templates/upload_page.html b/microboot-rabbitmq-producer/src/main/view/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-rabbitmq-producer/src/main/view/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-rabbitmq-producer/src/main/view/templates/upload_show.html b/microboot-rabbitmq-producer/src/main/view/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-rabbitmq-producer/src/main/view/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-rabbitmq-producer/src/test/java/cn/mldn/microboot/AppTest.java b/microboot-rabbitmq-producer/src/test/java/cn/mldn/microboot/AppTest.java new file mode 100644 index 0000000..a094258 --- /dev/null +++ b/microboot-rabbitmq-producer/src/test/java/cn/mldn/microboot/AppTest.java @@ -0,0 +1,38 @@ +package cn.mldn.microboot; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/microboot-rabbitmq-producer/src/test/java/cn/mldn/microboot/test/TestRabbitMQ.java b/microboot-rabbitmq-producer/src/test/java/cn/mldn/microboot/test/TestRabbitMQ.java new file mode 100644 index 0000000..42df047 --- /dev/null +++ b/microboot-rabbitmq-producer/src/test/java/cn/mldn/microboot/test/TestRabbitMQ.java @@ -0,0 +1,26 @@ +package cn.mldn.microboot.test; + +import javax.annotation.Resource; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +import cn.mldn.microboot.StartSpringBootMain; +import cn.mldn.microboot.producer.IMessageProducerService; + +@SpringBootTest(classes = StartSpringBootMain.class) +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +public class TestRabbitMQ { + @Resource + private IMessageProducerService messageProducer; + @Test + public void testSend() throws Exception { + for (int x = 0; x < 100; x++) { + this.messageProducer.sendMessage("mldn - " + x); + } + } +} diff --git a/microboot-rabbitmq-producer/target/classes/META-INF/MANIFEST.MF b/microboot-rabbitmq-producer/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d4c16dd --- /dev/null +++ b/microboot-rabbitmq-producer/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Built-By: foreveriss +Build-Jdk: 1.8.0_121 +Created-By: Maven Integration for Eclipse + diff --git a/microboot-rabbitmq-producer/target/classes/META-INF/maven/cn.mldn/microboot-rabbitmq-producer/pom.properties b/microboot-rabbitmq-producer/target/classes/META-INF/maven/cn.mldn/microboot-rabbitmq-producer/pom.properties new file mode 100644 index 0000000..4e936ce --- /dev/null +++ b/microboot-rabbitmq-producer/target/classes/META-INF/maven/cn.mldn/microboot-rabbitmq-producer/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Thu Jun 29 23:45:09 CST 2017 +version=0.0.1-SNAPSHOT +groupId=cn.mldn +m2e.projectName=microboot-rabbitmq-producer +m2e.projectLocation=/Users/foreveriss/workspace/microboot/microboot-rabbitmq-producer +artifactId=microboot-rabbitmq-producer diff --git a/microboot-rabbitmq-producer/target/classes/META-INF/maven/cn.mldn/microboot-rabbitmq-producer/pom.xml b/microboot-rabbitmq-producer/target/classes/META-INF/maven/cn.mldn/microboot-rabbitmq-producer/pom.xml new file mode 100644 index 0000000..766b4ea --- /dev/null +++ b/microboot-rabbitmq-producer/target/classes/META-INF/maven/cn.mldn/microboot-rabbitmq-producer/pom.xml @@ -0,0 +1,55 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-rabbitmq-producer + microboot-rabbitmq-producer + http://maven.apache.org + + UTF-8 + + + + org.springframework.boot + spring-boot-starter-amqp + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-rabbitmq-producer/target/classes/application.yml b/microboot-rabbitmq-producer/target/classes/application.yml new file mode 100644 index 0000000..6f20146 --- /dev/null +++ b/microboot-rabbitmq-producer/target/classes/application.yml @@ -0,0 +1,10 @@ +server: + port: 80 +spring: + messages: + basename: i18n/Messages,i18n/Pages + rabbitmq: + addresses: rabbitmq-server + username: mldnjava + password: hello + virtual-host: / diff --git a/microboot-rabbitmq-producer/target/classes/cn/mldn/microboot/StartSpringBootMain.class b/microboot-rabbitmq-producer/target/classes/cn/mldn/microboot/StartSpringBootMain.class new file mode 100644 index 0000000..e777efe Binary files /dev/null and b/microboot-rabbitmq-producer/target/classes/cn/mldn/microboot/StartSpringBootMain.class differ diff --git a/microboot-rabbitmq-producer/target/classes/cn/mldn/microboot/config/ProducerConfig.class b/microboot-rabbitmq-producer/target/classes/cn/mldn/microboot/config/ProducerConfig.class new file mode 100644 index 0000000..1ca486e Binary files /dev/null and b/microboot-rabbitmq-producer/target/classes/cn/mldn/microboot/config/ProducerConfig.class differ diff --git a/microboot-rabbitmq-producer/target/classes/cn/mldn/microboot/producer/IMessageProducerService.class b/microboot-rabbitmq-producer/target/classes/cn/mldn/microboot/producer/IMessageProducerService.class new file mode 100644 index 0000000..02782fc Binary files /dev/null and b/microboot-rabbitmq-producer/target/classes/cn/mldn/microboot/producer/IMessageProducerService.class differ diff --git a/microboot-rabbitmq-producer/target/classes/cn/mldn/microboot/producer/impl/MessageProducerServiceImpl.class b/microboot-rabbitmq-producer/target/classes/cn/mldn/microboot/producer/impl/MessageProducerServiceImpl.class new file mode 100644 index 0000000..9619a79 Binary files /dev/null and b/microboot-rabbitmq-producer/target/classes/cn/mldn/microboot/producer/impl/MessageProducerServiceImpl.class differ diff --git a/microboot-rabbitmq-producer/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class b/microboot-rabbitmq-producer/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class new file mode 100644 index 0000000..57c2010 Binary files /dev/null and b/microboot-rabbitmq-producer/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class differ diff --git a/microboot-rabbitmq-producer/target/classes/cn/mldn/microboot/vo/Dept.class b/microboot-rabbitmq-producer/target/classes/cn/mldn/microboot/vo/Dept.class new file mode 100644 index 0000000..46f2356 Binary files /dev/null and b/microboot-rabbitmq-producer/target/classes/cn/mldn/microboot/vo/Dept.class differ diff --git a/microboot-rabbitmq-producer/target/classes/cn/mldn/microboot/vo/Member.class b/microboot-rabbitmq-producer/target/classes/cn/mldn/microboot/vo/Member.class new file mode 100644 index 0000000..59c00d5 Binary files /dev/null and b/microboot-rabbitmq-producer/target/classes/cn/mldn/microboot/vo/Member.class differ diff --git a/microboot-rabbitmq-producer/target/classes/i18n/Messages.properties b/microboot-rabbitmq-producer/target/classes/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-rabbitmq-producer/target/classes/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-rabbitmq-producer/target/classes/i18n/Pages.properties b/microboot-rabbitmq-producer/target/classes/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-rabbitmq-producer/target/classes/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-rabbitmq-producer/target/classes/logback.xml b/microboot-rabbitmq-producer/target/classes/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-rabbitmq-producer/target/classes/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-rabbitmq-producer/target/classes/mybatis/mapper/cn/mldn/Dept.xml b/microboot-rabbitmq-producer/target/classes/mybatis/mapper/cn/mldn/Dept.xml new file mode 100644 index 0000000..6557a3a --- /dev/null +++ b/microboot-rabbitmq-producer/target/classes/mybatis/mapper/cn/mldn/Dept.xml @@ -0,0 +1,11 @@ + + + + + + INSERT INTO dept(dname) VALUES (#{dname}) ; + + diff --git a/microboot-rabbitmq-producer/target/classes/mybatis/mybatis.cfg.xml b/microboot-rabbitmq-producer/target/classes/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4d128c0 --- /dev/null +++ b/microboot-rabbitmq-producer/target/classes/mybatis/mybatis.cfg.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/microboot-rabbitmq-producer/target/classes/static/images/mldn.ico b/microboot-rabbitmq-producer/target/classes/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-rabbitmq-producer/target/classes/static/images/mldn.ico differ diff --git a/microboot-rabbitmq-producer/target/classes/static/info/message_info.html b/microboot-rabbitmq-producer/target/classes/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-rabbitmq-producer/target/classes/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-rabbitmq-producer/target/classes/static/js/main.js b/microboot-rabbitmq-producer/target/classes/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-rabbitmq-producer/target/classes/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-rabbitmq-producer/target/classes/static/message_index.html b/microboot-rabbitmq-producer/target/classes/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-rabbitmq-producer/target/classes/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-rabbitmq-producer/target/classes/templates/upload_page.html b/microboot-rabbitmq-producer/target/classes/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-rabbitmq-producer/target/classes/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-rabbitmq-producer/target/classes/templates/upload_show.html b/microboot-rabbitmq-producer/target/classes/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-rabbitmq-producer/target/classes/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-rabbitmq-producer/target/test-classes/cn/mldn/microboot/AppTest.class b/microboot-rabbitmq-producer/target/test-classes/cn/mldn/microboot/AppTest.class new file mode 100644 index 0000000..d317ee0 Binary files /dev/null and b/microboot-rabbitmq-producer/target/test-classes/cn/mldn/microboot/AppTest.class differ diff --git a/microboot-rabbitmq-producer/target/test-classes/cn/mldn/microboot/test/TestRabbitMQ.class b/microboot-rabbitmq-producer/target/test-classes/cn/mldn/microboot/test/TestRabbitMQ.class new file mode 100644 index 0000000..2e2d354 Binary files /dev/null and b/microboot-rabbitmq-producer/target/test-classes/cn/mldn/microboot/test/TestRabbitMQ.class differ diff --git a/microboot-redis/.classpath b/microboot-redis/.classpath new file mode 100644 index 0000000..a6f04e8 --- /dev/null +++ b/microboot-redis/.classpath @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/microboot-redis/.project b/microboot-redis/.project new file mode 100644 index 0000000..cf60132 --- /dev/null +++ b/microboot-redis/.project @@ -0,0 +1,35 @@ + + + microboot-redis + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/microboot-redis/.settings/org.eclipse.core.resources.prefs b/microboot-redis/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..a6dcfb7 --- /dev/null +++ b/microboot-redis/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/main/view=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/microboot-redis/.settings/org.eclipse.jdt.core.prefs b/microboot-redis/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..d59e09c --- /dev/null +++ b/microboot-redis/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/microboot-redis/.settings/org.eclipse.m2e.core.prefs b/microboot-redis/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/microboot-redis/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/microboot-redis/.settings/org.eclipse.wst.common.project.facet.core.xml b/microboot-redis/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..e822977 --- /dev/null +++ b/microboot-redis/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ + + + + diff --git a/microboot-redis/pom.xml b/microboot-redis/pom.xml new file mode 100644 index 0000000..777b9b0 --- /dev/null +++ b/microboot-redis/pom.xml @@ -0,0 +1,73 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-redis + microboot-redis + http://maven.apache.org + + UTF-8 + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + org.springframework.boot + spring-boot-starter-mail + + + + ch.qos.logback + logback-core + + + + org.springframework.kafka + spring-kafka + + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-redis/src/main/java/cn/mldn/microboot/StartSpringBootMain.java b/microboot-redis/src/main/java/cn/mldn/microboot/StartSpringBootMain.java new file mode 100644 index 0000000..8a58ff5 --- /dev/null +++ b/microboot-redis/src/main/java/cn/mldn/microboot/StartSpringBootMain.java @@ -0,0 +1,15 @@ +package cn.mldn.microboot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication // 启动SpringBoot程序,而后自带子包扫描 +public class StartSpringBootMain { + static { + System.setProperty("java.security.auth.login.config", + "d:/kafka_client_jaas.conf"); // 表示系统环境属性 + } + public static void main(String[] args) throws Exception { + SpringApplication.run(StartSpringBootMain.class, args); + } +} diff --git a/microboot-redis/src/main/java/cn/mldn/microboot/config/RedisConfig.java b/microboot-redis/src/main/java/cn/mldn/microboot/config/RedisConfig.java new file mode 100644 index 0000000..bee78be --- /dev/null +++ b/microboot-redis/src/main/java/cn/mldn/microboot/config/RedisConfig.java @@ -0,0 +1,22 @@ +package cn.mldn.microboot.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.serializer.StringRedisSerializer; + +import cn.mldn.microboot.util.redis.RedisObjectSerializer; + +@Configuration +public class RedisConfig { + @Bean + public RedisTemplate getRedisTemplate( + RedisConnectionFactory factory) { + RedisTemplate redisTemplate = new RedisTemplate(); + redisTemplate.setConnectionFactory(factory); + redisTemplate.setKeySerializer(new StringRedisSerializer()); // key的序列化类型 + redisTemplate.setValueSerializer(new RedisObjectSerializer()); // value的序列化类型 + return redisTemplate; + } +} diff --git a/microboot-redis/src/main/java/cn/mldn/microboot/config/RedisTwoConfig.java b/microboot-redis/src/main/java/cn/mldn/microboot/config/RedisTwoConfig.java new file mode 100644 index 0000000..0959481 --- /dev/null +++ b/microboot-redis/src/main/java/cn/mldn/microboot/config/RedisTwoConfig.java @@ -0,0 +1,53 @@ +package cn.mldn.microboot.config; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.serializer.StringRedisSerializer; + +import cn.mldn.microboot.util.redis.RedisObjectSerializer; +import redis.clients.jedis.JedisPoolConfig; + +@Configuration +public class RedisTwoConfig { + public RedisConnectionFactory getRedisConnectionFactory(String hostName, + String password, int port, int maxActive, int maxIdle, int minIdle, + long maxWait, int database) { // 是负责建立Factory的连接工厂类 + JedisConnectionFactory jedisFactory = new JedisConnectionFactory(); + jedisFactory.setHostName(hostName); + jedisFactory.setPort(port); + jedisFactory.setPassword(password); + jedisFactory.setDatabase(database); + JedisPoolConfig poolConfig = new JedisPoolConfig(); // 进行连接池配置 + poolConfig.setMaxTotal(maxActive); + poolConfig.setMaxIdle(maxIdle); + poolConfig.setMinIdle(minIdle); + poolConfig.setMaxWaitMillis(maxWait); + jedisFactory.setPoolConfig(poolConfig); + jedisFactory.afterPropertiesSet(); // 初始化连接池配置 + return jedisFactory; + } + @Bean("redisTwo") + public RedisTemplate getRedisTemplate( + @Value("${spring.redis-two.host}") String hostName, + @Value("${spring.redis-two.password}") String password, + @Value("${spring.redis-two.port}") int port, + @Value("${spring.redis-two.database}") int database, + @Value("${spring.redis-two.pool.max-active}") int maxActive, + @Value("${spring.redis-two.pool.max-idle}") int maxIdle, + @Value("${spring.redis-two.pool.min-idle}") int minIdle, + @Value("${spring.redis-two.pool.max-wait}") long maxWait) { + + RedisConnectionFactory factory = this.getRedisConnectionFactory( + hostName, password, port, maxActive, maxIdle, minIdle, maxWait, + database); // 建立Redis的连接 + RedisTemplate redisTemplate = new RedisTemplate(); + redisTemplate.setConnectionFactory(factory); + redisTemplate.setKeySerializer(new StringRedisSerializer()); // key的序列化类型 + redisTemplate.setValueSerializer(new RedisObjectSerializer()); // value的序列化类型 + return redisTemplate; + } +} diff --git a/microboot-redis/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java b/microboot-redis/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java new file mode 100644 index 0000000..5127e93 --- /dev/null +++ b/microboot-redis/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java @@ -0,0 +1,15 @@ +package cn.mldn.microboot.util.controller; + +import java.util.Locale; + +import javax.annotation.Resource; + +import org.springframework.context.MessageSource; + +public abstract class AbstractBaseController { + @Resource + private MessageSource messageSource; // 自动注入此资源对象 + public String getMessage(String key, String... args) { + return this.messageSource.getMessage(key, args, Locale.getDefault()); + } +} diff --git a/microboot-redis/src/main/java/cn/mldn/microboot/util/redis/RedisObjectSerializer.java b/microboot-redis/src/main/java/cn/mldn/microboot/util/redis/RedisObjectSerializer.java new file mode 100644 index 0000000..1aae55f --- /dev/null +++ b/microboot-redis/src/main/java/cn/mldn/microboot/util/redis/RedisObjectSerializer.java @@ -0,0 +1,29 @@ +package cn.mldn.microboot.util.redis; + +import org.springframework.core.convert.converter.Converter; +import org.springframework.core.serializer.support.DeserializingConverter; +import org.springframework.core.serializer.support.SerializingConverter; +import org.springframework.data.redis.serializer.RedisSerializer; +import org.springframework.data.redis.serializer.SerializationException; +// 此时定义的序列化操作表示可以序列化所有类的对象,当然,这个对象所在的类一定要实现序列化接口 +public class RedisObjectSerializer implements RedisSerializer { + // 为了方便进行对象与字节数组的转换,所以应该首先准备出两个转换器 + private Converter serializingConverter = new SerializingConverter(); + private Converter deserializingConverter = new DeserializingConverter(); + private static final byte[] EMPTY_BYTE_ARRAY = new byte[0]; // 做一个空数组,不是null + @Override + public byte[] serialize(Object obj) throws SerializationException { + if (obj == null) { // 这个时候没有要序列化的对象出现,所以返回的字节数组应该就是一个空数组 + return EMPTY_BYTE_ARRAY ; + } + return this.serializingConverter.convert(obj); // 将对象变为字节数组 + } + @Override + public Object deserialize(byte[] data) throws SerializationException { + if (data == null || data.length == 0) { // 此时没有对象的内容信息 + return null ; + } + return this.deserializingConverter.convert(data); + } + +} diff --git a/microboot-redis/src/main/java/cn/mldn/microboot/vo/Dept.java b/microboot-redis/src/main/java/cn/mldn/microboot/vo/Dept.java new file mode 100644 index 0000000..7971469 --- /dev/null +++ b/microboot-redis/src/main/java/cn/mldn/microboot/vo/Dept.java @@ -0,0 +1,25 @@ +package cn.mldn.microboot.vo; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class Dept implements Serializable { + private Long deptno ; + private String dname ; + public Long getDeptno() { + return deptno; + } + public void setDeptno(Long deptno) { + this.deptno = deptno; + } + public String getDname() { + return dname; + } + public void setDname(String dname) { + this.dname = dname; + } + @Override + public String toString() { + return "Dept [deptno=" + deptno + ", dname=" + dname + "]"; + } +} diff --git a/microboot-redis/src/main/java/cn/mldn/microboot/vo/Member.java b/microboot-redis/src/main/java/cn/mldn/microboot/vo/Member.java new file mode 100644 index 0000000..ad2c270 --- /dev/null +++ b/microboot-redis/src/main/java/cn/mldn/microboot/vo/Member.java @@ -0,0 +1,25 @@ +package cn.mldn.microboot.vo; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class Member implements Serializable { + private String mid; + private Integer age; + public String getMid() { + return mid; + } + public void setMid(String mid) { + this.mid = mid; + } + public Integer getAge() { + return age; + } + public void setAge(Integer age) { + this.age = age; + } + @Override + public String toString() { + return "Member [mid=" + mid + ", age=" + age + "]"; + } +} diff --git a/microboot-redis/src/main/java/数据库创建脚本.sql b/microboot-redis/src/main/java/数据库创建脚本.sql new file mode 100644 index 0000000..edd35b2 --- /dev/null +++ b/microboot-redis/src/main/java/数据库创建脚本.sql @@ -0,0 +1,13 @@ +DROP DATBASE IF EXISTS mldn ; +CREATE DATBASE mldn CHARACTER SET UTF8 ; +USE mldn ; +CREATE TABLE dept ( + deptno BIGINT AUTO_INCREMENT , + dname VARCHAR(50) , + CONSTRAINT pk_deptno PRIMARY KEY(deptno) +) ; +INSERT INTO dept(dname) VALUES ('开发部') ; +INSERT INTO dept(dname) VALUES ('财务部') ; +INSERT INTO dept(dname) VALUES ('市场部') ; +INSERT INTO dept(dname) VALUES ('后勤部') ; +INSERT INTO dept(dname) VALUES ('公关部') ; \ No newline at end of file diff --git a/microboot-redis/src/main/resources/application.yml b/microboot-redis/src/main/resources/application.yml new file mode 100644 index 0000000..6fbc1f2 --- /dev/null +++ b/microboot-redis/src/main/resources/application.yml @@ -0,0 +1,23 @@ +spring: + redis: + host: 192.168.68.166 + port: 6379 + password: mldnjava + timeout: 1000 + database: 0 + pool: + max-active: 10 + max-idle: 8 + min-idle: 2 + max-wait: 100 + redis-two: + host: 192.168.68.166 + port: 6380 + password: mldnjava + timeout: 1000 + database: 0 + pool: + max-active: 10 + max-idle: 8 + min-idle: 2 + max-wait: 100 \ No newline at end of file diff --git a/microboot-redis/src/main/resources/i18n/Messages.properties b/microboot-redis/src/main/resources/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-redis/src/main/resources/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-redis/src/main/resources/i18n/Pages.properties b/microboot-redis/src/main/resources/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-redis/src/main/resources/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-redis/src/main/resources/logback.xml b/microboot-redis/src/main/resources/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-redis/src/main/resources/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-redis/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml b/microboot-redis/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml new file mode 100644 index 0000000..6557a3a --- /dev/null +++ b/microboot-redis/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml @@ -0,0 +1,11 @@ + + + + + + INSERT INTO dept(dname) VALUES (#{dname}) ; + + diff --git a/microboot-redis/src/main/resources/mybatis/mybatis.cfg.xml b/microboot-redis/src/main/resources/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4d128c0 --- /dev/null +++ b/microboot-redis/src/main/resources/mybatis/mybatis.cfg.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/microboot-redis/src/main/view/static/images/mldn.ico b/microboot-redis/src/main/view/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-redis/src/main/view/static/images/mldn.ico differ diff --git a/microboot-redis/src/main/view/static/info/message_info.html b/microboot-redis/src/main/view/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-redis/src/main/view/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-redis/src/main/view/static/js/main.js b/microboot-redis/src/main/view/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-redis/src/main/view/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-redis/src/main/view/static/message_index.html b/microboot-redis/src/main/view/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-redis/src/main/view/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-redis/src/main/view/templates/upload_page.html b/microboot-redis/src/main/view/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-redis/src/main/view/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-redis/src/main/view/templates/upload_show.html b/microboot-redis/src/main/view/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-redis/src/main/view/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-redis/src/test/java/cn/mldn/microboot/TestRedis.java b/microboot-redis/src/test/java/cn/mldn/microboot/TestRedis.java new file mode 100644 index 0000000..df04d82 --- /dev/null +++ b/microboot-redis/src/test/java/cn/mldn/microboot/TestRedis.java @@ -0,0 +1,29 @@ +package cn.mldn.microboot; +import javax.annotation.Resource; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +import cn.mldn.microboot.vo.Member; +@SpringBootTest(classes = StartSpringBootMain.class) +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +public class TestRedis { + @Resource + private RedisTemplate redisTemplate; + @Test + public void testGet() { + System.out.println(this.redisTemplate.opsForValue().get("mldn")); + } + @Test + public void testSet() { + Member vo = new Member() ; + vo.setMid("mldnjava"); + vo.setAge(19); + this.redisTemplate.opsForValue().set("mldn", vo);; + } +} diff --git a/microboot-redis/src/test/java/cn/mldn/microboot/TestRedisTwo.java b/microboot-redis/src/test/java/cn/mldn/microboot/TestRedisTwo.java new file mode 100644 index 0000000..89bd6b8 --- /dev/null +++ b/microboot-redis/src/test/java/cn/mldn/microboot/TestRedisTwo.java @@ -0,0 +1,29 @@ +package cn.mldn.microboot; +import javax.annotation.Resource; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +import cn.mldn.microboot.vo.Member; +@SpringBootTest(classes = StartSpringBootMain.class) +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +public class TestRedisTwo { + @Resource(name="redisTwo") + private RedisTemplate redisTemplate; + @Test + public void testGet() { + System.out.println(this.redisTemplate.opsForValue().get("mldn")); + } + @Test + public void testSet() { + Member vo = new Member() ; + vo.setMid("mldnjava"); + vo.setAge(19); + this.redisTemplate.opsForValue().set("mldn", vo);; + } +} diff --git a/microboot-redis/target/classes/META-INF/MANIFEST.MF b/microboot-redis/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d4c16dd --- /dev/null +++ b/microboot-redis/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Built-By: foreveriss +Build-Jdk: 1.8.0_121 +Created-By: Maven Integration for Eclipse + diff --git a/microboot-redis/target/classes/META-INF/maven/cn.mldn/microboot-redis/pom.properties b/microboot-redis/target/classes/META-INF/maven/cn.mldn/microboot-redis/pom.properties new file mode 100644 index 0000000..a3945f9 --- /dev/null +++ b/microboot-redis/target/classes/META-INF/maven/cn.mldn/microboot-redis/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Thu Jun 29 23:45:10 CST 2017 +version=0.0.1-SNAPSHOT +groupId=cn.mldn +m2e.projectName=microboot-redis +m2e.projectLocation=/Users/foreveriss/workspace/microboot/microboot-redis +artifactId=microboot-redis diff --git a/microboot-redis/target/classes/META-INF/maven/cn.mldn/microboot-redis/pom.xml b/microboot-redis/target/classes/META-INF/maven/cn.mldn/microboot-redis/pom.xml new file mode 100644 index 0000000..777b9b0 --- /dev/null +++ b/microboot-redis/target/classes/META-INF/maven/cn.mldn/microboot-redis/pom.xml @@ -0,0 +1,73 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-redis + microboot-redis + http://maven.apache.org + + UTF-8 + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + org.springframework.boot + spring-boot-starter-mail + + + + ch.qos.logback + logback-core + + + + org.springframework.kafka + spring-kafka + + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-redis/target/classes/application.yml b/microboot-redis/target/classes/application.yml new file mode 100644 index 0000000..6fbc1f2 --- /dev/null +++ b/microboot-redis/target/classes/application.yml @@ -0,0 +1,23 @@ +spring: + redis: + host: 192.168.68.166 + port: 6379 + password: mldnjava + timeout: 1000 + database: 0 + pool: + max-active: 10 + max-idle: 8 + min-idle: 2 + max-wait: 100 + redis-two: + host: 192.168.68.166 + port: 6380 + password: mldnjava + timeout: 1000 + database: 0 + pool: + max-active: 10 + max-idle: 8 + min-idle: 2 + max-wait: 100 \ No newline at end of file diff --git a/microboot-redis/target/classes/cn/mldn/microboot/StartSpringBootMain.class b/microboot-redis/target/classes/cn/mldn/microboot/StartSpringBootMain.class new file mode 100644 index 0000000..18bb195 Binary files /dev/null and b/microboot-redis/target/classes/cn/mldn/microboot/StartSpringBootMain.class differ diff --git a/microboot-redis/target/classes/cn/mldn/microboot/config/RedisConfig.class b/microboot-redis/target/classes/cn/mldn/microboot/config/RedisConfig.class new file mode 100644 index 0000000..ffb81f7 Binary files /dev/null and b/microboot-redis/target/classes/cn/mldn/microboot/config/RedisConfig.class differ diff --git a/microboot-redis/target/classes/cn/mldn/microboot/config/RedisTwoConfig.class b/microboot-redis/target/classes/cn/mldn/microboot/config/RedisTwoConfig.class new file mode 100644 index 0000000..e6f78f4 Binary files /dev/null and b/microboot-redis/target/classes/cn/mldn/microboot/config/RedisTwoConfig.class differ diff --git a/microboot-redis/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class b/microboot-redis/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class new file mode 100644 index 0000000..57c2010 Binary files /dev/null and b/microboot-redis/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class differ diff --git a/microboot-redis/target/classes/cn/mldn/microboot/util/redis/RedisObjectSerializer.class b/microboot-redis/target/classes/cn/mldn/microboot/util/redis/RedisObjectSerializer.class new file mode 100644 index 0000000..9471991 Binary files /dev/null and b/microboot-redis/target/classes/cn/mldn/microboot/util/redis/RedisObjectSerializer.class differ diff --git a/microboot-redis/target/classes/cn/mldn/microboot/vo/Dept.class b/microboot-redis/target/classes/cn/mldn/microboot/vo/Dept.class new file mode 100644 index 0000000..46f2356 Binary files /dev/null and b/microboot-redis/target/classes/cn/mldn/microboot/vo/Dept.class differ diff --git a/microboot-redis/target/classes/cn/mldn/microboot/vo/Member.class b/microboot-redis/target/classes/cn/mldn/microboot/vo/Member.class new file mode 100644 index 0000000..3f4ddac Binary files /dev/null and b/microboot-redis/target/classes/cn/mldn/microboot/vo/Member.class differ diff --git a/microboot-redis/target/classes/i18n/Messages.properties b/microboot-redis/target/classes/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-redis/target/classes/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-redis/target/classes/i18n/Pages.properties b/microboot-redis/target/classes/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-redis/target/classes/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-redis/target/classes/logback.xml b/microboot-redis/target/classes/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-redis/target/classes/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-redis/target/classes/mybatis/mapper/cn/mldn/Dept.xml b/microboot-redis/target/classes/mybatis/mapper/cn/mldn/Dept.xml new file mode 100644 index 0000000..6557a3a --- /dev/null +++ b/microboot-redis/target/classes/mybatis/mapper/cn/mldn/Dept.xml @@ -0,0 +1,11 @@ + + + + + + INSERT INTO dept(dname) VALUES (#{dname}) ; + + diff --git a/microboot-redis/target/classes/mybatis/mybatis.cfg.xml b/microboot-redis/target/classes/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4d128c0 --- /dev/null +++ b/microboot-redis/target/classes/mybatis/mybatis.cfg.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/microboot-redis/target/classes/static/images/mldn.ico b/microboot-redis/target/classes/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-redis/target/classes/static/images/mldn.ico differ diff --git a/microboot-redis/target/classes/static/info/message_info.html b/microboot-redis/target/classes/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-redis/target/classes/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-redis/target/classes/static/js/main.js b/microboot-redis/target/classes/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-redis/target/classes/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-redis/target/classes/static/message_index.html b/microboot-redis/target/classes/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-redis/target/classes/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-redis/target/classes/templates/upload_page.html b/microboot-redis/target/classes/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-redis/target/classes/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-redis/target/classes/templates/upload_show.html b/microboot-redis/target/classes/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-redis/target/classes/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-redis/target/test-classes/cn/mldn/microboot/TestRedis.class b/microboot-redis/target/test-classes/cn/mldn/microboot/TestRedis.class new file mode 100644 index 0000000..afce386 Binary files /dev/null and b/microboot-redis/target/test-classes/cn/mldn/microboot/TestRedis.class differ diff --git a/microboot-redis/target/test-classes/cn/mldn/microboot/TestRedisTwo.class b/microboot-redis/target/test-classes/cn/mldn/microboot/TestRedisTwo.class new file mode 100644 index 0000000..940cbab Binary files /dev/null and b/microboot-redis/target/test-classes/cn/mldn/microboot/TestRedisTwo.class differ diff --git a/microboot-restful-api/.classpath b/microboot-restful-api/.classpath new file mode 100644 index 0000000..a6f04e8 --- /dev/null +++ b/microboot-restful-api/.classpath @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/microboot-restful-api/.project b/microboot-restful-api/.project new file mode 100644 index 0000000..db9995a --- /dev/null +++ b/microboot-restful-api/.project @@ -0,0 +1,35 @@ + + + microboot-restful-api + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/microboot-restful-api/.settings/org.eclipse.core.resources.prefs b/microboot-restful-api/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..a6dcfb7 --- /dev/null +++ b/microboot-restful-api/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/main/view=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/microboot-restful-api/.settings/org.eclipse.jdt.core.prefs b/microboot-restful-api/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..d59e09c --- /dev/null +++ b/microboot-restful-api/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/microboot-restful-api/.settings/org.eclipse.m2e.core.prefs b/microboot-restful-api/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/microboot-restful-api/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/microboot-restful-api/.settings/org.eclipse.wst.common.project.facet.core.xml b/microboot-restful-api/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..e822977 --- /dev/null +++ b/microboot-restful-api/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ + + + + diff --git a/microboot-restful-api/pom.xml b/microboot-restful-api/pom.xml new file mode 100644 index 0000000..49f6dd6 --- /dev/null +++ b/microboot-restful-api/pom.xml @@ -0,0 +1,73 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-restful-api + microboot-restful-api + http://maven.apache.org + + UTF-8 + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + org.springframework.boot + spring-boot-starter-mail + + + + ch.qos.logback + logback-core + + + + org.springframework.kafka + spring-kafka + + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-restful-api/src/main/java/cn/mldn/microboot/StartSpringBootMain.java b/microboot-restful-api/src/main/java/cn/mldn/microboot/StartSpringBootMain.java new file mode 100644 index 0000000..8a58ff5 --- /dev/null +++ b/microboot-restful-api/src/main/java/cn/mldn/microboot/StartSpringBootMain.java @@ -0,0 +1,15 @@ +package cn.mldn.microboot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication // 启动SpringBoot程序,而后自带子包扫描 +public class StartSpringBootMain { + static { + System.setProperty("java.security.auth.login.config", + "d:/kafka_client_jaas.conf"); // 表示系统环境属性 + } + public static void main(String[] args) throws Exception { + SpringApplication.run(StartSpringBootMain.class, args); + } +} diff --git a/microboot-restful-api/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java b/microboot-restful-api/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java new file mode 100644 index 0000000..5127e93 --- /dev/null +++ b/microboot-restful-api/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java @@ -0,0 +1,15 @@ +package cn.mldn.microboot.util.controller; + +import java.util.Locale; + +import javax.annotation.Resource; + +import org.springframework.context.MessageSource; + +public abstract class AbstractBaseController { + @Resource + private MessageSource messageSource; // 自动注入此资源对象 + public String getMessage(String key, String... args) { + return this.messageSource.getMessage(key, args, Locale.getDefault()); + } +} diff --git a/microboot-restful-api/src/main/java/cn/mldn/microboot/vo/Member.java b/microboot-restful-api/src/main/java/cn/mldn/microboot/vo/Member.java new file mode 100644 index 0000000..9de7ecb --- /dev/null +++ b/microboot-restful-api/src/main/java/cn/mldn/microboot/vo/Member.java @@ -0,0 +1,48 @@ +package cn.mldn.microboot.vo; + +import java.io.Serializable; +import java.util.Date; + +@SuppressWarnings("serial") +public class Member implements Serializable { + private Long mid ; + private String name ; + private Integer age ; + private Double salary ; + private Date birthday ; + public Long getMid() { + return mid; + } + public void setMid(Long mid) { + this.mid = mid; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public Integer getAge() { + return age; + } + public void setAge(Integer age) { + this.age = age; + } + public Double getSalary() { + return salary; + } + public void setSalary(Double salary) { + this.salary = salary; + } + public Date getBirthday() { + return birthday; + } + public void setBirthday(Date birthday) { + this.birthday = birthday; + } + @Override + public String toString() { + return "Member [mid=" + mid + ", name=" + name + ", age=" + age + + ", salary=" + salary + ", birthday=" + birthday + "]"; + } +} diff --git a/microboot-restful-api/src/main/java/数据库创建脚本.sql b/microboot-restful-api/src/main/java/数据库创建脚本.sql new file mode 100644 index 0000000..edd35b2 --- /dev/null +++ b/microboot-restful-api/src/main/java/数据库创建脚本.sql @@ -0,0 +1,13 @@ +DROP DATBASE IF EXISTS mldn ; +CREATE DATBASE mldn CHARACTER SET UTF8 ; +USE mldn ; +CREATE TABLE dept ( + deptno BIGINT AUTO_INCREMENT , + dname VARCHAR(50) , + CONSTRAINT pk_deptno PRIMARY KEY(deptno) +) ; +INSERT INTO dept(dname) VALUES ('开发部') ; +INSERT INTO dept(dname) VALUES ('财务部') ; +INSERT INTO dept(dname) VALUES ('市场部') ; +INSERT INTO dept(dname) VALUES ('后勤部') ; +INSERT INTO dept(dname) VALUES ('公关部') ; \ No newline at end of file diff --git a/microboot-restful-api/src/main/resources/application.yml b/microboot-restful-api/src/main/resources/application.yml new file mode 100644 index 0000000..6fbc1f2 --- /dev/null +++ b/microboot-restful-api/src/main/resources/application.yml @@ -0,0 +1,23 @@ +spring: + redis: + host: 192.168.68.166 + port: 6379 + password: mldnjava + timeout: 1000 + database: 0 + pool: + max-active: 10 + max-idle: 8 + min-idle: 2 + max-wait: 100 + redis-two: + host: 192.168.68.166 + port: 6380 + password: mldnjava + timeout: 1000 + database: 0 + pool: + max-active: 10 + max-idle: 8 + min-idle: 2 + max-wait: 100 \ No newline at end of file diff --git a/microboot-restful-api/src/main/resources/i18n/Messages.properties b/microboot-restful-api/src/main/resources/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-restful-api/src/main/resources/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-restful-api/src/main/resources/i18n/Pages.properties b/microboot-restful-api/src/main/resources/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-restful-api/src/main/resources/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-restful-api/src/main/resources/logback.xml b/microboot-restful-api/src/main/resources/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-restful-api/src/main/resources/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-restful-api/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml b/microboot-restful-api/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml new file mode 100644 index 0000000..6557a3a --- /dev/null +++ b/microboot-restful-api/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml @@ -0,0 +1,11 @@ + + + + + + INSERT INTO dept(dname) VALUES (#{dname}) ; + + diff --git a/microboot-restful-api/src/main/resources/mybatis/mybatis.cfg.xml b/microboot-restful-api/src/main/resources/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4d128c0 --- /dev/null +++ b/microboot-restful-api/src/main/resources/mybatis/mybatis.cfg.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/microboot-restful-api/src/main/view/static/images/mldn.ico b/microboot-restful-api/src/main/view/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-restful-api/src/main/view/static/images/mldn.ico differ diff --git a/microboot-restful-api/src/main/view/static/info/message_info.html b/microboot-restful-api/src/main/view/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-restful-api/src/main/view/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-restful-api/src/main/view/static/js/main.js b/microboot-restful-api/src/main/view/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-restful-api/src/main/view/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-restful-api/src/main/view/static/message_index.html b/microboot-restful-api/src/main/view/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-restful-api/src/main/view/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-restful-api/src/main/view/templates/upload_page.html b/microboot-restful-api/src/main/view/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-restful-api/src/main/view/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-restful-api/src/main/view/templates/upload_show.html b/microboot-restful-api/src/main/view/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-restful-api/src/main/view/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-restful-api/target/classes/META-INF/MANIFEST.MF b/microboot-restful-api/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d4c16dd --- /dev/null +++ b/microboot-restful-api/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Built-By: foreveriss +Build-Jdk: 1.8.0_121 +Created-By: Maven Integration for Eclipse + diff --git a/microboot-restful-api/target/classes/META-INF/maven/cn.mldn/microboot-restful-api/pom.properties b/microboot-restful-api/target/classes/META-INF/maven/cn.mldn/microboot-restful-api/pom.properties new file mode 100644 index 0000000..faa6481 --- /dev/null +++ b/microboot-restful-api/target/classes/META-INF/maven/cn.mldn/microboot-restful-api/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Thu Jun 29 23:45:11 CST 2017 +version=0.0.1-SNAPSHOT +groupId=cn.mldn +m2e.projectName=microboot-restful-api +m2e.projectLocation=/Users/foreveriss/workspace/microboot/microboot-restful-api +artifactId=microboot-restful-api diff --git a/microboot-restful-api/target/classes/META-INF/maven/cn.mldn/microboot-restful-api/pom.xml b/microboot-restful-api/target/classes/META-INF/maven/cn.mldn/microboot-restful-api/pom.xml new file mode 100644 index 0000000..49f6dd6 --- /dev/null +++ b/microboot-restful-api/target/classes/META-INF/maven/cn.mldn/microboot-restful-api/pom.xml @@ -0,0 +1,73 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-restful-api + microboot-restful-api + http://maven.apache.org + + UTF-8 + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + org.springframework.boot + spring-boot-starter-mail + + + + ch.qos.logback + logback-core + + + + org.springframework.kafka + spring-kafka + + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-restful-api/target/classes/application.yml b/microboot-restful-api/target/classes/application.yml new file mode 100644 index 0000000..6fbc1f2 --- /dev/null +++ b/microboot-restful-api/target/classes/application.yml @@ -0,0 +1,23 @@ +spring: + redis: + host: 192.168.68.166 + port: 6379 + password: mldnjava + timeout: 1000 + database: 0 + pool: + max-active: 10 + max-idle: 8 + min-idle: 2 + max-wait: 100 + redis-two: + host: 192.168.68.166 + port: 6380 + password: mldnjava + timeout: 1000 + database: 0 + pool: + max-active: 10 + max-idle: 8 + min-idle: 2 + max-wait: 100 \ No newline at end of file diff --git a/microboot-restful-api/target/classes/cn/mldn/microboot/StartSpringBootMain.class b/microboot-restful-api/target/classes/cn/mldn/microboot/StartSpringBootMain.class new file mode 100644 index 0000000..18bb195 Binary files /dev/null and b/microboot-restful-api/target/classes/cn/mldn/microboot/StartSpringBootMain.class differ diff --git a/microboot-restful-api/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class b/microboot-restful-api/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class new file mode 100644 index 0000000..57c2010 Binary files /dev/null and b/microboot-restful-api/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class differ diff --git a/microboot-restful-api/target/classes/cn/mldn/microboot/vo/Member.class b/microboot-restful-api/target/classes/cn/mldn/microboot/vo/Member.class new file mode 100644 index 0000000..a58f66d Binary files /dev/null and b/microboot-restful-api/target/classes/cn/mldn/microboot/vo/Member.class differ diff --git a/microboot-restful-api/target/classes/i18n/Messages.properties b/microboot-restful-api/target/classes/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-restful-api/target/classes/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-restful-api/target/classes/i18n/Pages.properties b/microboot-restful-api/target/classes/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-restful-api/target/classes/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-restful-api/target/classes/logback.xml b/microboot-restful-api/target/classes/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-restful-api/target/classes/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-restful-api/target/classes/mybatis/mapper/cn/mldn/Dept.xml b/microboot-restful-api/target/classes/mybatis/mapper/cn/mldn/Dept.xml new file mode 100644 index 0000000..6557a3a --- /dev/null +++ b/microboot-restful-api/target/classes/mybatis/mapper/cn/mldn/Dept.xml @@ -0,0 +1,11 @@ + + + + + + INSERT INTO dept(dname) VALUES (#{dname}) ; + + diff --git a/microboot-restful-api/target/classes/mybatis/mybatis.cfg.xml b/microboot-restful-api/target/classes/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4d128c0 --- /dev/null +++ b/microboot-restful-api/target/classes/mybatis/mybatis.cfg.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/microboot-restful-api/target/classes/static/images/mldn.ico b/microboot-restful-api/target/classes/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-restful-api/target/classes/static/images/mldn.ico differ diff --git a/microboot-restful-api/target/classes/static/info/message_info.html b/microboot-restful-api/target/classes/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-restful-api/target/classes/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-restful-api/target/classes/static/js/main.js b/microboot-restful-api/target/classes/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-restful-api/target/classes/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-restful-api/target/classes/static/message_index.html b/microboot-restful-api/target/classes/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-restful-api/target/classes/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-restful-api/target/classes/templates/upload_page.html b/microboot-restful-api/target/classes/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-restful-api/target/classes/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-restful-api/target/classes/templates/upload_show.html b/microboot-restful-api/target/classes/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-restful-api/target/classes/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-restful-consumer/.classpath b/microboot-restful-consumer/.classpath new file mode 100644 index 0000000..a6f04e8 --- /dev/null +++ b/microboot-restful-consumer/.classpath @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/microboot-restful-consumer/.project b/microboot-restful-consumer/.project new file mode 100644 index 0000000..2dc4039 --- /dev/null +++ b/microboot-restful-consumer/.project @@ -0,0 +1,35 @@ + + + microboot-restful-consumer + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/microboot-restful-consumer/.settings/org.eclipse.core.resources.prefs b/microboot-restful-consumer/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..a6dcfb7 --- /dev/null +++ b/microboot-restful-consumer/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/main/view=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/microboot-restful-consumer/.settings/org.eclipse.jdt.core.prefs b/microboot-restful-consumer/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..d59e09c --- /dev/null +++ b/microboot-restful-consumer/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/microboot-restful-consumer/.settings/org.eclipse.m2e.core.prefs b/microboot-restful-consumer/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/microboot-restful-consumer/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/microboot-restful-consumer/.settings/org.eclipse.wst.common.project.facet.core.xml b/microboot-restful-consumer/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..e822977 --- /dev/null +++ b/microboot-restful-consumer/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ + + + + diff --git a/microboot-restful-consumer/pom.xml b/microboot-restful-consumer/pom.xml new file mode 100644 index 0000000..90e4b6d --- /dev/null +++ b/microboot-restful-consumer/pom.xml @@ -0,0 +1,78 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-restful-consumer + microboot-restful-consumer + http://maven.apache.org + + UTF-8 + + + + cn.mldn + microboot-restful-api + 0.0.1-SNAPSHOT + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + org.springframework.boot + spring-boot-starter-mail + + + + ch.qos.logback + logback-core + + + + org.springframework.kafka + spring-kafka + + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-restful-consumer/src/main/java/cn/mldn/microboot/StartSpringBootMain.java b/microboot-restful-consumer/src/main/java/cn/mldn/microboot/StartSpringBootMain.java new file mode 100644 index 0000000..8a58ff5 --- /dev/null +++ b/microboot-restful-consumer/src/main/java/cn/mldn/microboot/StartSpringBootMain.java @@ -0,0 +1,15 @@ +package cn.mldn.microboot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication // 启动SpringBoot程序,而后自带子包扫描 +public class StartSpringBootMain { + static { + System.setProperty("java.security.auth.login.config", + "d:/kafka_client_jaas.conf"); // 表示系统环境属性 + } + public static void main(String[] args) throws Exception { + SpringApplication.run(StartSpringBootMain.class, args); + } +} diff --git a/microboot-restful-consumer/src/main/java/cn/mldn/microboot/config/RestConfig.java b/microboot-restful-consumer/src/main/java/cn/mldn/microboot/config/RestConfig.java new file mode 100644 index 0000000..4086004 --- /dev/null +++ b/microboot-restful-consumer/src/main/java/cn/mldn/microboot/config/RestConfig.java @@ -0,0 +1,13 @@ +package cn.mldn.microboot.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.client.RestTemplate; + +@Configuration +public class RestConfig { + @Bean + public RestTemplate getRestTemplate() { + return new RestTemplate() ; + } +} diff --git a/microboot-restful-consumer/src/main/java/cn/mldn/microboot/controller/MemberConsumerController.java b/microboot-restful-consumer/src/main/java/cn/mldn/microboot/controller/MemberConsumerController.java new file mode 100644 index 0000000..13aa1bb --- /dev/null +++ b/microboot-restful-consumer/src/main/java/cn/mldn/microboot/controller/MemberConsumerController.java @@ -0,0 +1,33 @@ +package cn.mldn.microboot.controller; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.client.RestTemplate; + +import cn.mldn.microboot.util.controller.AbstractBaseController; +import cn.mldn.microboot.vo.Member; + +@Controller +public class MemberConsumerController extends AbstractBaseController { + @Resource + private RestTemplate restTemplate; + @RequestMapping(value = "/consumer/get", method = RequestMethod.GET) + public String getMember(long mid,Model model) { + Member member = this.restTemplate.getForObject( + "http://localhost:8080/member/get/" + mid, Member.class); + model.addAttribute("member", member) ; + return "member_show"; + } + @RequestMapping(value = "/consumer/add", method = RequestMethod.GET) + @ResponseBody + public Object addMember(Member member) { + Boolean flag = this.restTemplate.postForObject( + "http://localhost:8080/member/add", member, Boolean.class); + return flag; + } +} diff --git a/microboot-restful-consumer/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java b/microboot-restful-consumer/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java new file mode 100644 index 0000000..93c1b2c --- /dev/null +++ b/microboot-restful-consumer/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java @@ -0,0 +1,27 @@ +package cn.mldn.microboot.util.controller; + +import java.text.SimpleDateFormat; +import java.util.Locale; + +import javax.annotation.Resource; + +import org.springframework.beans.propertyeditors.CustomDateEditor; +import org.springframework.context.MessageSource; +import org.springframework.web.bind.WebDataBinder; +import org.springframework.web.bind.annotation.InitBinder; + +public abstract class AbstractBaseController { + @Resource + private MessageSource messageSource; // 自动注入此资源对象 + public String getMessage(String key, String... args) { + return this.messageSource.getMessage(key, args, Locale.getDefault()); + } + @InitBinder + public void initBinder(WebDataBinder binder) { // 在本程序里面需要针对于日期格式进行处理 + // 首先建立一个可以将字符串转换为日期的工具程序类 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd") ; + // 明确的描述此时需要注册一个日期格式的转化处理程序类 + binder.registerCustomEditor(java.util.Date.class, new CustomDateEditor(sdf, true)); + } + +} diff --git a/microboot-restful-consumer/src/main/java/cn/mldn/microboot/vo/LogInfo.java b/microboot-restful-consumer/src/main/java/cn/mldn/microboot/vo/LogInfo.java new file mode 100644 index 0000000..fc4f89b --- /dev/null +++ b/microboot-restful-consumer/src/main/java/cn/mldn/microboot/vo/LogInfo.java @@ -0,0 +1,13 @@ +package cn.mldn.microboot.vo; + +public class LogInfo { + private String level ; + + public String getLevel() { + return level; + } + + public void setLevel(String level) { + this.level = level; + } +} diff --git a/microboot-restful-consumer/src/main/java/数据库创建脚本.sql b/microboot-restful-consumer/src/main/java/数据库创建脚本.sql new file mode 100644 index 0000000..edd35b2 --- /dev/null +++ b/microboot-restful-consumer/src/main/java/数据库创建脚本.sql @@ -0,0 +1,13 @@ +DROP DATBASE IF EXISTS mldn ; +CREATE DATBASE mldn CHARACTER SET UTF8 ; +USE mldn ; +CREATE TABLE dept ( + deptno BIGINT AUTO_INCREMENT , + dname VARCHAR(50) , + CONSTRAINT pk_deptno PRIMARY KEY(deptno) +) ; +INSERT INTO dept(dname) VALUES ('开发部') ; +INSERT INTO dept(dname) VALUES ('财务部') ; +INSERT INTO dept(dname) VALUES ('市场部') ; +INSERT INTO dept(dname) VALUES ('后勤部') ; +INSERT INTO dept(dname) VALUES ('公关部') ; \ No newline at end of file diff --git a/microboot-restful-consumer/src/main/resources/application.yml b/microboot-restful-consumer/src/main/resources/application.yml new file mode 100644 index 0000000..226708a --- /dev/null +++ b/microboot-restful-consumer/src/main/resources/application.yml @@ -0,0 +1,2 @@ +server: + port: 80 \ No newline at end of file diff --git a/microboot-restful-consumer/src/main/resources/i18n/Messages.properties b/microboot-restful-consumer/src/main/resources/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-restful-consumer/src/main/resources/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-restful-consumer/src/main/resources/i18n/Pages.properties b/microboot-restful-consumer/src/main/resources/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-restful-consumer/src/main/resources/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-restful-consumer/src/main/resources/logback.xml b/microboot-restful-consumer/src/main/resources/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-restful-consumer/src/main/resources/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-restful-consumer/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml b/microboot-restful-consumer/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml new file mode 100644 index 0000000..6557a3a --- /dev/null +++ b/microboot-restful-consumer/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml @@ -0,0 +1,11 @@ + + + + + + INSERT INTO dept(dname) VALUES (#{dname}) ; + + diff --git a/microboot-restful-consumer/src/main/resources/mybatis/mybatis.cfg.xml b/microboot-restful-consumer/src/main/resources/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4d128c0 --- /dev/null +++ b/microboot-restful-consumer/src/main/resources/mybatis/mybatis.cfg.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/microboot-restful-consumer/src/main/view/static/images/mldn.ico b/microboot-restful-consumer/src/main/view/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-restful-consumer/src/main/view/static/images/mldn.ico differ diff --git a/microboot-restful-consumer/src/main/view/static/info/message_info.html b/microboot-restful-consumer/src/main/view/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-restful-consumer/src/main/view/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-restful-consumer/src/main/view/static/js/main.js b/microboot-restful-consumer/src/main/view/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-restful-consumer/src/main/view/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-restful-consumer/src/main/view/static/message_index.html b/microboot-restful-consumer/src/main/view/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-restful-consumer/src/main/view/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-restful-consumer/src/main/view/templates/member_show.html b/microboot-restful-consumer/src/main/view/templates/member_show.html new file mode 100644 index 0000000..88affc5 --- /dev/null +++ b/microboot-restful-consumer/src/main/view/templates/member_show.html @@ -0,0 +1,14 @@ + + + +SpringBoot模版渲染 + + + +

+

+

+

+

+ + \ No newline at end of file diff --git a/microboot-restful-consumer/src/main/view/templates/upload_show.html b/microboot-restful-consumer/src/main/view/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-restful-consumer/src/main/view/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-restful-consumer/src/test/java/cn/mldn/microboot/TestLogger.java b/microboot-restful-consumer/src/test/java/cn/mldn/microboot/TestLogger.java new file mode 100644 index 0000000..a080ea8 --- /dev/null +++ b/microboot-restful-consumer/src/test/java/cn/mldn/microboot/TestLogger.java @@ -0,0 +1,28 @@ +package cn.mldn.microboot; + +import javax.annotation.Resource; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.web.client.RestTemplate; + +import cn.mldn.microboot.vo.LogInfo; + +@SpringBootTest(classes = StartSpringBootMain.class) +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +public class TestLogger { + @Resource + private RestTemplate restTemplate; + @Test + public void testLevel() { + LogInfo log = new LogInfo(); + log.setLevel("INFO"); // 新的日志级别 + this.restTemplate.postForLocation( + "http://localhost:8080/loggers/cn.mldn.microboot.controller", + log); + } +} diff --git a/microboot-restful-consumer/src/test/java/cn/mldn/microboot/TestMemberRestful.java b/microboot-restful-consumer/src/test/java/cn/mldn/microboot/TestMemberRestful.java new file mode 100644 index 0000000..a722044 --- /dev/null +++ b/microboot-restful-consumer/src/test/java/cn/mldn/microboot/TestMemberRestful.java @@ -0,0 +1,34 @@ +package cn.mldn.microboot; + +import javax.annotation.Resource; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.web.client.RestTemplate; + +import cn.mldn.microboot.vo.Member; + +@SpringBootTest(classes = StartSpringBootMain.class) +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +public class TestMemberRestful { + @Resource + private RestTemplate restTemplate; + @Test + public void testAdd() { + Boolean flag = this.restTemplate.getForObject( + "http://localhost:8080/member/add?mid=110&name=SMITH&age=10", + Boolean.class); + System.out.println("【ConsumerTest.add()】" + flag); + } + @Test + public void testGet() { + // 通过远程的Rest服务中的信息将其自动转换为Member对象实例 + Member member = this.restTemplate.getForObject( + "http://localhost:8080/member/get?mid=110", Member.class); + System.out.println("【ConsumerTest.get()】" + member); + } +} diff --git a/microboot-restful-consumer/target/classes/META-INF/MANIFEST.MF b/microboot-restful-consumer/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d4c16dd --- /dev/null +++ b/microboot-restful-consumer/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Built-By: foreveriss +Build-Jdk: 1.8.0_121 +Created-By: Maven Integration for Eclipse + diff --git a/microboot-restful-consumer/target/classes/META-INF/maven/cn.mldn/microboot-restful-consumer/pom.properties b/microboot-restful-consumer/target/classes/META-INF/maven/cn.mldn/microboot-restful-consumer/pom.properties new file mode 100644 index 0000000..3e6d5e4 --- /dev/null +++ b/microboot-restful-consumer/target/classes/META-INF/maven/cn.mldn/microboot-restful-consumer/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Thu Jun 29 23:45:12 CST 2017 +version=0.0.1-SNAPSHOT +groupId=cn.mldn +m2e.projectName=microboot-restful-consumer +m2e.projectLocation=/Users/foreveriss/workspace/microboot/microboot-restful-consumer +artifactId=microboot-restful-consumer diff --git a/microboot-restful-consumer/target/classes/META-INF/maven/cn.mldn/microboot-restful-consumer/pom.xml b/microboot-restful-consumer/target/classes/META-INF/maven/cn.mldn/microboot-restful-consumer/pom.xml new file mode 100644 index 0000000..90e4b6d --- /dev/null +++ b/microboot-restful-consumer/target/classes/META-INF/maven/cn.mldn/microboot-restful-consumer/pom.xml @@ -0,0 +1,78 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-restful-consumer + microboot-restful-consumer + http://maven.apache.org + + UTF-8 + + + + cn.mldn + microboot-restful-api + 0.0.1-SNAPSHOT + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + org.springframework.boot + spring-boot-starter-mail + + + + ch.qos.logback + logback-core + + + + org.springframework.kafka + spring-kafka + + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-restful-consumer/target/classes/application.yml b/microboot-restful-consumer/target/classes/application.yml new file mode 100644 index 0000000..226708a --- /dev/null +++ b/microboot-restful-consumer/target/classes/application.yml @@ -0,0 +1,2 @@ +server: + port: 80 \ No newline at end of file diff --git a/microboot-restful-consumer/target/classes/cn/mldn/microboot/StartSpringBootMain.class b/microboot-restful-consumer/target/classes/cn/mldn/microboot/StartSpringBootMain.class new file mode 100644 index 0000000..18bb195 Binary files /dev/null and b/microboot-restful-consumer/target/classes/cn/mldn/microboot/StartSpringBootMain.class differ diff --git a/microboot-restful-consumer/target/classes/cn/mldn/microboot/config/RestConfig.class b/microboot-restful-consumer/target/classes/cn/mldn/microboot/config/RestConfig.class new file mode 100644 index 0000000..0447b61 Binary files /dev/null and b/microboot-restful-consumer/target/classes/cn/mldn/microboot/config/RestConfig.class differ diff --git a/microboot-restful-consumer/target/classes/cn/mldn/microboot/controller/MemberConsumerController.class b/microboot-restful-consumer/target/classes/cn/mldn/microboot/controller/MemberConsumerController.class new file mode 100644 index 0000000..9c95ddc Binary files /dev/null and b/microboot-restful-consumer/target/classes/cn/mldn/microboot/controller/MemberConsumerController.class differ diff --git a/microboot-restful-consumer/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class b/microboot-restful-consumer/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class new file mode 100644 index 0000000..e043da7 Binary files /dev/null and b/microboot-restful-consumer/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class differ diff --git a/microboot-restful-consumer/target/classes/cn/mldn/microboot/vo/LogInfo.class b/microboot-restful-consumer/target/classes/cn/mldn/microboot/vo/LogInfo.class new file mode 100644 index 0000000..fa1142a Binary files /dev/null and b/microboot-restful-consumer/target/classes/cn/mldn/microboot/vo/LogInfo.class differ diff --git a/microboot-restful-consumer/target/classes/i18n/Messages.properties b/microboot-restful-consumer/target/classes/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-restful-consumer/target/classes/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-restful-consumer/target/classes/i18n/Pages.properties b/microboot-restful-consumer/target/classes/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-restful-consumer/target/classes/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-restful-consumer/target/classes/logback.xml b/microboot-restful-consumer/target/classes/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-restful-consumer/target/classes/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-restful-consumer/target/classes/mybatis/mapper/cn/mldn/Dept.xml b/microboot-restful-consumer/target/classes/mybatis/mapper/cn/mldn/Dept.xml new file mode 100644 index 0000000..6557a3a --- /dev/null +++ b/microboot-restful-consumer/target/classes/mybatis/mapper/cn/mldn/Dept.xml @@ -0,0 +1,11 @@ + + + + + + INSERT INTO dept(dname) VALUES (#{dname}) ; + + diff --git a/microboot-restful-consumer/target/classes/mybatis/mybatis.cfg.xml b/microboot-restful-consumer/target/classes/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4d128c0 --- /dev/null +++ b/microboot-restful-consumer/target/classes/mybatis/mybatis.cfg.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/microboot-restful-consumer/target/classes/static/images/mldn.ico b/microboot-restful-consumer/target/classes/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-restful-consumer/target/classes/static/images/mldn.ico differ diff --git a/microboot-restful-consumer/target/classes/static/info/message_info.html b/microboot-restful-consumer/target/classes/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-restful-consumer/target/classes/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-restful-consumer/target/classes/static/js/main.js b/microboot-restful-consumer/target/classes/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-restful-consumer/target/classes/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-restful-consumer/target/classes/static/message_index.html b/microboot-restful-consumer/target/classes/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-restful-consumer/target/classes/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-restful-consumer/target/classes/templates/member_show.html b/microboot-restful-consumer/target/classes/templates/member_show.html new file mode 100644 index 0000000..88affc5 --- /dev/null +++ b/microboot-restful-consumer/target/classes/templates/member_show.html @@ -0,0 +1,14 @@ + + + +SpringBoot模版渲染 + + + +

+

+

+

+

+ + \ No newline at end of file diff --git a/microboot-restful-consumer/target/classes/templates/upload_show.html b/microboot-restful-consumer/target/classes/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-restful-consumer/target/classes/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-restful-consumer/target/test-classes/cn/mldn/microboot/TestLogger.class b/microboot-restful-consumer/target/test-classes/cn/mldn/microboot/TestLogger.class new file mode 100644 index 0000000..3133d80 Binary files /dev/null and b/microboot-restful-consumer/target/test-classes/cn/mldn/microboot/TestLogger.class differ diff --git a/microboot-restful-consumer/target/test-classes/cn/mldn/microboot/TestMemberRestful.class b/microboot-restful-consumer/target/test-classes/cn/mldn/microboot/TestMemberRestful.class new file mode 100644 index 0000000..b36e769 Binary files /dev/null and b/microboot-restful-consumer/target/test-classes/cn/mldn/microboot/TestMemberRestful.class differ diff --git a/microboot-restful-log/.classpath b/microboot-restful-log/.classpath new file mode 100644 index 0000000..a6f04e8 --- /dev/null +++ b/microboot-restful-log/.classpath @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/microboot-restful-log/.project b/microboot-restful-log/.project new file mode 100644 index 0000000..493ade2 --- /dev/null +++ b/microboot-restful-log/.project @@ -0,0 +1,35 @@ + + + microboot-restful-log + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/microboot-restful-log/.settings/org.eclipse.core.resources.prefs b/microboot-restful-log/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..a6dcfb7 --- /dev/null +++ b/microboot-restful-log/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/main/view=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/microboot-restful-log/.settings/org.eclipse.jdt.core.prefs b/microboot-restful-log/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..d59e09c --- /dev/null +++ b/microboot-restful-log/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/microboot-restful-log/.settings/org.eclipse.m2e.core.prefs b/microboot-restful-log/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/microboot-restful-log/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/microboot-restful-log/.settings/org.eclipse.wst.common.project.facet.core.xml b/microboot-restful-log/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..e822977 --- /dev/null +++ b/microboot-restful-log/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ + + + + diff --git a/microboot-restful-log/pom.xml b/microboot-restful-log/pom.xml new file mode 100644 index 0000000..bfc994e --- /dev/null +++ b/microboot-restful-log/pom.xml @@ -0,0 +1,83 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-restful-log + microboot-restful-log + http://maven.apache.org + + UTF-8 + + + + org.springframework.boot + spring-boot-starter-actuator + + + cn.mldn + microboot-restful-api + 0.0.1-SNAPSHOT + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + org.springframework.boot + spring-boot-starter-mail + + + + ch.qos.logback + logback-core + + + + org.springframework.kafka + spring-kafka + + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-restful-log/src/main/java/cn/mldn/microboot/StartSpringBootMain.java b/microboot-restful-log/src/main/java/cn/mldn/microboot/StartSpringBootMain.java new file mode 100644 index 0000000..8a58ff5 --- /dev/null +++ b/microboot-restful-log/src/main/java/cn/mldn/microboot/StartSpringBootMain.java @@ -0,0 +1,15 @@ +package cn.mldn.microboot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication // 启动SpringBoot程序,而后自带子包扫描 +public class StartSpringBootMain { + static { + System.setProperty("java.security.auth.login.config", + "d:/kafka_client_jaas.conf"); // 表示系统环境属性 + } + public static void main(String[] args) throws Exception { + SpringApplication.run(StartSpringBootMain.class, args); + } +} diff --git a/microboot-restful-log/src/main/java/cn/mldn/microboot/controller/MessageController.java b/microboot-restful-log/src/main/java/cn/mldn/microboot/controller/MessageController.java new file mode 100644 index 0000000..5dcace7 --- /dev/null +++ b/microboot-restful-log/src/main/java/cn/mldn/microboot/controller/MessageController.java @@ -0,0 +1,17 @@ +package cn.mldn.microboot.controller; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class MessageController { + private Logger log = LoggerFactory.getLogger(MessageController.class); + @RequestMapping(value = "/test") + public Object test() { + this.log.info("【*** INFO ***】日志输出"); + this.log.error("【*** ERROR ***】日志输出"); + return true; + } +} diff --git a/microboot-restful-log/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java b/microboot-restful-log/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java new file mode 100644 index 0000000..6ee5c4a --- /dev/null +++ b/microboot-restful-log/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java @@ -0,0 +1,26 @@ +package cn.mldn.microboot.util.controller; + +import java.text.SimpleDateFormat; +import java.util.Locale; + +import javax.annotation.Resource; + +import org.springframework.beans.propertyeditors.CustomDateEditor; +import org.springframework.context.MessageSource; +import org.springframework.web.bind.WebDataBinder; +import org.springframework.web.bind.annotation.InitBinder; + +public abstract class AbstractBaseController { + @Resource + private MessageSource messageSource; // 自动注入此资源对象 + public String getMessage(String key, String... args) { + return this.messageSource.getMessage(key, args, Locale.getDefault()); + } + @InitBinder + public void initBinder(WebDataBinder binder) { // 在本程序里面需要针对于日期格式进行处理 + // 首先建立一个可以将字符串转换为日期的工具程序类 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd") ; + // 明确的描述此时需要注册一个日期格式的转化处理程序类 + binder.registerCustomEditor(java.util.Date.class, new CustomDateEditor(sdf, true)); + } +} diff --git a/microboot-restful-log/src/main/java/数据库创建脚本.sql b/microboot-restful-log/src/main/java/数据库创建脚本.sql new file mode 100644 index 0000000..edd35b2 --- /dev/null +++ b/microboot-restful-log/src/main/java/数据库创建脚本.sql @@ -0,0 +1,13 @@ +DROP DATBASE IF EXISTS mldn ; +CREATE DATBASE mldn CHARACTER SET UTF8 ; +USE mldn ; +CREATE TABLE dept ( + deptno BIGINT AUTO_INCREMENT , + dname VARCHAR(50) , + CONSTRAINT pk_deptno PRIMARY KEY(deptno) +) ; +INSERT INTO dept(dname) VALUES ('开发部') ; +INSERT INTO dept(dname) VALUES ('财务部') ; +INSERT INTO dept(dname) VALUES ('市场部') ; +INSERT INTO dept(dname) VALUES ('后勤部') ; +INSERT INTO dept(dname) VALUES ('公关部') ; \ No newline at end of file diff --git a/microboot-restful-log/src/main/resources/application.yml b/microboot-restful-log/src/main/resources/application.yml new file mode 100644 index 0000000..6798e32 --- /dev/null +++ b/microboot-restful-log/src/main/resources/application.yml @@ -0,0 +1,31 @@ +management: + security : + enabled: false + +logging: + level: + cn.mldn.microboot.controller: ERROR + +spring: + redis: + host: 192.168.68.166 + port: 6379 + password: mldnjava + timeout: 1000 + database: 0 + pool: + max-active: 10 + max-idle: 8 + min-idle: 2 + max-wait: 100 + redis-two: + host: 192.168.68.166 + port: 6380 + password: mldnjava + timeout: 1000 + database: 0 + pool: + max-active: 10 + max-idle: 8 + min-idle: 2 + max-wait: 100 \ No newline at end of file diff --git a/microboot-restful-log/src/main/resources/i18n/Messages.properties b/microboot-restful-log/src/main/resources/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-restful-log/src/main/resources/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-restful-log/src/main/resources/i18n/Pages.properties b/microboot-restful-log/src/main/resources/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-restful-log/src/main/resources/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-restful-log/src/main/resources/logback.xml b/microboot-restful-log/src/main/resources/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-restful-log/src/main/resources/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-restful-log/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml b/microboot-restful-log/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml new file mode 100644 index 0000000..6557a3a --- /dev/null +++ b/microboot-restful-log/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml @@ -0,0 +1,11 @@ + + + + + + INSERT INTO dept(dname) VALUES (#{dname}) ; + + diff --git a/microboot-restful-log/src/main/resources/mybatis/mybatis.cfg.xml b/microboot-restful-log/src/main/resources/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4d128c0 --- /dev/null +++ b/microboot-restful-log/src/main/resources/mybatis/mybatis.cfg.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/microboot-restful-log/src/main/view/static/images/mldn.ico b/microboot-restful-log/src/main/view/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-restful-log/src/main/view/static/images/mldn.ico differ diff --git a/microboot-restful-log/src/main/view/static/info/message_info.html b/microboot-restful-log/src/main/view/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-restful-log/src/main/view/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-restful-log/src/main/view/static/js/main.js b/microboot-restful-log/src/main/view/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-restful-log/src/main/view/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-restful-log/src/main/view/static/message_index.html b/microboot-restful-log/src/main/view/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-restful-log/src/main/view/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-restful-log/src/main/view/templates/upload_page.html b/microboot-restful-log/src/main/view/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-restful-log/src/main/view/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-restful-log/src/main/view/templates/upload_show.html b/microboot-restful-log/src/main/view/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-restful-log/src/main/view/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-restful-log/target/classes/META-INF/MANIFEST.MF b/microboot-restful-log/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d4c16dd --- /dev/null +++ b/microboot-restful-log/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Built-By: foreveriss +Build-Jdk: 1.8.0_121 +Created-By: Maven Integration for Eclipse + diff --git a/microboot-restful-log/target/classes/META-INF/maven/cn.mldn/microboot-restful-log/pom.properties b/microboot-restful-log/target/classes/META-INF/maven/cn.mldn/microboot-restful-log/pom.properties new file mode 100644 index 0000000..509edbd --- /dev/null +++ b/microboot-restful-log/target/classes/META-INF/maven/cn.mldn/microboot-restful-log/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Thu Jun 29 23:45:13 CST 2017 +version=0.0.1-SNAPSHOT +groupId=cn.mldn +m2e.projectName=microboot-restful-log +m2e.projectLocation=/Users/foreveriss/workspace/microboot/microboot-restful-log +artifactId=microboot-restful-log diff --git a/microboot-restful-log/target/classes/META-INF/maven/cn.mldn/microboot-restful-log/pom.xml b/microboot-restful-log/target/classes/META-INF/maven/cn.mldn/microboot-restful-log/pom.xml new file mode 100644 index 0000000..bfc994e --- /dev/null +++ b/microboot-restful-log/target/classes/META-INF/maven/cn.mldn/microboot-restful-log/pom.xml @@ -0,0 +1,83 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-restful-log + microboot-restful-log + http://maven.apache.org + + UTF-8 + + + + org.springframework.boot + spring-boot-starter-actuator + + + cn.mldn + microboot-restful-api + 0.0.1-SNAPSHOT + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + org.springframework.boot + spring-boot-starter-mail + + + + ch.qos.logback + logback-core + + + + org.springframework.kafka + spring-kafka + + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-restful-log/target/classes/application.yml b/microboot-restful-log/target/classes/application.yml new file mode 100644 index 0000000..6798e32 --- /dev/null +++ b/microboot-restful-log/target/classes/application.yml @@ -0,0 +1,31 @@ +management: + security : + enabled: false + +logging: + level: + cn.mldn.microboot.controller: ERROR + +spring: + redis: + host: 192.168.68.166 + port: 6379 + password: mldnjava + timeout: 1000 + database: 0 + pool: + max-active: 10 + max-idle: 8 + min-idle: 2 + max-wait: 100 + redis-two: + host: 192.168.68.166 + port: 6380 + password: mldnjava + timeout: 1000 + database: 0 + pool: + max-active: 10 + max-idle: 8 + min-idle: 2 + max-wait: 100 \ No newline at end of file diff --git a/microboot-restful-log/target/classes/cn/mldn/microboot/StartSpringBootMain.class b/microboot-restful-log/target/classes/cn/mldn/microboot/StartSpringBootMain.class new file mode 100644 index 0000000..18bb195 Binary files /dev/null and b/microboot-restful-log/target/classes/cn/mldn/microboot/StartSpringBootMain.class differ diff --git a/microboot-restful-log/target/classes/cn/mldn/microboot/controller/MessageController.class b/microboot-restful-log/target/classes/cn/mldn/microboot/controller/MessageController.class new file mode 100644 index 0000000..2486157 Binary files /dev/null and b/microboot-restful-log/target/classes/cn/mldn/microboot/controller/MessageController.class differ diff --git a/microboot-restful-log/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class b/microboot-restful-log/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class new file mode 100644 index 0000000..e043da7 Binary files /dev/null and b/microboot-restful-log/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class differ diff --git a/microboot-restful-log/target/classes/i18n/Messages.properties b/microboot-restful-log/target/classes/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-restful-log/target/classes/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-restful-log/target/classes/i18n/Pages.properties b/microboot-restful-log/target/classes/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-restful-log/target/classes/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-restful-log/target/classes/logback.xml b/microboot-restful-log/target/classes/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-restful-log/target/classes/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-restful-log/target/classes/mybatis/mapper/cn/mldn/Dept.xml b/microboot-restful-log/target/classes/mybatis/mapper/cn/mldn/Dept.xml new file mode 100644 index 0000000..6557a3a --- /dev/null +++ b/microboot-restful-log/target/classes/mybatis/mapper/cn/mldn/Dept.xml @@ -0,0 +1,11 @@ + + + + + + INSERT INTO dept(dname) VALUES (#{dname}) ; + + diff --git a/microboot-restful-log/target/classes/mybatis/mybatis.cfg.xml b/microboot-restful-log/target/classes/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4d128c0 --- /dev/null +++ b/microboot-restful-log/target/classes/mybatis/mybatis.cfg.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/microboot-restful-log/target/classes/static/images/mldn.ico b/microboot-restful-log/target/classes/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-restful-log/target/classes/static/images/mldn.ico differ diff --git a/microboot-restful-log/target/classes/static/info/message_info.html b/microboot-restful-log/target/classes/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-restful-log/target/classes/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-restful-log/target/classes/static/js/main.js b/microboot-restful-log/target/classes/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-restful-log/target/classes/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-restful-log/target/classes/static/message_index.html b/microboot-restful-log/target/classes/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-restful-log/target/classes/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-restful-log/target/classes/templates/upload_page.html b/microboot-restful-log/target/classes/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-restful-log/target/classes/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-restful-log/target/classes/templates/upload_show.html b/microboot-restful-log/target/classes/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-restful-log/target/classes/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-restful-provider/.classpath b/microboot-restful-provider/.classpath new file mode 100644 index 0000000..a6f04e8 --- /dev/null +++ b/microboot-restful-provider/.classpath @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/microboot-restful-provider/.project b/microboot-restful-provider/.project new file mode 100644 index 0000000..82889a2 --- /dev/null +++ b/microboot-restful-provider/.project @@ -0,0 +1,35 @@ + + + microboot-restful-provider + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/microboot-restful-provider/.settings/org.eclipse.core.resources.prefs b/microboot-restful-provider/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..a6dcfb7 --- /dev/null +++ b/microboot-restful-provider/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/main/view=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/microboot-restful-provider/.settings/org.eclipse.jdt.core.prefs b/microboot-restful-provider/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..d59e09c --- /dev/null +++ b/microboot-restful-provider/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/microboot-restful-provider/.settings/org.eclipse.m2e.core.prefs b/microboot-restful-provider/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/microboot-restful-provider/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/microboot-restful-provider/.settings/org.eclipse.wst.common.project.facet.core.xml b/microboot-restful-provider/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..e822977 --- /dev/null +++ b/microboot-restful-provider/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ + + + + diff --git a/microboot-restful-provider/pom.xml b/microboot-restful-provider/pom.xml new file mode 100644 index 0000000..1ea1efe --- /dev/null +++ b/microboot-restful-provider/pom.xml @@ -0,0 +1,79 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-restful-provider + microboot-restful-provider + http://maven.apache.org + + UTF-8 + + + + cn.mldn + microboot-restful-api + 0.0.1-SNAPSHOT + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + org.springframework.boot + spring-boot-starter-mail + + + + ch.qos.logback + logback-core + + + + org.springframework.kafka + spring-kafka + + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-restful-provider/src/main/java/cn/mldn/microboot/StartSpringBootMain.java b/microboot-restful-provider/src/main/java/cn/mldn/microboot/StartSpringBootMain.java new file mode 100644 index 0000000..8a58ff5 --- /dev/null +++ b/microboot-restful-provider/src/main/java/cn/mldn/microboot/StartSpringBootMain.java @@ -0,0 +1,15 @@ +package cn.mldn.microboot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication // 启动SpringBoot程序,而后自带子包扫描 +public class StartSpringBootMain { + static { + System.setProperty("java.security.auth.login.config", + "d:/kafka_client_jaas.conf"); // 表示系统环境属性 + } + public static void main(String[] args) throws Exception { + SpringApplication.run(StartSpringBootMain.class, args); + } +} diff --git a/microboot-restful-provider/src/main/java/cn/mldn/microboot/controller/MemberController.java b/microboot-restful-provider/src/main/java/cn/mldn/microboot/controller/MemberController.java new file mode 100644 index 0000000..dabd39c --- /dev/null +++ b/microboot-restful-provider/src/main/java/cn/mldn/microboot/controller/MemberController.java @@ -0,0 +1,30 @@ +package cn.mldn.microboot.controller; + +import java.util.Date; + +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import cn.mldn.microboot.vo.Member; + +@RestController +public class MemberController { + @RequestMapping(value = "/member/add",method=RequestMethod.POST) + public Object add(@RequestBody Member member) { // 表示当前的配置可以直接将参数变为VO对象 + System.err.println("【MemberController.add()接收对象】" + member); + return true; + } + @RequestMapping(value = "/member/get/{mid}",method=RequestMethod.GET) + public Member get(@PathVariable("mid") long mid) { + Member vo = new Member(); + vo.setMid(mid); + vo.setName("mldnjava - " + mid); + vo.setBirthday(new Date()); + vo.setSalary(99999.99); + vo.setAge(16); + return vo; + } +} diff --git a/microboot-restful-provider/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java b/microboot-restful-provider/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java new file mode 100644 index 0000000..6ee5c4a --- /dev/null +++ b/microboot-restful-provider/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java @@ -0,0 +1,26 @@ +package cn.mldn.microboot.util.controller; + +import java.text.SimpleDateFormat; +import java.util.Locale; + +import javax.annotation.Resource; + +import org.springframework.beans.propertyeditors.CustomDateEditor; +import org.springframework.context.MessageSource; +import org.springframework.web.bind.WebDataBinder; +import org.springframework.web.bind.annotation.InitBinder; + +public abstract class AbstractBaseController { + @Resource + private MessageSource messageSource; // 自动注入此资源对象 + public String getMessage(String key, String... args) { + return this.messageSource.getMessage(key, args, Locale.getDefault()); + } + @InitBinder + public void initBinder(WebDataBinder binder) { // 在本程序里面需要针对于日期格式进行处理 + // 首先建立一个可以将字符串转换为日期的工具程序类 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd") ; + // 明确的描述此时需要注册一个日期格式的转化处理程序类 + binder.registerCustomEditor(java.util.Date.class, new CustomDateEditor(sdf, true)); + } +} diff --git a/microboot-restful-provider/src/main/java/数据库创建脚本.sql b/microboot-restful-provider/src/main/java/数据库创建脚本.sql new file mode 100644 index 0000000..edd35b2 --- /dev/null +++ b/microboot-restful-provider/src/main/java/数据库创建脚本.sql @@ -0,0 +1,13 @@ +DROP DATBASE IF EXISTS mldn ; +CREATE DATBASE mldn CHARACTER SET UTF8 ; +USE mldn ; +CREATE TABLE dept ( + deptno BIGINT AUTO_INCREMENT , + dname VARCHAR(50) , + CONSTRAINT pk_deptno PRIMARY KEY(deptno) +) ; +INSERT INTO dept(dname) VALUES ('开发部') ; +INSERT INTO dept(dname) VALUES ('财务部') ; +INSERT INTO dept(dname) VALUES ('市场部') ; +INSERT INTO dept(dname) VALUES ('后勤部') ; +INSERT INTO dept(dname) VALUES ('公关部') ; \ No newline at end of file diff --git a/microboot-restful-provider/src/main/resources/application.yml b/microboot-restful-provider/src/main/resources/application.yml new file mode 100644 index 0000000..6fbc1f2 --- /dev/null +++ b/microboot-restful-provider/src/main/resources/application.yml @@ -0,0 +1,23 @@ +spring: + redis: + host: 192.168.68.166 + port: 6379 + password: mldnjava + timeout: 1000 + database: 0 + pool: + max-active: 10 + max-idle: 8 + min-idle: 2 + max-wait: 100 + redis-two: + host: 192.168.68.166 + port: 6380 + password: mldnjava + timeout: 1000 + database: 0 + pool: + max-active: 10 + max-idle: 8 + min-idle: 2 + max-wait: 100 \ No newline at end of file diff --git a/microboot-restful-provider/src/main/resources/i18n/Messages.properties b/microboot-restful-provider/src/main/resources/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-restful-provider/src/main/resources/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-restful-provider/src/main/resources/i18n/Pages.properties b/microboot-restful-provider/src/main/resources/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-restful-provider/src/main/resources/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-restful-provider/src/main/resources/logback.xml b/microboot-restful-provider/src/main/resources/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-restful-provider/src/main/resources/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-restful-provider/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml b/microboot-restful-provider/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml new file mode 100644 index 0000000..6557a3a --- /dev/null +++ b/microboot-restful-provider/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml @@ -0,0 +1,11 @@ + + + + + + INSERT INTO dept(dname) VALUES (#{dname}) ; + + diff --git a/microboot-restful-provider/src/main/resources/mybatis/mybatis.cfg.xml b/microboot-restful-provider/src/main/resources/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4d128c0 --- /dev/null +++ b/microboot-restful-provider/src/main/resources/mybatis/mybatis.cfg.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/microboot-restful-provider/src/main/view/static/images/mldn.ico b/microboot-restful-provider/src/main/view/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-restful-provider/src/main/view/static/images/mldn.ico differ diff --git a/microboot-restful-provider/src/main/view/static/info/message_info.html b/microboot-restful-provider/src/main/view/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-restful-provider/src/main/view/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-restful-provider/src/main/view/static/js/main.js b/microboot-restful-provider/src/main/view/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-restful-provider/src/main/view/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-restful-provider/src/main/view/static/message_index.html b/microboot-restful-provider/src/main/view/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-restful-provider/src/main/view/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-restful-provider/src/main/view/templates/upload_page.html b/microboot-restful-provider/src/main/view/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-restful-provider/src/main/view/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-restful-provider/src/main/view/templates/upload_show.html b/microboot-restful-provider/src/main/view/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-restful-provider/src/main/view/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-restful-provider/target/classes/META-INF/MANIFEST.MF b/microboot-restful-provider/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d4c16dd --- /dev/null +++ b/microboot-restful-provider/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Built-By: foreveriss +Build-Jdk: 1.8.0_121 +Created-By: Maven Integration for Eclipse + diff --git a/microboot-restful-provider/target/classes/META-INF/maven/cn.mldn/microboot-restful-provider/pom.properties b/microboot-restful-provider/target/classes/META-INF/maven/cn.mldn/microboot-restful-provider/pom.properties new file mode 100644 index 0000000..2155726 --- /dev/null +++ b/microboot-restful-provider/target/classes/META-INF/maven/cn.mldn/microboot-restful-provider/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Thu Jun 29 23:45:14 CST 2017 +version=0.0.1-SNAPSHOT +groupId=cn.mldn +m2e.projectName=microboot-restful-provider +m2e.projectLocation=/Users/foreveriss/workspace/microboot/microboot-restful-provider +artifactId=microboot-restful-provider diff --git a/microboot-restful-provider/target/classes/META-INF/maven/cn.mldn/microboot-restful-provider/pom.xml b/microboot-restful-provider/target/classes/META-INF/maven/cn.mldn/microboot-restful-provider/pom.xml new file mode 100644 index 0000000..1ea1efe --- /dev/null +++ b/microboot-restful-provider/target/classes/META-INF/maven/cn.mldn/microboot-restful-provider/pom.xml @@ -0,0 +1,79 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-restful-provider + microboot-restful-provider + http://maven.apache.org + + UTF-8 + + + + cn.mldn + microboot-restful-api + 0.0.1-SNAPSHOT + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + org.springframework.boot + spring-boot-starter-mail + + + + ch.qos.logback + logback-core + + + + org.springframework.kafka + spring-kafka + + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-restful-provider/target/classes/application.yml b/microboot-restful-provider/target/classes/application.yml new file mode 100644 index 0000000..6fbc1f2 --- /dev/null +++ b/microboot-restful-provider/target/classes/application.yml @@ -0,0 +1,23 @@ +spring: + redis: + host: 192.168.68.166 + port: 6379 + password: mldnjava + timeout: 1000 + database: 0 + pool: + max-active: 10 + max-idle: 8 + min-idle: 2 + max-wait: 100 + redis-two: + host: 192.168.68.166 + port: 6380 + password: mldnjava + timeout: 1000 + database: 0 + pool: + max-active: 10 + max-idle: 8 + min-idle: 2 + max-wait: 100 \ No newline at end of file diff --git a/microboot-restful-provider/target/classes/cn/mldn/microboot/StartSpringBootMain.class b/microboot-restful-provider/target/classes/cn/mldn/microboot/StartSpringBootMain.class new file mode 100644 index 0000000..18bb195 Binary files /dev/null and b/microboot-restful-provider/target/classes/cn/mldn/microboot/StartSpringBootMain.class differ diff --git a/microboot-restful-provider/target/classes/cn/mldn/microboot/controller/MemberController.class b/microboot-restful-provider/target/classes/cn/mldn/microboot/controller/MemberController.class new file mode 100644 index 0000000..edacc9d Binary files /dev/null and b/microboot-restful-provider/target/classes/cn/mldn/microboot/controller/MemberController.class differ diff --git a/microboot-restful-provider/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class b/microboot-restful-provider/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class new file mode 100644 index 0000000..e043da7 Binary files /dev/null and b/microboot-restful-provider/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class differ diff --git a/microboot-restful-provider/target/classes/i18n/Messages.properties b/microboot-restful-provider/target/classes/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-restful-provider/target/classes/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-restful-provider/target/classes/i18n/Pages.properties b/microboot-restful-provider/target/classes/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-restful-provider/target/classes/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-restful-provider/target/classes/logback.xml b/microboot-restful-provider/target/classes/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-restful-provider/target/classes/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-restful-provider/target/classes/mybatis/mapper/cn/mldn/Dept.xml b/microboot-restful-provider/target/classes/mybatis/mapper/cn/mldn/Dept.xml new file mode 100644 index 0000000..6557a3a --- /dev/null +++ b/microboot-restful-provider/target/classes/mybatis/mapper/cn/mldn/Dept.xml @@ -0,0 +1,11 @@ + + + + + + INSERT INTO dept(dname) VALUES (#{dname}) ; + + diff --git a/microboot-restful-provider/target/classes/mybatis/mybatis.cfg.xml b/microboot-restful-provider/target/classes/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4d128c0 --- /dev/null +++ b/microboot-restful-provider/target/classes/mybatis/mybatis.cfg.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/microboot-restful-provider/target/classes/static/images/mldn.ico b/microboot-restful-provider/target/classes/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-restful-provider/target/classes/static/images/mldn.ico differ diff --git a/microboot-restful-provider/target/classes/static/info/message_info.html b/microboot-restful-provider/target/classes/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-restful-provider/target/classes/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-restful-provider/target/classes/static/js/main.js b/microboot-restful-provider/target/classes/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-restful-provider/target/classes/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-restful-provider/target/classes/static/message_index.html b/microboot-restful-provider/target/classes/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-restful-provider/target/classes/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-restful-provider/target/classes/templates/upload_page.html b/microboot-restful-provider/target/classes/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-restful-provider/target/classes/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-restful-provider/target/classes/templates/upload_show.html b/microboot-restful-provider/target/classes/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-restful-provider/target/classes/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-restful-swagger/.classpath b/microboot-restful-swagger/.classpath new file mode 100644 index 0000000..a6f04e8 --- /dev/null +++ b/microboot-restful-swagger/.classpath @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/microboot-restful-swagger/.project b/microboot-restful-swagger/.project new file mode 100644 index 0000000..f1047e6 --- /dev/null +++ b/microboot-restful-swagger/.project @@ -0,0 +1,35 @@ + + + microboot-restful-swagger + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/microboot-restful-swagger/.settings/org.eclipse.core.resources.prefs b/microboot-restful-swagger/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..a6dcfb7 --- /dev/null +++ b/microboot-restful-swagger/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/main/view=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/microboot-restful-swagger/.settings/org.eclipse.jdt.core.prefs b/microboot-restful-swagger/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..d59e09c --- /dev/null +++ b/microboot-restful-swagger/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/microboot-restful-swagger/.settings/org.eclipse.m2e.core.prefs b/microboot-restful-swagger/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/microboot-restful-swagger/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/microboot-restful-swagger/.settings/org.eclipse.wst.common.project.facet.core.xml b/microboot-restful-swagger/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..e822977 --- /dev/null +++ b/microboot-restful-swagger/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ + + + + diff --git a/microboot-restful-swagger/pom.xml b/microboot-restful-swagger/pom.xml new file mode 100644 index 0000000..c19257a --- /dev/null +++ b/microboot-restful-swagger/pom.xml @@ -0,0 +1,91 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-restful-swagger + microboot-restful-swagger + http://maven.apache.org + + UTF-8 + + + + io.springfox + springfox-swagger2 + 2.7.0 + + + io.springfox + springfox-swagger-ui + 2.7.0 + + + + + cn.mldn + microboot-restful-api + 0.0.1-SNAPSHOT + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + org.springframework.boot + spring-boot-starter-mail + + + + ch.qos.logback + logback-core + + + + org.springframework.kafka + spring-kafka + + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-restful-swagger/src/main/java/cn/mldn/microboot/StartSpringBootMain.java b/microboot-restful-swagger/src/main/java/cn/mldn/microboot/StartSpringBootMain.java new file mode 100644 index 0000000..9e9a3d4 --- /dev/null +++ b/microboot-restful-swagger/src/main/java/cn/mldn/microboot/StartSpringBootMain.java @@ -0,0 +1,11 @@ +package cn.mldn.microboot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication // 启动SpringBoot程序,而后自带子包扫描 +public class StartSpringBootMain { + public static void main(String[] args) throws Exception { + SpringApplication.run(StartSpringBootMain.class, args); + } +} diff --git a/microboot-restful-swagger/src/main/java/cn/mldn/microboot/config/Swagger2Config.java b/microboot-restful-swagger/src/main/java/cn/mldn/microboot/config/Swagger2Config.java new file mode 100644 index 0000000..15bd1f2 --- /dev/null +++ b/microboot-restful-swagger/src/main/java/cn/mldn/microboot/config/Swagger2Config.java @@ -0,0 +1,31 @@ +package cn.mldn.microboot.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +@Configuration +@EnableSwagger2 +public class Swagger2Config { + @Bean + public Docket getDocket() { // 此类主要是整个的Swagger配置项,利用这个类需要来指派扫描包 + return new Docket(DocumentationType.SWAGGER_2) + .apiInfo(this.getApiInfo()).select() + .apis(RequestHandlerSelectors + .basePackage("cn.mldn.microboot.controller")) + .paths(PathSelectors.any()).build(); // 设置文档的显示类型 + } + private ApiInfo getApiInfo() { + return new ApiInfoBuilder().title("SpringBoot中使用Swagger构建项目说明信息") + .description("更多选择请关注www.mldn.cn") + .termsOfServiceUrl("http://www.mldn.cn").contact("MLDN小李同学-小衰哥") + .license("李兴华").version("1.0").build(); + } +} diff --git a/microboot-restful-swagger/src/main/java/cn/mldn/microboot/controller/MemberController.java b/microboot-restful-swagger/src/main/java/cn/mldn/microboot/controller/MemberController.java new file mode 100644 index 0000000..a7dc57a --- /dev/null +++ b/microboot-restful-swagger/src/main/java/cn/mldn/microboot/controller/MemberController.java @@ -0,0 +1,39 @@ +package cn.mldn.microboot.controller; + +import java.util.Date; + +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import cn.mldn.microboot.vo.Member; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; + +@RestController +public class MemberController { + @ApiOperation(value = "实现人员信息的添加处理", notes = "就是加人的,多么的简单") + @ApiImplicitParams({ + @ApiImplicitParam(name = "member", value = "用户描述的详细实体信息", required = true, dataType = "MemberClass")}) + @RequestMapping(value = "/member/add", method = RequestMethod.POST) + public Object add(@RequestBody Member member) { // 表示当前的配置可以直接将参数变为VO对象 + System.err.println("【MemberController.add()接收对象】" + member); + return true; + } + @ApiOperation(value = "获取指定编号的人员信息", notes = "只需要设置mid的信息就可以获取Member的完整内容") + @ApiImplicitParams({ + @ApiImplicitParam(name = "mid", value = "用户编号", required = true, dataType = "String")}) + @RequestMapping(value = "/member/get/{mid}", method = RequestMethod.GET) + public Member get(@PathVariable("mid") long mid) { + Member vo = new Member(); + vo.setMid(mid); + vo.setName("mldnjava - " + mid); + vo.setBirthday(new Date()); + vo.setSalary(99999.99); + vo.setAge(16); + return vo; + } +} diff --git a/microboot-restful-swagger/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java b/microboot-restful-swagger/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java new file mode 100644 index 0000000..6ee5c4a --- /dev/null +++ b/microboot-restful-swagger/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java @@ -0,0 +1,26 @@ +package cn.mldn.microboot.util.controller; + +import java.text.SimpleDateFormat; +import java.util.Locale; + +import javax.annotation.Resource; + +import org.springframework.beans.propertyeditors.CustomDateEditor; +import org.springframework.context.MessageSource; +import org.springframework.web.bind.WebDataBinder; +import org.springframework.web.bind.annotation.InitBinder; + +public abstract class AbstractBaseController { + @Resource + private MessageSource messageSource; // 自动注入此资源对象 + public String getMessage(String key, String... args) { + return this.messageSource.getMessage(key, args, Locale.getDefault()); + } + @InitBinder + public void initBinder(WebDataBinder binder) { // 在本程序里面需要针对于日期格式进行处理 + // 首先建立一个可以将字符串转换为日期的工具程序类 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd") ; + // 明确的描述此时需要注册一个日期格式的转化处理程序类 + binder.registerCustomEditor(java.util.Date.class, new CustomDateEditor(sdf, true)); + } +} diff --git a/microboot-restful-swagger/src/main/java/数据库创建脚本.sql b/microboot-restful-swagger/src/main/java/数据库创建脚本.sql new file mode 100644 index 0000000..edd35b2 --- /dev/null +++ b/microboot-restful-swagger/src/main/java/数据库创建脚本.sql @@ -0,0 +1,13 @@ +DROP DATBASE IF EXISTS mldn ; +CREATE DATBASE mldn CHARACTER SET UTF8 ; +USE mldn ; +CREATE TABLE dept ( + deptno BIGINT AUTO_INCREMENT , + dname VARCHAR(50) , + CONSTRAINT pk_deptno PRIMARY KEY(deptno) +) ; +INSERT INTO dept(dname) VALUES ('开发部') ; +INSERT INTO dept(dname) VALUES ('财务部') ; +INSERT INTO dept(dname) VALUES ('市场部') ; +INSERT INTO dept(dname) VALUES ('后勤部') ; +INSERT INTO dept(dname) VALUES ('公关部') ; \ No newline at end of file diff --git a/microboot-restful-swagger/src/main/resources/application.yml b/microboot-restful-swagger/src/main/resources/application.yml new file mode 100644 index 0000000..6fbc1f2 --- /dev/null +++ b/microboot-restful-swagger/src/main/resources/application.yml @@ -0,0 +1,23 @@ +spring: + redis: + host: 192.168.68.166 + port: 6379 + password: mldnjava + timeout: 1000 + database: 0 + pool: + max-active: 10 + max-idle: 8 + min-idle: 2 + max-wait: 100 + redis-two: + host: 192.168.68.166 + port: 6380 + password: mldnjava + timeout: 1000 + database: 0 + pool: + max-active: 10 + max-idle: 8 + min-idle: 2 + max-wait: 100 \ No newline at end of file diff --git a/microboot-restful-swagger/src/main/resources/i18n/Messages.properties b/microboot-restful-swagger/src/main/resources/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-restful-swagger/src/main/resources/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-restful-swagger/src/main/resources/i18n/Pages.properties b/microboot-restful-swagger/src/main/resources/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-restful-swagger/src/main/resources/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-restful-swagger/src/main/resources/logback.xml b/microboot-restful-swagger/src/main/resources/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-restful-swagger/src/main/resources/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-restful-swagger/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml b/microboot-restful-swagger/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml new file mode 100644 index 0000000..6557a3a --- /dev/null +++ b/microboot-restful-swagger/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml @@ -0,0 +1,11 @@ + + + + + + INSERT INTO dept(dname) VALUES (#{dname}) ; + + diff --git a/microboot-restful-swagger/src/main/resources/mybatis/mybatis.cfg.xml b/microboot-restful-swagger/src/main/resources/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4d128c0 --- /dev/null +++ b/microboot-restful-swagger/src/main/resources/mybatis/mybatis.cfg.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/microboot-restful-swagger/src/main/view/static/images/mldn.ico b/microboot-restful-swagger/src/main/view/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-restful-swagger/src/main/view/static/images/mldn.ico differ diff --git a/microboot-restful-swagger/src/main/view/static/info/message_info.html b/microboot-restful-swagger/src/main/view/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-restful-swagger/src/main/view/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-restful-swagger/src/main/view/static/js/main.js b/microboot-restful-swagger/src/main/view/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-restful-swagger/src/main/view/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-restful-swagger/src/main/view/static/message_index.html b/microboot-restful-swagger/src/main/view/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-restful-swagger/src/main/view/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-restful-swagger/src/main/view/templates/upload_page.html b/microboot-restful-swagger/src/main/view/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-restful-swagger/src/main/view/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-restful-swagger/src/main/view/templates/upload_show.html b/microboot-restful-swagger/src/main/view/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-restful-swagger/src/main/view/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-restful-swagger/target/classes/META-INF/MANIFEST.MF b/microboot-restful-swagger/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d4c16dd --- /dev/null +++ b/microboot-restful-swagger/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Built-By: foreveriss +Build-Jdk: 1.8.0_121 +Created-By: Maven Integration for Eclipse + diff --git a/microboot-restful-swagger/target/classes/META-INF/maven/cn.mldn/microboot-restful-swagger/pom.properties b/microboot-restful-swagger/target/classes/META-INF/maven/cn.mldn/microboot-restful-swagger/pom.properties new file mode 100644 index 0000000..22d4d64 --- /dev/null +++ b/microboot-restful-swagger/target/classes/META-INF/maven/cn.mldn/microboot-restful-swagger/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Thu Jun 29 23:45:16 CST 2017 +version=0.0.1-SNAPSHOT +groupId=cn.mldn +m2e.projectName=microboot-restful-swagger +m2e.projectLocation=/Users/foreveriss/workspace/microboot/microboot-restful-swagger +artifactId=microboot-restful-swagger diff --git a/microboot-restful-swagger/target/classes/META-INF/maven/cn.mldn/microboot-restful-swagger/pom.xml b/microboot-restful-swagger/target/classes/META-INF/maven/cn.mldn/microboot-restful-swagger/pom.xml new file mode 100644 index 0000000..c19257a --- /dev/null +++ b/microboot-restful-swagger/target/classes/META-INF/maven/cn.mldn/microboot-restful-swagger/pom.xml @@ -0,0 +1,91 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-restful-swagger + microboot-restful-swagger + http://maven.apache.org + + UTF-8 + + + + io.springfox + springfox-swagger2 + 2.7.0 + + + io.springfox + springfox-swagger-ui + 2.7.0 + + + + + cn.mldn + microboot-restful-api + 0.0.1-SNAPSHOT + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + org.springframework.boot + spring-boot-starter-mail + + + + ch.qos.logback + logback-core + + + + org.springframework.kafka + spring-kafka + + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-restful-swagger/target/classes/application.yml b/microboot-restful-swagger/target/classes/application.yml new file mode 100644 index 0000000..6fbc1f2 --- /dev/null +++ b/microboot-restful-swagger/target/classes/application.yml @@ -0,0 +1,23 @@ +spring: + redis: + host: 192.168.68.166 + port: 6379 + password: mldnjava + timeout: 1000 + database: 0 + pool: + max-active: 10 + max-idle: 8 + min-idle: 2 + max-wait: 100 + redis-two: + host: 192.168.68.166 + port: 6380 + password: mldnjava + timeout: 1000 + database: 0 + pool: + max-active: 10 + max-idle: 8 + min-idle: 2 + max-wait: 100 \ No newline at end of file diff --git a/microboot-restful-swagger/target/classes/cn/mldn/microboot/StartSpringBootMain.class b/microboot-restful-swagger/target/classes/cn/mldn/microboot/StartSpringBootMain.class new file mode 100644 index 0000000..eb9ab34 Binary files /dev/null and b/microboot-restful-swagger/target/classes/cn/mldn/microboot/StartSpringBootMain.class differ diff --git a/microboot-restful-swagger/target/classes/cn/mldn/microboot/config/Swagger2Config.class b/microboot-restful-swagger/target/classes/cn/mldn/microboot/config/Swagger2Config.class new file mode 100644 index 0000000..c2fdddd Binary files /dev/null and b/microboot-restful-swagger/target/classes/cn/mldn/microboot/config/Swagger2Config.class differ diff --git a/microboot-restful-swagger/target/classes/cn/mldn/microboot/controller/MemberController.class b/microboot-restful-swagger/target/classes/cn/mldn/microboot/controller/MemberController.class new file mode 100644 index 0000000..8d0215e Binary files /dev/null and b/microboot-restful-swagger/target/classes/cn/mldn/microboot/controller/MemberController.class differ diff --git a/microboot-restful-swagger/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class b/microboot-restful-swagger/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class new file mode 100644 index 0000000..e043da7 Binary files /dev/null and b/microboot-restful-swagger/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class differ diff --git a/microboot-restful-swagger/target/classes/i18n/Messages.properties b/microboot-restful-swagger/target/classes/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-restful-swagger/target/classes/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-restful-swagger/target/classes/i18n/Pages.properties b/microboot-restful-swagger/target/classes/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-restful-swagger/target/classes/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-restful-swagger/target/classes/logback.xml b/microboot-restful-swagger/target/classes/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-restful-swagger/target/classes/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-restful-swagger/target/classes/mybatis/mapper/cn/mldn/Dept.xml b/microboot-restful-swagger/target/classes/mybatis/mapper/cn/mldn/Dept.xml new file mode 100644 index 0000000..6557a3a --- /dev/null +++ b/microboot-restful-swagger/target/classes/mybatis/mapper/cn/mldn/Dept.xml @@ -0,0 +1,11 @@ + + + + + + INSERT INTO dept(dname) VALUES (#{dname}) ; + + diff --git a/microboot-restful-swagger/target/classes/mybatis/mybatis.cfg.xml b/microboot-restful-swagger/target/classes/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4d128c0 --- /dev/null +++ b/microboot-restful-swagger/target/classes/mybatis/mybatis.cfg.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/microboot-restful-swagger/target/classes/static/images/mldn.ico b/microboot-restful-swagger/target/classes/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-restful-swagger/target/classes/static/images/mldn.ico differ diff --git a/microboot-restful-swagger/target/classes/static/info/message_info.html b/microboot-restful-swagger/target/classes/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-restful-swagger/target/classes/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-restful-swagger/target/classes/static/js/main.js b/microboot-restful-swagger/target/classes/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-restful-swagger/target/classes/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-restful-swagger/target/classes/static/message_index.html b/microboot-restful-swagger/target/classes/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-restful-swagger/target/classes/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-restful-swagger/target/classes/templates/upload_page.html b/microboot-restful-swagger/target/classes/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-restful-swagger/target/classes/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-restful-swagger/target/classes/templates/upload_show.html b/microboot-restful-swagger/target/classes/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-restful-swagger/target/classes/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-shiro-api/.classpath b/microboot-shiro-api/.classpath new file mode 100644 index 0000000..a6f04e8 --- /dev/null +++ b/microboot-shiro-api/.classpath @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/microboot-shiro-api/.project b/microboot-shiro-api/.project new file mode 100644 index 0000000..2e2dc15 --- /dev/null +++ b/microboot-shiro-api/.project @@ -0,0 +1,35 @@ + + + microboot-shiro-api + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/microboot-shiro-api/.settings/org.eclipse.core.resources.prefs b/microboot-shiro-api/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..a6dcfb7 --- /dev/null +++ b/microboot-shiro-api/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/main/view=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/microboot-shiro-api/.settings/org.eclipse.jdt.core.prefs b/microboot-shiro-api/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..d59e09c --- /dev/null +++ b/microboot-shiro-api/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/microboot-shiro-api/.settings/org.eclipse.m2e.core.prefs b/microboot-shiro-api/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/microboot-shiro-api/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/microboot-shiro-api/.settings/org.eclipse.wst.common.project.facet.core.xml b/microboot-shiro-api/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..e822977 --- /dev/null +++ b/microboot-shiro-api/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ + + + + diff --git a/microboot-shiro-api/.springBeans b/microboot-shiro-api/.springBeans new file mode 100644 index 0000000..4a14589 --- /dev/null +++ b/microboot-shiro-api/.springBeans @@ -0,0 +1,15 @@ + + + 1 + + + + + + + + + + + + diff --git a/microboot-shiro-api/pom.xml b/microboot-shiro-api/pom.xml new file mode 100644 index 0000000..c9718fa --- /dev/null +++ b/microboot-shiro-api/pom.xml @@ -0,0 +1,73 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-shiro-api + microboot-shiro-api + http://maven.apache.org + + UTF-8 + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + org.springframework.boot + spring-boot-starter-mail + + + + ch.qos.logback + logback-core + + + + org.springframework.kafka + spring-kafka + + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-shiro-api/src/main/java/cn/mldn/util/enctype/MD5Code.java b/microboot-shiro-api/src/main/java/cn/mldn/util/enctype/MD5Code.java new file mode 100644 index 0000000..e7eb280 --- /dev/null +++ b/microboot-shiro-api/src/main/java/cn/mldn/util/enctype/MD5Code.java @@ -0,0 +1,336 @@ +package cn.mldn.util.enctype; + +public class MD5Code { + /* + * 下面这些S11-S44实际上是一个4*4的矩阵,在原始的C实现中是用#define 实现的, 这里把它们实现成为static + * final是表示了只读,切能在同一个进程空间内的多个 Instance间共享 + */ + static final int S11 = 7; + + static final int S12 = 12; + + static final int S13 = 17; + + static final int S14 = 22; + + static final int S21 = 5; + + static final int S22 = 9; + + static final int S23 = 14; + + static final int S24 = 20; + + static final int S31 = 4; + + static final int S32 = 11; + + static final int S33 = 16; + + static final int S34 = 23; + + static final int S41 = 6; + + static final int S42 = 10; + + static final int S43 = 15; + + static final int S44 = 21; + + static final byte[] PADDING = { -128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 }; + + /* + * 下面的三个成员是MD5计算过程中用到的3个核心数据,在原始的C实现中 被定义到MD5_CTX结构中 + */ + private long[] state = new long[4];// state (ABCD) + + private long[] count = new long[2];// number of bits, modulo 2^64 (lsb + + // first) + + private byte[] buffer = new byte[64]; // input buffer + + /* + * digestHexStr是MD5的唯一一个公共成员,是最新一次计算结果的 16进制ASCII表示. + */ + + public String digestHexStr; + + /* + * digest,是最新一次计算结果的2进制内部表示,表示128bit的MD5值. + */ + private byte[] digest = new byte[16]; + + /* + * getMD5ofStr是类MD5最主要的公共方法,入口参数是你想要进行MD5变换的字符串 + * 返回的是变换完的结果,这个结果是从公共成员digestHexStr取得的. + */ + public String getMD5ofStr(String inbuf) { + md5Init(); + md5Update(inbuf.getBytes(), inbuf.length()); + md5Final(); + digestHexStr = ""; + for (int i = 0; i < 16; i++) { + digestHexStr += byteHEX(digest[i]); + } + return digestHexStr; + } + + // 这是MD5这个类的标准构造函数,JavaBean要求有一个public的并且没有参数的构造函数 + public MD5Code() { + md5Init(); + return; + } + + /* md5Init是一个初始化函数,初始化核心变量,装入标准的幻数 */ + private void md5Init() { + count[0] = 0L; + count[1] = 0L; + // /* Load magic initialization constants. + state[0] = 0x67452301L; + state[1] = 0xefcdab89L; + state[2] = 0x98badcfeL; + state[3] = 0x10325476L; + return; + } + + /* + * F, G, H ,I 是4个基本的MD5函数,在原始的MD5的C实现中,由于它们是 + * 简单的位运算,可能出于效率的考虑把它们实现成了宏,在java中,我们把它们 实现成了private方法,名字保持了原来C中的。 + */ + private long F(long x, long y, long z) { + return (x & y) | ((~x) & z); + } + + private long G(long x, long y, long z) { + return (x & z) | (y & (~z)); + } + + private long H(long x, long y, long z) { + return x ^ y ^ z; + } + + private long I(long x, long y, long z) { + return y ^ (x | (~z)); + } + + /* + * FF,GG,HH和II将调用F,G,H,I进行近一步变换 FF, GG, HH, and II transformations for + * rounds 1, 2, 3, and 4. Rotation is separate from addition to prevent + * recomputation. + */ + private long FF(long a, long b, long c, long d, long x, long s, long ac) { + a += F(b, c, d) + x + ac; + a = ((int) a << s) | ((int) a >>> (32 - s)); + a += b; + return a; + } + + private long GG(long a, long b, long c, long d, long x, long s, long ac) { + a += G(b, c, d) + x + ac; + a = ((int) a << s) | ((int) a >>> (32 - s)); + a += b; + return a; + } + + private long HH(long a, long b, long c, long d, long x, long s, long ac) { + a += H(b, c, d) + x + ac; + a = ((int) a << s) | ((int) a >>> (32 - s)); + a += b; + return a; + } + + private long II(long a, long b, long c, long d, long x, long s, long ac) { + a += I(b, c, d) + x + ac; + a = ((int) a << s) | ((int) a >>> (32 - s)); + a += b; + return a; + } + + /* + * md5Update是MD5的主计算过程,inbuf是要变换的字节串,inputlen是长度,这个 + * 函数由getMD5ofStr调用,调用之前需要调用md5init,因此把它设计成private的 + */ + private void md5Update(byte[] inbuf, int inputLen) { + int i, index, partLen; + byte[] block = new byte[64]; + index = (int) (count[0] >>> 3) & 0x3F; + // /* Update number of bits */ + if ((count[0] += (inputLen << 3)) < (inputLen << 3)) + count[1]++; + count[1] += (inputLen >>> 29); + partLen = 64 - index; + // Transform as many times as possible. + if (inputLen >= partLen) { + md5Memcpy(buffer, inbuf, index, 0, partLen); + md5Transform(buffer); + for (i = partLen; i + 63 < inputLen; i += 64) { + md5Memcpy(block, inbuf, 0, i, 64); + md5Transform(block); + } + index = 0; + } else + i = 0; + // /* Buffer remaining input */ + md5Memcpy(buffer, inbuf, index, i, inputLen - i); + } + + /* + * md5Final整理和填写输出结果 + */ + private void md5Final() { + byte[] bits = new byte[8]; + int index, padLen; + // /* Save number of bits */ + Encode(bits, count, 8); + // /* Pad out to 56 mod 64. + index = (int) (count[0] >>> 3) & 0x3f; + padLen = (index < 56) ? (56 - index) : (120 - index); + md5Update(PADDING, padLen); + // /* Append length (before padding) */ + md5Update(bits, 8); + // /* Store state in digest */ + Encode(digest, state, 16); + } + + /* + * md5Memcpy是一个内部使用的byte数组的块拷贝函数,从input的inpos开始把len长度的 + * 字节拷贝到output的outpos位置开始 + */ + private void md5Memcpy(byte[] output, byte[] input, int outpos, int inpos, + int len) { + int i; + for (i = 0; i < len; i++) + output[outpos + i] = input[inpos + i]; + } + + /* + * md5Transform是MD5核心变换程序,有md5Update调用,block是分块的原始字节 + */ + private void md5Transform(byte block[]) { + long a = state[0], b = state[1], c = state[2], d = state[3]; + long[] x = new long[16]; + Decode(x, block, 64); + /* Round 1 */ + a = FF(a, b, c, d, x[0], S11, 0xd76aa478L); /* 1 */ + d = FF(d, a, b, c, x[1], S12, 0xe8c7b756L); /* 2 */ + c = FF(c, d, a, b, x[2], S13, 0x242070dbL); /* 3 */ + b = FF(b, c, d, a, x[3], S14, 0xc1bdceeeL); /* 4 */ + a = FF(a, b, c, d, x[4], S11, 0xf57c0fafL); /* 5 */ + d = FF(d, a, b, c, x[5], S12, 0x4787c62aL); /* 6 */ + c = FF(c, d, a, b, x[6], S13, 0xa8304613L); /* 7 */ + b = FF(b, c, d, a, x[7], S14, 0xfd469501L); /* 8 */ + a = FF(a, b, c, d, x[8], S11, 0x698098d8L); /* 9 */ + d = FF(d, a, b, c, x[9], S12, 0x8b44f7afL); /* 10 */ + c = FF(c, d, a, b, x[10], S13, 0xffff5bb1L); /* 11 */ + b = FF(b, c, d, a, x[11], S14, 0x895cd7beL); /* 12 */ + a = FF(a, b, c, d, x[12], S11, 0x6b901122L); /* 13 */ + d = FF(d, a, b, c, x[13], S12, 0xfd987193L); /* 14 */ + c = FF(c, d, a, b, x[14], S13, 0xa679438eL); /* 15 */ + b = FF(b, c, d, a, x[15], S14, 0x49b40821L); /* 16 */ + /* Round 2 */ + a = GG(a, b, c, d, x[1], S21, 0xf61e2562L); /* 17 */ + d = GG(d, a, b, c, x[6], S22, 0xc040b340L); /* 18 */ + c = GG(c, d, a, b, x[11], S23, 0x265e5a51L); /* 19 */ + b = GG(b, c, d, a, x[0], S24, 0xe9b6c7aaL); /* 20 */ + a = GG(a, b, c, d, x[5], S21, 0xd62f105dL); /* 21 */ + d = GG(d, a, b, c, x[10], S22, 0x2441453L); /* 22 */ + c = GG(c, d, a, b, x[15], S23, 0xd8a1e681L); /* 23 */ + b = GG(b, c, d, a, x[4], S24, 0xe7d3fbc8L); /* 24 */ + a = GG(a, b, c, d, x[9], S21, 0x21e1cde6L); /* 25 */ + d = GG(d, a, b, c, x[14], S22, 0xc33707d6L); /* 26 */ + c = GG(c, d, a, b, x[3], S23, 0xf4d50d87L); /* 27 */ + b = GG(b, c, d, a, x[8], S24, 0x455a14edL); /* 28 */ + a = GG(a, b, c, d, x[13], S21, 0xa9e3e905L); /* 29 */ + d = GG(d, a, b, c, x[2], S22, 0xfcefa3f8L); /* 30 */ + c = GG(c, d, a, b, x[7], S23, 0x676f02d9L); /* 31 */ + b = GG(b, c, d, a, x[12], S24, 0x8d2a4c8aL); /* 32 */ + /* Round 3 */ + a = HH(a, b, c, d, x[5], S31, 0xfffa3942L); /* 33 */ + d = HH(d, a, b, c, x[8], S32, 0x8771f681L); /* 34 */ + c = HH(c, d, a, b, x[11], S33, 0x6d9d6122L); /* 35 */ + b = HH(b, c, d, a, x[14], S34, 0xfde5380cL); /* 36 */ + a = HH(a, b, c, d, x[1], S31, 0xa4beea44L); /* 37 */ + d = HH(d, a, b, c, x[4], S32, 0x4bdecfa9L); /* 38 */ + c = HH(c, d, a, b, x[7], S33, 0xf6bb4b60L); /* 39 */ + b = HH(b, c, d, a, x[10], S34, 0xbebfbc70L); /* 40 */ + a = HH(a, b, c, d, x[13], S31, 0x289b7ec6L); /* 41 */ + d = HH(d, a, b, c, x[0], S32, 0xeaa127faL); /* 42 */ + c = HH(c, d, a, b, x[3], S33, 0xd4ef3085L); /* 43 */ + b = HH(b, c, d, a, x[6], S34, 0x4881d05L); /* 44 */ + a = HH(a, b, c, d, x[9], S31, 0xd9d4d039L); /* 45 */ + d = HH(d, a, b, c, x[12], S32, 0xe6db99e5L); /* 46 */ + c = HH(c, d, a, b, x[15], S33, 0x1fa27cf8L); /* 47 */ + b = HH(b, c, d, a, x[2], S34, 0xc4ac5665L); /* 48 */ + /* Round 4 */ + a = II(a, b, c, d, x[0], S41, 0xf4292244L); /* 49 */ + d = II(d, a, b, c, x[7], S42, 0x432aff97L); /* 50 */ + c = II(c, d, a, b, x[14], S43, 0xab9423a7L); /* 51 */ + b = II(b, c, d, a, x[5], S44, 0xfc93a039L); /* 52 */ + a = II(a, b, c, d, x[12], S41, 0x655b59c3L); /* 53 */ + d = II(d, a, b, c, x[3], S42, 0x8f0ccc92L); /* 54 */ + c = II(c, d, a, b, x[10], S43, 0xffeff47dL); /* 55 */ + b = II(b, c, d, a, x[1], S44, 0x85845dd1L); /* 56 */ + a = II(a, b, c, d, x[8], S41, 0x6fa87e4fL); /* 57 */ + d = II(d, a, b, c, x[15], S42, 0xfe2ce6e0L); /* 58 */ + c = II(c, d, a, b, x[6], S43, 0xa3014314L); /* 59 */ + b = II(b, c, d, a, x[13], S44, 0x4e0811a1L); /* 60 */ + a = II(a, b, c, d, x[4], S41, 0xf7537e82L); /* 61 */ + d = II(d, a, b, c, x[11], S42, 0xbd3af235L); /* 62 */ + c = II(c, d, a, b, x[2], S43, 0x2ad7d2bbL); /* 63 */ + b = II(b, c, d, a, x[9], S44, 0xeb86d391L); /* 64 */ + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + } + + /* + * Encode把long数组按顺序拆成byte数组,因为java的long类型是64bit的, 只拆低32bit,以适应原始C实现的用途 + */ + private void Encode(byte[] output, long[] input, int len) { + int i, j; + for (i = 0, j = 0; j < len; i++, j += 4) { + output[j] = (byte) (input[i] & 0xffL); + output[j + 1] = (byte) ((input[i] >>> 8) & 0xffL); + output[j + 2] = (byte) ((input[i] >>> 16) & 0xffL); + output[j + 3] = (byte) ((input[i] >>> 24) & 0xffL); + } + } + + /* + * Decode把byte数组按顺序合成成long数组,因为java的long类型是64bit的, + * 只合成低32bit,高32bit清零,以适应原始C实现的用途 + */ + private void Decode(long[] output, byte[] input, int len) { + int i, j; + for (i = 0, j = 0; j < len; i++, j += 4) + output[i] = b2iu(input[j]) | (b2iu(input[j + 1]) << 8) + | (b2iu(input[j + 2]) << 16) | (b2iu(input[j + 3]) << 24); + return; + } + + /* + * b2iu是我写的一个把byte按照不考虑正负号的原则的"升位"程序,因为java没有unsigned运算 + */ + public static long b2iu(byte b) { + return b < 0 ? b & 0x7F + 128 : b; + } + + /* + * byteHEX(),用来把一个byte类型的数转换成十六进制的ASCII表示, + * 因为java中的byte的toString无法实现这一点,我们又没有C语言中的 sprintf(outbuf,"%02X",ib) + */ + public static String byteHEX(byte ib) { + char[] Digit = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', + 'B', 'C', 'D', 'E', 'F' }; + char[] ob = new char[2]; + ob[0] = Digit[(ib >>> 4) & 0X0F]; + ob[1] = Digit[ib & 0X0F]; + String s = new String(ob); + return s; + } +} diff --git a/microboot-shiro-api/src/main/java/cn/mldn/util/enctype/PasswordUtil.java b/microboot-shiro-api/src/main/java/cn/mldn/util/enctype/PasswordUtil.java new file mode 100644 index 0000000..1537812 --- /dev/null +++ b/microboot-shiro-api/src/main/java/cn/mldn/util/enctype/PasswordUtil.java @@ -0,0 +1,29 @@ +package cn.mldn.util.enctype; + +import java.util.Base64; + +public class PasswordUtil { + private static final String SEED = "mldnjava" ; // 该数据为种子数,如果要加密则需要使用Base64做多次迭代 + private static final int NE_NUM = 3 ; // 密码迭代处理3次 + private PasswordUtil() {} + private static String createSeed() { // 创建一个基于Base64的种子数 + String str = SEED ; + for (int x = 0 ; x < NE_NUM ; x ++) { + str = Base64.getEncoder().encodeToString(str.getBytes()) ; + } + return str ; + } + /** + * 进行密码的处理操作 + * @param password 用户输入的真实密码 + * @return 与数据库保存匹配的加密的处理密码 + */ + public static String getPassword(String password) { + MD5Code md5 = new MD5Code() ; + String pass = "{" + password + ":" + createSeed() + "}"; + for (int x = 0 ; x < NE_NUM ; x ++) { + pass = md5.getMD5ofStr(pass) ; + } + return pass ; + } +} diff --git a/microboot-shiro-api/src/main/java/cn/mldn/vo/Member.java b/microboot-shiro-api/src/main/java/cn/mldn/vo/Member.java new file mode 100644 index 0000000..5bb7d0a --- /dev/null +++ b/microboot-shiro-api/src/main/java/cn/mldn/vo/Member.java @@ -0,0 +1,40 @@ +package cn.mldn.vo; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class Member implements Serializable { + private String mid ; + private String name ; + private String password ; + private Integer locked ; + public String getMid() { + return mid; + } + public void setMid(String mid) { + this.mid = mid; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getPassword() { + return password; + } + public void setPassword(String password) { + this.password = password; + } + public Integer getLocked() { + return locked; + } + public void setLocked(Integer locked) { + this.locked = locked; + } + @Override + public String toString() { + return "Member [mid=" + mid + ", name=" + name + ", password=" + + password + ", locked=" + locked + "]"; + } +} diff --git a/microboot-shiro-api/src/main/resources/application.yml b/microboot-shiro-api/src/main/resources/application.yml new file mode 100644 index 0000000..6fbc1f2 --- /dev/null +++ b/microboot-shiro-api/src/main/resources/application.yml @@ -0,0 +1,23 @@ +spring: + redis: + host: 192.168.68.166 + port: 6379 + password: mldnjava + timeout: 1000 + database: 0 + pool: + max-active: 10 + max-idle: 8 + min-idle: 2 + max-wait: 100 + redis-two: + host: 192.168.68.166 + port: 6380 + password: mldnjava + timeout: 1000 + database: 0 + pool: + max-active: 10 + max-idle: 8 + min-idle: 2 + max-wait: 100 \ No newline at end of file diff --git a/microboot-shiro-api/src/main/resources/i18n/Messages.properties b/microboot-shiro-api/src/main/resources/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-shiro-api/src/main/resources/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-shiro-api/src/main/resources/i18n/Pages.properties b/microboot-shiro-api/src/main/resources/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-shiro-api/src/main/resources/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-shiro-api/src/main/resources/logback.xml b/microboot-shiro-api/src/main/resources/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-shiro-api/src/main/resources/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-shiro-api/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml b/microboot-shiro-api/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml new file mode 100644 index 0000000..6557a3a --- /dev/null +++ b/microboot-shiro-api/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml @@ -0,0 +1,11 @@ + + + + + + INSERT INTO dept(dname) VALUES (#{dname}) ; + + diff --git a/microboot-shiro-api/src/main/resources/mybatis/mybatis.cfg.xml b/microboot-shiro-api/src/main/resources/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4d128c0 --- /dev/null +++ b/microboot-shiro-api/src/main/resources/mybatis/mybatis.cfg.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/microboot-shiro-api/src/main/view/static/images/mldn.ico b/microboot-shiro-api/src/main/view/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-shiro-api/src/main/view/static/images/mldn.ico differ diff --git a/microboot-shiro-api/src/main/view/static/info/message_info.html b/microboot-shiro-api/src/main/view/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-shiro-api/src/main/view/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-shiro-api/src/main/view/static/js/main.js b/microboot-shiro-api/src/main/view/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-shiro-api/src/main/view/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-shiro-api/src/main/view/static/message_index.html b/microboot-shiro-api/src/main/view/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-shiro-api/src/main/view/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-shiro-api/src/main/view/templates/upload_page.html b/microboot-shiro-api/src/main/view/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-shiro-api/src/main/view/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-shiro-api/src/main/view/templates/upload_show.html b/microboot-shiro-api/src/main/view/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-shiro-api/src/main/view/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-shiro-api/target/classes/META-INF/MANIFEST.MF b/microboot-shiro-api/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d4c16dd --- /dev/null +++ b/microboot-shiro-api/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Built-By: foreveriss +Build-Jdk: 1.8.0_121 +Created-By: Maven Integration for Eclipse + diff --git a/microboot-shiro-api/target/classes/META-INF/maven/cn.mldn/microboot-shiro-api/pom.properties b/microboot-shiro-api/target/classes/META-INF/maven/cn.mldn/microboot-shiro-api/pom.properties new file mode 100644 index 0000000..c1e3a6a --- /dev/null +++ b/microboot-shiro-api/target/classes/META-INF/maven/cn.mldn/microboot-shiro-api/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Thu Jun 29 23:45:16 CST 2017 +version=0.0.1-SNAPSHOT +groupId=cn.mldn +m2e.projectName=microboot-shiro-api +m2e.projectLocation=/Users/foreveriss/workspace/microboot/microboot-shiro-api +artifactId=microboot-shiro-api diff --git a/microboot-shiro-api/target/classes/META-INF/maven/cn.mldn/microboot-shiro-api/pom.xml b/microboot-shiro-api/target/classes/META-INF/maven/cn.mldn/microboot-shiro-api/pom.xml new file mode 100644 index 0000000..c9718fa --- /dev/null +++ b/microboot-shiro-api/target/classes/META-INF/maven/cn.mldn/microboot-shiro-api/pom.xml @@ -0,0 +1,73 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-shiro-api + microboot-shiro-api + http://maven.apache.org + + UTF-8 + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + org.springframework.boot + spring-boot-starter-mail + + + + ch.qos.logback + logback-core + + + + org.springframework.kafka + spring-kafka + + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-shiro-api/target/classes/application.yml b/microboot-shiro-api/target/classes/application.yml new file mode 100644 index 0000000..6fbc1f2 --- /dev/null +++ b/microboot-shiro-api/target/classes/application.yml @@ -0,0 +1,23 @@ +spring: + redis: + host: 192.168.68.166 + port: 6379 + password: mldnjava + timeout: 1000 + database: 0 + pool: + max-active: 10 + max-idle: 8 + min-idle: 2 + max-wait: 100 + redis-two: + host: 192.168.68.166 + port: 6380 + password: mldnjava + timeout: 1000 + database: 0 + pool: + max-active: 10 + max-idle: 8 + min-idle: 2 + max-wait: 100 \ No newline at end of file diff --git a/microboot-shiro-api/target/classes/cn/mldn/util/enctype/MD5Code.class b/microboot-shiro-api/target/classes/cn/mldn/util/enctype/MD5Code.class new file mode 100644 index 0000000..724b9c0 Binary files /dev/null and b/microboot-shiro-api/target/classes/cn/mldn/util/enctype/MD5Code.class differ diff --git a/microboot-shiro-api/target/classes/cn/mldn/util/enctype/PasswordUtil.class b/microboot-shiro-api/target/classes/cn/mldn/util/enctype/PasswordUtil.class new file mode 100644 index 0000000..ae15a99 Binary files /dev/null and b/microboot-shiro-api/target/classes/cn/mldn/util/enctype/PasswordUtil.class differ diff --git a/microboot-shiro-api/target/classes/cn/mldn/vo/Member.class b/microboot-shiro-api/target/classes/cn/mldn/vo/Member.class new file mode 100644 index 0000000..b8cc6dd Binary files /dev/null and b/microboot-shiro-api/target/classes/cn/mldn/vo/Member.class differ diff --git a/microboot-shiro-api/target/classes/i18n/Messages.properties b/microboot-shiro-api/target/classes/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-shiro-api/target/classes/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-shiro-api/target/classes/i18n/Pages.properties b/microboot-shiro-api/target/classes/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-shiro-api/target/classes/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-shiro-api/target/classes/logback.xml b/microboot-shiro-api/target/classes/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-shiro-api/target/classes/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-shiro-api/target/classes/mybatis/mapper/cn/mldn/Dept.xml b/microboot-shiro-api/target/classes/mybatis/mapper/cn/mldn/Dept.xml new file mode 100644 index 0000000..6557a3a --- /dev/null +++ b/microboot-shiro-api/target/classes/mybatis/mapper/cn/mldn/Dept.xml @@ -0,0 +1,11 @@ + + + + + + INSERT INTO dept(dname) VALUES (#{dname}) ; + + diff --git a/microboot-shiro-api/target/classes/mybatis/mybatis.cfg.xml b/microboot-shiro-api/target/classes/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4d128c0 --- /dev/null +++ b/microboot-shiro-api/target/classes/mybatis/mybatis.cfg.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/microboot-shiro-api/target/classes/static/images/mldn.ico b/microboot-shiro-api/target/classes/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-shiro-api/target/classes/static/images/mldn.ico differ diff --git a/microboot-shiro-api/target/classes/static/info/message_info.html b/microboot-shiro-api/target/classes/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-shiro-api/target/classes/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-shiro-api/target/classes/static/js/main.js b/microboot-shiro-api/target/classes/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-shiro-api/target/classes/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-shiro-api/target/classes/static/message_index.html b/microboot-shiro-api/target/classes/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-shiro-api/target/classes/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-shiro-api/target/classes/templates/upload_page.html b/microboot-shiro-api/target/classes/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-shiro-api/target/classes/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-shiro-api/target/classes/templates/upload_show.html b/microboot-shiro-api/target/classes/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-shiro-api/target/classes/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-shiro-member-provider/.classpath b/microboot-shiro-member-provider/.classpath new file mode 100644 index 0000000..a6f04e8 --- /dev/null +++ b/microboot-shiro-member-provider/.classpath @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/microboot-shiro-member-provider/.project b/microboot-shiro-member-provider/.project new file mode 100644 index 0000000..85762c7 --- /dev/null +++ b/microboot-shiro-member-provider/.project @@ -0,0 +1,35 @@ + + + microboot-shiro-member-provider + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/microboot-shiro-member-provider/.settings/org.eclipse.core.resources.prefs b/microboot-shiro-member-provider/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..a6dcfb7 --- /dev/null +++ b/microboot-shiro-member-provider/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/main/view=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/microboot-shiro-member-provider/.settings/org.eclipse.jdt.core.prefs b/microboot-shiro-member-provider/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..d59e09c --- /dev/null +++ b/microboot-shiro-member-provider/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/microboot-shiro-member-provider/.settings/org.eclipse.m2e.core.prefs b/microboot-shiro-member-provider/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/microboot-shiro-member-provider/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/microboot-shiro-member-provider/.settings/org.eclipse.wst.common.project.facet.core.xml b/microboot-shiro-member-provider/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..e822977 --- /dev/null +++ b/microboot-shiro-member-provider/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ + + + + diff --git a/microboot-shiro-member-provider/.springBeans b/microboot-shiro-member-provider/.springBeans new file mode 100644 index 0000000..72bee1c --- /dev/null +++ b/microboot-shiro-member-provider/.springBeans @@ -0,0 +1,16 @@ + + + 1 + + + + + + + java:cn.mldn.microboot.MemberServiceProviderStartSpringBootMain + + + + + + diff --git a/microboot-shiro-member-provider/pom.xml b/microboot-shiro-member-provider/pom.xml new file mode 100644 index 0000000..66ebdc7 --- /dev/null +++ b/microboot-shiro-member-provider/pom.xml @@ -0,0 +1,90 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-shiro-member-provider + microboot-shiro-member-provider + http://maven.apache.org + + UTF-8 + + + + cn.mldn + microboot-shiro-api + 0.0.1-SNAPSHOT + + + mysql + mysql-connector-java + + + com.alibaba + druid + + + ch.qos.logback + logback-core + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + org.springframework.boot + spring-boot-starter-mail + + + + org.springframework.kafka + spring-kafka + + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-shiro-member-provider/src/main/java/cn/mldn/microboot/MemberServiceProviderStartSpringBootMain.java b/microboot-shiro-member-provider/src/main/java/cn/mldn/microboot/MemberServiceProviderStartSpringBootMain.java new file mode 100644 index 0000000..93d848f --- /dev/null +++ b/microboot-shiro-member-provider/src/main/java/cn/mldn/microboot/MemberServiceProviderStartSpringBootMain.java @@ -0,0 +1,15 @@ +package cn.mldn.microboot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication // 启动SpringBoot程序,而后自带子包扫描 +public class MemberServiceProviderStartSpringBootMain { + static { + System.setProperty("java.security.auth.login.config", + "d:/kafka_client_jaas.conf"); // 表示系统环境属性 + } + public static void main(String[] args) throws Exception { + SpringApplication.run(MemberServiceProviderStartSpringBootMain.class, args); + } +} diff --git a/microboot-shiro-member-provider/src/main/java/cn/mldn/microboot/controller/MemberController.java b/microboot-shiro-member-provider/src/main/java/cn/mldn/microboot/controller/MemberController.java new file mode 100644 index 0000000..2fc836b --- /dev/null +++ b/microboot-shiro-member-provider/src/main/java/cn/mldn/microboot/controller/MemberController.java @@ -0,0 +1,23 @@ +package cn.mldn.microboot.controller; + +import javax.annotation.Resource; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import cn.mldn.microboot.service.IMemberService; + +@RestController +public class MemberController { + @Resource + private IMemberService memberService; + @RequestMapping(value="/member/get",method=RequestMethod.POST) + public Object get(String mid) { + return this.memberService.get(mid) ; + } + @RequestMapping(value="/member/auth",method=RequestMethod.POST) + public Object auth(String mid) { + return this.memberService.listAuthByMember(mid) ; + } +} diff --git a/microboot-shiro-member-provider/src/main/java/cn/mldn/microboot/dao/IActionDAO.java b/microboot-shiro-member-provider/src/main/java/cn/mldn/microboot/dao/IActionDAO.java new file mode 100644 index 0000000..9ad9518 --- /dev/null +++ b/microboot-shiro-member-provider/src/main/java/cn/mldn/microboot/dao/IActionDAO.java @@ -0,0 +1,10 @@ +package cn.mldn.microboot.dao; + +import java.util.Set; + +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface IActionDAO { + public Set findAllActionByMember(String mid) ; +} diff --git a/microboot-shiro-member-provider/src/main/java/cn/mldn/microboot/dao/IMemberDAO.java b/microboot-shiro-member-provider/src/main/java/cn/mldn/microboot/dao/IMemberDAO.java new file mode 100644 index 0000000..cbc864b --- /dev/null +++ b/microboot-shiro-member-provider/src/main/java/cn/mldn/microboot/dao/IMemberDAO.java @@ -0,0 +1,10 @@ +package cn.mldn.microboot.dao; + +import org.apache.ibatis.annotations.Mapper; + +import cn.mldn.vo.Member; + +@Mapper +public interface IMemberDAO { + public Member findById(String mid) ; +} diff --git a/microboot-shiro-member-provider/src/main/java/cn/mldn/microboot/dao/IRoleDAO.java b/microboot-shiro-member-provider/src/main/java/cn/mldn/microboot/dao/IRoleDAO.java new file mode 100644 index 0000000..4f04ab3 --- /dev/null +++ b/microboot-shiro-member-provider/src/main/java/cn/mldn/microboot/dao/IRoleDAO.java @@ -0,0 +1,10 @@ +package cn.mldn.microboot.dao; + +import java.util.Set; + +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface IRoleDAO { + public Set findAllRoleByMember(String mid) ; +} diff --git a/microboot-shiro-member-provider/src/main/java/cn/mldn/microboot/service/IMemberService.java b/microboot-shiro-member-provider/src/main/java/cn/mldn/microboot/service/IMemberService.java new file mode 100644 index 0000000..e93c0c9 --- /dev/null +++ b/microboot-shiro-member-provider/src/main/java/cn/mldn/microboot/service/IMemberService.java @@ -0,0 +1,11 @@ +package cn.mldn.microboot.service; + +import java.util.Map; +import java.util.Set; + +import cn.mldn.vo.Member; + +public interface IMemberService { + public Member get(String mid) ; + public Map> listAuthByMember(String mid) ; +} diff --git a/microboot-shiro-member-provider/src/main/java/cn/mldn/microboot/service/impl/MemberServiceImpl.java b/microboot-shiro-member-provider/src/main/java/cn/mldn/microboot/service/impl/MemberServiceImpl.java new file mode 100644 index 0000000..60a603c --- /dev/null +++ b/microboot-shiro-member-provider/src/main/java/cn/mldn/microboot/service/impl/MemberServiceImpl.java @@ -0,0 +1,37 @@ +package cn.mldn.microboot.service.impl; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import cn.mldn.microboot.dao.IActionDAO; +import cn.mldn.microboot.dao.IMemberDAO; +import cn.mldn.microboot.dao.IRoleDAO; +import cn.mldn.microboot.service.IMemberService; +import cn.mldn.vo.Member; +@Service +public class MemberServiceImpl implements IMemberService { + @Resource + private IMemberDAO memberDAO; + @Resource + private IRoleDAO roleDAO; + @Resource + private IActionDAO actionDAO; + @Override + public Member get(String mid) { + return this.memberDAO.findById(mid); + } + + @Override + public Map> listAuthByMember(String mid) { + Map> map = new HashMap>(); + map.put("allRoles", this.roleDAO.findAllRoleByMember(mid)); + map.put("allActions", this.actionDAO.findAllActionByMember(mid)); + return map; + } + +} diff --git a/microboot-shiro-member-provider/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java b/microboot-shiro-member-provider/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java new file mode 100644 index 0000000..6ee5c4a --- /dev/null +++ b/microboot-shiro-member-provider/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java @@ -0,0 +1,26 @@ +package cn.mldn.microboot.util.controller; + +import java.text.SimpleDateFormat; +import java.util.Locale; + +import javax.annotation.Resource; + +import org.springframework.beans.propertyeditors.CustomDateEditor; +import org.springframework.context.MessageSource; +import org.springframework.web.bind.WebDataBinder; +import org.springframework.web.bind.annotation.InitBinder; + +public abstract class AbstractBaseController { + @Resource + private MessageSource messageSource; // 自动注入此资源对象 + public String getMessage(String key, String... args) { + return this.messageSource.getMessage(key, args, Locale.getDefault()); + } + @InitBinder + public void initBinder(WebDataBinder binder) { // 在本程序里面需要针对于日期格式进行处理 + // 首先建立一个可以将字符串转换为日期的工具程序类 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd") ; + // 明确的描述此时需要注册一个日期格式的转化处理程序类 + binder.registerCustomEditor(java.util.Date.class, new CustomDateEditor(sdf, true)); + } +} diff --git a/microboot-shiro-member-provider/src/main/java/数据库创建脚本.sql b/microboot-shiro-member-provider/src/main/java/数据库创建脚本.sql new file mode 100644 index 0000000..e928e2c --- /dev/null +++ b/microboot-shiro-member-provider/src/main/java/数据库创建脚本.sql @@ -0,0 +1,41 @@ +-- 删除数据库 +DROP DATABASE IF EXISTS mldn ; +-- 创建数据库 +CREATE DATABASE mldn CHARACTER SET UTF8 ; +-- 使用数据库 +USE mldn ; +CREATE TABLE member( + mid VARCHAR(50) , + name VARCHAR(50) , + password VARCHAR(32) , + locked INT , + CONSTRAINT pk_mid PRIMARY KEY(mid) +) ; +CREATE TABLE role ( + rid VARCHAR(50) , + title VARCHAR(50) , + CONSTRAINT pk_rid PRIMARY KEY(rid) +) ; +CREATE TABLE action ( + actid VARCHAR(50) , + title VARCHAR(50) , + rid VARCHAR(50) , + CONSTRAINT pk_actid PRIMARY KEY(actid) +) ; +CREATE TABLE member_role ( + mid VARCHAR(50) , + rid VARCHAR(50) +) ; +INSERT INTO member(mid,name,password,locked) VALUES ('mldnjava','mldn','2E866BF58289E01583AD418F486A69DF',0) ; +INSERT INTO member(mid,name,password,locked) VALUES ('admin','admin','2E866BF58289E01583AD418F486A69DF',0) ; +INSERT INTO role(rid,title) VALUES ('emp','雇员管理') ; +INSERT INTO role(rid,title) VALUES ('dept','部门管理') ; +INSERT INTO action(actid,title,rid) VALUES ('emp:add','雇员入职','emp') ; +INSERT INTO action(actid,title,rid) VALUES ('emp:remove','雇员离职','emp') ; +INSERT INTO action(actid,title,rid) VALUES ('emp:list','雇员列表','emp') ; +INSERT INTO action(actid,title,rid) VALUES ('emp:edit','雇员编辑','emp') ; +INSERT INTO action(actid,title,rid) VALUES ('dept:list','部门列表','dept') ; +INSERT INTO action(actid,title,rid) VALUES ('dept:edit','部门编辑','dept') ; +INSERT INTO member_role(mid,rid) VALUES ('mldnjava','emp') ; +INSERT INTO member_role(mid,rid) VALUES ('admin','emp') ; +INSERT INTO member_role(mid,rid) VALUES ('admin','dept') ; diff --git a/microboot-shiro-member-provider/src/main/resources/application.yml b/microboot-shiro-member-provider/src/main/resources/application.yml new file mode 100644 index 0000000..3742e35 --- /dev/null +++ b/microboot-shiro-member-provider/src/main/resources/application.yml @@ -0,0 +1,21 @@ +server: + port: 8001 +mybatis: + config-location: classpath:mybatis/mybatis.cfg.xml # mybatis配置文件所在路径 + type-aliases-package: cn.mldn.vo # 定义所有操作类的别名所在包 + mapper-locations: # 所有的mapper映射文件 + - classpath:mybatis/mapper/**/*.xml +spring: + messages: + basename: i18n/Messages,i18n/Pages + datasource: + type: com.alibaba.druid.pool.DruidDataSource # 配置当前要使用的数据源的操作类型 + driver-class-name: org.gjt.mm.mysql.Driver # 配置MySQL的驱动程序类 + url: jdbc:mysql://localhost:3306/mldn # 数据库连接地址 + username: root # 数据库用户名 + password: mysqladmin # 数据库连接密码 + dbcp2: # 进行数据库连接池的配置 + min-idle: 5 # 数据库连接池的最小维持连接数 + initial-size: 5 # 初始化提供的连接数 + max-total: 5 # 最大的连接数 + max-wait-millis: 200 # 等待连接获取的最大超时时间 \ No newline at end of file diff --git a/microboot-shiro-member-provider/src/main/resources/i18n/Messages.properties b/microboot-shiro-member-provider/src/main/resources/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-shiro-member-provider/src/main/resources/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-shiro-member-provider/src/main/resources/i18n/Pages.properties b/microboot-shiro-member-provider/src/main/resources/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-shiro-member-provider/src/main/resources/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-shiro-member-provider/src/main/resources/logback.xml b/microboot-shiro-member-provider/src/main/resources/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-shiro-member-provider/src/main/resources/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-shiro-member-provider/src/main/resources/mybatis/mapper/cn/mldn/Action.xml b/microboot-shiro-member-provider/src/main/resources/mybatis/mapper/cn/mldn/Action.xml new file mode 100644 index 0000000..963a890 --- /dev/null +++ b/microboot-shiro-member-provider/src/main/resources/mybatis/mapper/cn/mldn/Action.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/microboot-shiro-member-provider/src/main/resources/mybatis/mapper/cn/mldn/Member.xml b/microboot-shiro-member-provider/src/main/resources/mybatis/mapper/cn/mldn/Member.xml new file mode 100644 index 0000000..9dc8fde --- /dev/null +++ b/microboot-shiro-member-provider/src/main/resources/mybatis/mapper/cn/mldn/Member.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/microboot-shiro-member-provider/src/main/resources/mybatis/mapper/cn/mldn/Role.xml b/microboot-shiro-member-provider/src/main/resources/mybatis/mapper/cn/mldn/Role.xml new file mode 100644 index 0000000..84c00d9 --- /dev/null +++ b/microboot-shiro-member-provider/src/main/resources/mybatis/mapper/cn/mldn/Role.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/microboot-shiro-member-provider/src/main/resources/mybatis/mybatis.cfg.xml b/microboot-shiro-member-provider/src/main/resources/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4e7f40c --- /dev/null +++ b/microboot-shiro-member-provider/src/main/resources/mybatis/mybatis.cfg.xml @@ -0,0 +1,9 @@ + + + + + + + diff --git a/microboot-shiro-member-provider/src/main/view/static/images/mldn.ico b/microboot-shiro-member-provider/src/main/view/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-shiro-member-provider/src/main/view/static/images/mldn.ico differ diff --git a/microboot-shiro-member-provider/src/main/view/static/info/message_info.html b/microboot-shiro-member-provider/src/main/view/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-shiro-member-provider/src/main/view/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-shiro-member-provider/src/main/view/static/js/main.js b/microboot-shiro-member-provider/src/main/view/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-shiro-member-provider/src/main/view/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-shiro-member-provider/src/main/view/static/message_index.html b/microboot-shiro-member-provider/src/main/view/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-shiro-member-provider/src/main/view/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-shiro-member-provider/src/main/view/templates/upload_page.html b/microboot-shiro-member-provider/src/main/view/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-shiro-member-provider/src/main/view/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-shiro-member-provider/src/main/view/templates/upload_show.html b/microboot-shiro-member-provider/src/main/view/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-shiro-member-provider/src/main/view/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-shiro-member-provider/src/test/java/cn/mldn/microboot/TestMemberController.java b/microboot-shiro-member-provider/src/test/java/cn/mldn/microboot/TestMemberController.java new file mode 100644 index 0000000..290f749 --- /dev/null +++ b/microboot-shiro-member-provider/src/test/java/cn/mldn/microboot/TestMemberController.java @@ -0,0 +1,40 @@ +package cn.mldn.microboot; + +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.web.client.RestTemplate; + +import cn.mldn.vo.Member; + +@SpringBootTest(classes = MemberServiceProviderStartSpringBootMain.class) +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +public class TestMemberController { + private RestTemplate restTemplate = new RestTemplate() ; + @Test + public void testGet() { + String url = "http://localhost:8001/member/get?mid=admin" ; + Member vo = this.restTemplate.postForObject(url, null, Member.class) ; + System.out.println(vo); + } + @SuppressWarnings("unchecked") + @Test + public void testAuth() { + String url = "http://localhost:8001/member/auth?mid=admin" ; + Map map = this.restTemplate.postForObject(url, null, Map.class) ; + Set allRoles = new HashSet() ; + Set allActions = new HashSet() ; + allRoles.addAll((List) map.get("allRoles")); + allActions.addAll((List) map.get("allActions")) ; + System.out.println("【角色】" + allRoles); + System.out.println("【权限】" + allActions); + } +} diff --git a/microboot-shiro-member-provider/src/test/java/cn/mldn/microboot/TestMemberService.java b/microboot-shiro-member-provider/src/test/java/cn/mldn/microboot/TestMemberService.java new file mode 100644 index 0000000..4a172b5 --- /dev/null +++ b/microboot-shiro-member-provider/src/test/java/cn/mldn/microboot/TestMemberService.java @@ -0,0 +1,27 @@ +package cn.mldn.microboot; + +import javax.annotation.Resource; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +import cn.mldn.microboot.service.IMemberService; + +@SpringBootTest(classes = MemberServiceProviderStartSpringBootMain.class) +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +public class TestMemberService { + @Resource + private IMemberService memberService ; + @Test + public void testGet() { + System.out.println(this.memberService.get("admin")); + } + @Test + public void testAuth() { + System.out.println(this.memberService.listAuthByMember("admin")); + } +} diff --git a/microboot-shiro-member-provider/target/classes/META-INF/MANIFEST.MF b/microboot-shiro-member-provider/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d4c16dd --- /dev/null +++ b/microboot-shiro-member-provider/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Built-By: foreveriss +Build-Jdk: 1.8.0_121 +Created-By: Maven Integration for Eclipse + diff --git a/microboot-shiro-member-provider/target/classes/META-INF/maven/cn.mldn/microboot-shiro-member-provider/pom.properties b/microboot-shiro-member-provider/target/classes/META-INF/maven/cn.mldn/microboot-shiro-member-provider/pom.properties new file mode 100644 index 0000000..633a4e5 --- /dev/null +++ b/microboot-shiro-member-provider/target/classes/META-INF/maven/cn.mldn/microboot-shiro-member-provider/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Thu Jun 29 23:45:17 CST 2017 +version=0.0.1-SNAPSHOT +groupId=cn.mldn +m2e.projectName=microboot-shiro-member-provider +m2e.projectLocation=/Users/foreveriss/workspace/microboot/microboot-shiro-member-provider +artifactId=microboot-shiro-member-provider diff --git a/microboot-shiro-member-provider/target/classes/META-INF/maven/cn.mldn/microboot-shiro-member-provider/pom.xml b/microboot-shiro-member-provider/target/classes/META-INF/maven/cn.mldn/microboot-shiro-member-provider/pom.xml new file mode 100644 index 0000000..66ebdc7 --- /dev/null +++ b/microboot-shiro-member-provider/target/classes/META-INF/maven/cn.mldn/microboot-shiro-member-provider/pom.xml @@ -0,0 +1,90 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-shiro-member-provider + microboot-shiro-member-provider + http://maven.apache.org + + UTF-8 + + + + cn.mldn + microboot-shiro-api + 0.0.1-SNAPSHOT + + + mysql + mysql-connector-java + + + com.alibaba + druid + + + ch.qos.logback + logback-core + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + org.springframework.boot + spring-boot-starter-mail + + + + org.springframework.kafka + spring-kafka + + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-shiro-member-provider/target/classes/application.yml b/microboot-shiro-member-provider/target/classes/application.yml new file mode 100644 index 0000000..3742e35 --- /dev/null +++ b/microboot-shiro-member-provider/target/classes/application.yml @@ -0,0 +1,21 @@ +server: + port: 8001 +mybatis: + config-location: classpath:mybatis/mybatis.cfg.xml # mybatis配置文件所在路径 + type-aliases-package: cn.mldn.vo # 定义所有操作类的别名所在包 + mapper-locations: # 所有的mapper映射文件 + - classpath:mybatis/mapper/**/*.xml +spring: + messages: + basename: i18n/Messages,i18n/Pages + datasource: + type: com.alibaba.druid.pool.DruidDataSource # 配置当前要使用的数据源的操作类型 + driver-class-name: org.gjt.mm.mysql.Driver # 配置MySQL的驱动程序类 + url: jdbc:mysql://localhost:3306/mldn # 数据库连接地址 + username: root # 数据库用户名 + password: mysqladmin # 数据库连接密码 + dbcp2: # 进行数据库连接池的配置 + min-idle: 5 # 数据库连接池的最小维持连接数 + initial-size: 5 # 初始化提供的连接数 + max-total: 5 # 最大的连接数 + max-wait-millis: 200 # 等待连接获取的最大超时时间 \ No newline at end of file diff --git a/microboot-shiro-member-provider/target/classes/cn/mldn/microboot/MemberServiceProviderStartSpringBootMain.class b/microboot-shiro-member-provider/target/classes/cn/mldn/microboot/MemberServiceProviderStartSpringBootMain.class new file mode 100644 index 0000000..48b37ca Binary files /dev/null and b/microboot-shiro-member-provider/target/classes/cn/mldn/microboot/MemberServiceProviderStartSpringBootMain.class differ diff --git a/microboot-shiro-member-provider/target/classes/cn/mldn/microboot/controller/MemberController.class b/microboot-shiro-member-provider/target/classes/cn/mldn/microboot/controller/MemberController.class new file mode 100644 index 0000000..ba36904 Binary files /dev/null and b/microboot-shiro-member-provider/target/classes/cn/mldn/microboot/controller/MemberController.class differ diff --git a/microboot-shiro-member-provider/target/classes/cn/mldn/microboot/dao/IActionDAO.class b/microboot-shiro-member-provider/target/classes/cn/mldn/microboot/dao/IActionDAO.class new file mode 100644 index 0000000..7ac7268 Binary files /dev/null and b/microboot-shiro-member-provider/target/classes/cn/mldn/microboot/dao/IActionDAO.class differ diff --git a/microboot-shiro-member-provider/target/classes/cn/mldn/microboot/dao/IMemberDAO.class b/microboot-shiro-member-provider/target/classes/cn/mldn/microboot/dao/IMemberDAO.class new file mode 100644 index 0000000..d3043a4 Binary files /dev/null and b/microboot-shiro-member-provider/target/classes/cn/mldn/microboot/dao/IMemberDAO.class differ diff --git a/microboot-shiro-member-provider/target/classes/cn/mldn/microboot/dao/IRoleDAO.class b/microboot-shiro-member-provider/target/classes/cn/mldn/microboot/dao/IRoleDAO.class new file mode 100644 index 0000000..d2d5271 Binary files /dev/null and b/microboot-shiro-member-provider/target/classes/cn/mldn/microboot/dao/IRoleDAO.class differ diff --git a/microboot-shiro-member-provider/target/classes/cn/mldn/microboot/service/IMemberService.class b/microboot-shiro-member-provider/target/classes/cn/mldn/microboot/service/IMemberService.class new file mode 100644 index 0000000..86ecc37 Binary files /dev/null and b/microboot-shiro-member-provider/target/classes/cn/mldn/microboot/service/IMemberService.class differ diff --git a/microboot-shiro-member-provider/target/classes/cn/mldn/microboot/service/impl/MemberServiceImpl.class b/microboot-shiro-member-provider/target/classes/cn/mldn/microboot/service/impl/MemberServiceImpl.class new file mode 100644 index 0000000..df88f8c Binary files /dev/null and b/microboot-shiro-member-provider/target/classes/cn/mldn/microboot/service/impl/MemberServiceImpl.class differ diff --git a/microboot-shiro-member-provider/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class b/microboot-shiro-member-provider/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class new file mode 100644 index 0000000..e043da7 Binary files /dev/null and b/microboot-shiro-member-provider/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class differ diff --git a/microboot-shiro-member-provider/target/classes/i18n/Messages.properties b/microboot-shiro-member-provider/target/classes/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-shiro-member-provider/target/classes/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-shiro-member-provider/target/classes/i18n/Pages.properties b/microboot-shiro-member-provider/target/classes/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-shiro-member-provider/target/classes/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-shiro-member-provider/target/classes/logback.xml b/microboot-shiro-member-provider/target/classes/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-shiro-member-provider/target/classes/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-shiro-member-provider/target/classes/mybatis/mapper/cn/mldn/Action.xml b/microboot-shiro-member-provider/target/classes/mybatis/mapper/cn/mldn/Action.xml new file mode 100644 index 0000000..963a890 --- /dev/null +++ b/microboot-shiro-member-provider/target/classes/mybatis/mapper/cn/mldn/Action.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/microboot-shiro-member-provider/target/classes/mybatis/mapper/cn/mldn/Member.xml b/microboot-shiro-member-provider/target/classes/mybatis/mapper/cn/mldn/Member.xml new file mode 100644 index 0000000..9dc8fde --- /dev/null +++ b/microboot-shiro-member-provider/target/classes/mybatis/mapper/cn/mldn/Member.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/microboot-shiro-member-provider/target/classes/mybatis/mapper/cn/mldn/Role.xml b/microboot-shiro-member-provider/target/classes/mybatis/mapper/cn/mldn/Role.xml new file mode 100644 index 0000000..84c00d9 --- /dev/null +++ b/microboot-shiro-member-provider/target/classes/mybatis/mapper/cn/mldn/Role.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/microboot-shiro-member-provider/target/classes/mybatis/mybatis.cfg.xml b/microboot-shiro-member-provider/target/classes/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4e7f40c --- /dev/null +++ b/microboot-shiro-member-provider/target/classes/mybatis/mybatis.cfg.xml @@ -0,0 +1,9 @@ + + + + + + + diff --git a/microboot-shiro-member-provider/target/classes/static/images/mldn.ico b/microboot-shiro-member-provider/target/classes/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-shiro-member-provider/target/classes/static/images/mldn.ico differ diff --git a/microboot-shiro-member-provider/target/classes/static/info/message_info.html b/microboot-shiro-member-provider/target/classes/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-shiro-member-provider/target/classes/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-shiro-member-provider/target/classes/static/js/main.js b/microboot-shiro-member-provider/target/classes/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-shiro-member-provider/target/classes/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-shiro-member-provider/target/classes/static/message_index.html b/microboot-shiro-member-provider/target/classes/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-shiro-member-provider/target/classes/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-shiro-member-provider/target/classes/templates/upload_page.html b/microboot-shiro-member-provider/target/classes/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-shiro-member-provider/target/classes/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-shiro-member-provider/target/classes/templates/upload_show.html b/microboot-shiro-member-provider/target/classes/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-shiro-member-provider/target/classes/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-shiro-member-provider/target/test-classes/cn/mldn/microboot/TestMemberController.class b/microboot-shiro-member-provider/target/test-classes/cn/mldn/microboot/TestMemberController.class new file mode 100644 index 0000000..85d9a77 Binary files /dev/null and b/microboot-shiro-member-provider/target/test-classes/cn/mldn/microboot/TestMemberController.class differ diff --git a/microboot-shiro-member-provider/target/test-classes/cn/mldn/microboot/TestMemberService.class b/microboot-shiro-member-provider/target/test-classes/cn/mldn/microboot/TestMemberService.class new file mode 100644 index 0000000..ec356c3 Binary files /dev/null and b/microboot-shiro-member-provider/target/test-classes/cn/mldn/microboot/TestMemberService.class differ diff --git a/microboot-shiro-web/.classpath b/microboot-shiro-web/.classpath new file mode 100644 index 0000000..a6f04e8 --- /dev/null +++ b/microboot-shiro-web/.classpath @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/microboot-shiro-web/.project b/microboot-shiro-web/.project new file mode 100644 index 0000000..82ca361 --- /dev/null +++ b/microboot-shiro-web/.project @@ -0,0 +1,35 @@ + + + microboot-shiro-web + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/microboot-shiro-web/.settings/org.eclipse.core.resources.prefs b/microboot-shiro-web/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..a6dcfb7 --- /dev/null +++ b/microboot-shiro-web/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/main/view=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/microboot-shiro-web/.settings/org.eclipse.jdt.core.prefs b/microboot-shiro-web/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..d59e09c --- /dev/null +++ b/microboot-shiro-web/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/microboot-shiro-web/.settings/org.eclipse.m2e.core.prefs b/microboot-shiro-web/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/microboot-shiro-web/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/microboot-shiro-web/.settings/org.eclipse.wst.common.project.facet.core.xml b/microboot-shiro-web/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..e822977 --- /dev/null +++ b/microboot-shiro-web/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ + + + + diff --git a/microboot-shiro-web/.springBeans b/microboot-shiro-web/.springBeans new file mode 100644 index 0000000..f00d6d1 --- /dev/null +++ b/microboot-shiro-web/.springBeans @@ -0,0 +1,16 @@ + + + 1 + + + + + + + java:cn.mldn.microboot.ShiroWEBStartSpringBootMain + + + + + + diff --git a/microboot-shiro-web/pom.xml b/microboot-shiro-web/pom.xml new file mode 100644 index 0000000..de03e76 --- /dev/null +++ b/microboot-shiro-web/pom.xml @@ -0,0 +1,110 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-shiro-web + microboot-shiro-web + http://maven.apache.org + + UTF-8 + + + + cn.mldn + microboot-shiro-api + 0.0.1-SNAPSHOT + + + org.apache.shiro + shiro-spring + 1.3.2 + + + org.apache.shiro + shiro-core + 1.3.1 + + + org.apache.shiro + shiro-ehcache + 1.3.1 + + + org.apache.shiro + shiro-quartz + 1.3.1 + + + org.apache.shiro + shiro-web + 1.3.1 + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + org.springframework.boot + spring-boot-starter-mail + + + + ch.qos.logback + logback-core + + + + org.springframework.kafka + spring-kafka + + + com.github.theborakompanioni + thymeleaf-extras-shiro + 1.2.1 + + + org.springframework.boot + spring-boot-starter-data-redis + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-shiro-web/src/main/java/cn/mldn/microboot/ShiroWEBStartSpringBootMain.java b/microboot-shiro-web/src/main/java/cn/mldn/microboot/ShiroWEBStartSpringBootMain.java new file mode 100644 index 0000000..ec3db7c --- /dev/null +++ b/microboot-shiro-web/src/main/java/cn/mldn/microboot/ShiroWEBStartSpringBootMain.java @@ -0,0 +1,15 @@ +package cn.mldn.microboot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication // 启动SpringBoot程序,而后自带子包扫描 +public class ShiroWEBStartSpringBootMain { + static { + System.setProperty("java.security.auth.login.config", + "d:/kafka_client_jaas.conf"); // 表示系统环境属性 + } + public static void main(String[] args) throws Exception { + SpringApplication.run(ShiroWEBStartSpringBootMain.class, args); + } +} diff --git a/microboot-shiro-web/src/main/java/cn/mldn/microboot/cache/RedisCache.java b/microboot-shiro-web/src/main/java/cn/mldn/microboot/cache/RedisCache.java new file mode 100644 index 0000000..fec8559 --- /dev/null +++ b/microboot-shiro-web/src/main/java/cn/mldn/microboot/cache/RedisCache.java @@ -0,0 +1,103 @@ +package cn.mldn.microboot.cache; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.shiro.cache.Cache; +import org.apache.shiro.cache.CacheException; +import org.springframework.dao.DataAccessException; +import org.springframework.data.redis.connection.RedisConnection; +import org.springframework.data.redis.core.RedisCallback; +import org.springframework.data.redis.core.RedisTemplate; + +public class RedisCache implements Cache { + private Log log = LogFactory.getLog(RedisCache.class); + private RedisTemplate redisTempate; // 要提供有Redis处理工具类 + public RedisCache(RedisTemplate redisTempate) { + this.redisTempate = redisTempate; + } + @Override + public V get(K key) throws CacheException { + log.info("### get() : K = " + key); + return (V) this.redisTempate.opsForValue().get(key.toString()); + } + @Override + public V put(K key, V value) throws CacheException { + log.info("### put() : K = " + key + "、V = " + value); + this.redisTempate.opsForValue().set(key.toString(), value); + return value; + } + + @Override + public V remove(K key) throws CacheException { + log.info("### remove() : K = " + key); + V val = this.get(key); + this.redisTempate.delete(key.toString()); + return val; + } + + @Override + public void clear() throws CacheException { + log.info("### clear()"); + this.redisTempate.execute(new RedisCallback() { + @Override + public Boolean doInRedis(RedisConnection connection) + throws DataAccessException { + connection.flushDb(); // 清空数据库 + return true; + } + }); + } + + @Override + public int size() { + log.info("### size()"); + return this.redisTempate.execute(new RedisCallback() { + @Override + public Integer doInRedis(RedisConnection connection) + throws DataAccessException { + return connection.keys("*".getBytes()).size(); + } + }); + } + + @Override + public Set keys() { + log.info("### keys()"); + return this.redisTempate.execute(new RedisCallback>() { + @Override + public Set doInRedis(RedisConnection connection) + throws DataAccessException { + Set set = new HashSet(); + Set keys = connection.keys("*".getBytes()); + Iterator iter = keys.iterator(); + while (iter.hasNext()) { + set.add((K) iter.next()); + } + return set; + } + }); + } + + @Override + public Collection values() { + log.info("### values()"); + return this.redisTempate.execute(new RedisCallback>() { + @Override + public Set doInRedis(RedisConnection connection) + throws DataAccessException { + Set set = new HashSet(); + Set keys = connection.keys("*".getBytes()); + Iterator iter = keys.iterator(); + while (iter.hasNext()) { + set.add((V) connection.get(iter.next())); + } + return set; + } + }); + } +} diff --git a/microboot-shiro-web/src/main/java/cn/mldn/microboot/cache/RedisCacheManager.java b/microboot-shiro-web/src/main/java/cn/mldn/microboot/cache/RedisCacheManager.java new file mode 100644 index 0000000..117c109 --- /dev/null +++ b/microboot-shiro-web/src/main/java/cn/mldn/microboot/cache/RedisCacheManager.java @@ -0,0 +1,29 @@ +package cn.mldn.microboot.cache; + +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; + +import javax.annotation.Resource; + +import org.apache.shiro.cache.Cache; +import org.apache.shiro.cache.CacheException; +import org.apache.shiro.cache.CacheManager; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Component; +@Component +public class RedisCacheManager implements CacheManager { + // CacheManager负责所有数据的缓存,那么对于数据而言,应该保存在缓存里面 + private final ConcurrentMap caches = new ConcurrentHashMap(); + @Resource + private RedisTemplate redisTemplate; + @Override + public Cache getCache(String name) throws CacheException { + Cache cache = this.caches.get(name); // 通过Map取得cache数据 + if (cache == null) { // 当前的集合里面没有Cache的数据 + cache = new RedisCache(this.redisTemplate); // 实例化一个新的Cache对象 + this.caches.put(name, cache); + } + return cache; + } + +} diff --git a/microboot-shiro-web/src/main/java/cn/mldn/microboot/config/RedisConfig.java b/microboot-shiro-web/src/main/java/cn/mldn/microboot/config/RedisConfig.java new file mode 100644 index 0000000..eb333ee --- /dev/null +++ b/microboot-shiro-web/src/main/java/cn/mldn/microboot/config/RedisConfig.java @@ -0,0 +1,26 @@ +package cn.mldn.microboot.config; + +import javax.annotation.Resource; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.serializer.StringRedisSerializer; + +import cn.mldn.microboot.util.RedisObjectSerializer; + +@Configuration +public class RedisConfig { + @Resource + private JedisConnectionFactory jedisConnectionFactory ; + @Bean("shiroRedis") + public RedisTemplate redisTemplate(RedisConnectionFactory factory) { + RedisTemplate template = new RedisTemplate(); + template.setConnectionFactory(this.jedisConnectionFactory); + template.setKeySerializer(new StringRedisSerializer()); + template.setValueSerializer(new RedisObjectSerializer()); + return template; + } +} \ No newline at end of file diff --git a/microboot-shiro-web/src/main/java/cn/mldn/microboot/config/RestConfig.java b/microboot-shiro-web/src/main/java/cn/mldn/microboot/config/RestConfig.java new file mode 100644 index 0000000..a8d695b --- /dev/null +++ b/microboot-shiro-web/src/main/java/cn/mldn/microboot/config/RestConfig.java @@ -0,0 +1,13 @@ +package cn.mldn.microboot.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.client.RestTemplate; + +@Configuration +public class RestConfig { + @Bean + public RestTemplate getRestTemplate() { + return new RestTemplate() ; + } +} diff --git a/microboot-shiro-web/src/main/java/cn/mldn/microboot/config/ShiroConfig.java b/microboot-shiro-web/src/main/java/cn/mldn/microboot/config/ShiroConfig.java new file mode 100644 index 0000000..9befb91 --- /dev/null +++ b/microboot-shiro-web/src/main/java/cn/mldn/microboot/config/ShiroConfig.java @@ -0,0 +1,170 @@ +package cn.mldn.microboot.config; +import java.util.HashMap; +import java.util.Map; + +import javax.servlet.Filter; + +import org.apache.shiro.mgt.RememberMeManager; +import org.apache.shiro.realm.Realm; +import org.apache.shiro.session.mgt.SessionManager; +import org.apache.shiro.session.mgt.eis.JavaUuidSessionIdGenerator; +import org.apache.shiro.session.mgt.eis.SessionDAO; +import org.apache.shiro.session.mgt.eis.SessionIdGenerator; +import org.apache.shiro.session.mgt.quartz.QuartzSessionValidationScheduler; +import org.apache.shiro.spring.LifecycleBeanPostProcessor; +import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor; +import org.apache.shiro.spring.web.ShiroFilterFactoryBean; +import org.apache.shiro.web.filter.authc.FormAuthenticationFilter; +import org.apache.shiro.web.filter.authc.LogoutFilter; +import org.apache.shiro.web.mgt.CookieRememberMeManager; +import org.apache.shiro.web.mgt.DefaultWebSecurityManager; +import org.apache.shiro.web.servlet.SimpleCookie; +import org.apache.shiro.web.session.mgt.DefaultWebSessionManager; +import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.DependsOn; + +import at.pollux.thymeleaf.shiro.dialect.ShiroDialect; +import cn.mldn.microboot.cache.RedisCacheManager; +import cn.mldn.microboot.realm.CustomerCredentialsMatcher; +import cn.mldn.microboot.realm.MemberRealm; +import cn.mldn.microboot.session.RedisSessionDAO; + +@Configuration +public class ShiroConfig { + @Bean + public ShiroDialect getShiroDialect() { // 必须配置此操作才可以使用thymeleaf-extras-shiro开发包 + return new ShiroDialect() ; + } + + @Bean + public MemberRealm getRealm() {// 1、获取配置的Realm,之所以没使用注解配置,是因为此处需要考虑到加密处理 + MemberRealm realm = new MemberRealm(); + realm.setCredentialsMatcher(new CustomerCredentialsMatcher()); + return realm; + } + + @Bean(name = "lifecycleBeanPostProcessor") + public LifecycleBeanPostProcessor getLifecycleBeanPostProcessor() { + return new LifecycleBeanPostProcessor(); + } + + @Bean + @DependsOn("lifecycleBeanPostProcessor") + public DefaultAdvisorAutoProxyCreator getDefaultAdvisorAutoProxyCreator() { + DefaultAdvisorAutoProxyCreator daap = new DefaultAdvisorAutoProxyCreator(); + daap.setProxyTargetClass(true); + return daap; + } + +// @Bean +// public EhCacheManager getCacheManager() {// 2、缓存配置 +// EhCacheManager cacheManager = new EhCacheManager(); +// cacheManager.setCacheManagerConfigFile("classpath:ehcache.xml"); +// return cacheManager; +// } + + @Bean + public SessionIdGenerator getSessionIdGenerator() { // 3 + return new JavaUuidSessionIdGenerator(); + } + + @Bean + public SessionDAO getSessionDAO(SessionIdGenerator sessionIdGenerator) { // 4 + RedisSessionDAO sessionDAO = new RedisSessionDAO(); // 使用Redis进行Session管理 + sessionDAO.setActiveSessionsCacheName("shiro-activeSessionCache"); + sessionDAO.setSessionIdGenerator(sessionIdGenerator); + return sessionDAO; + } + + @Bean + public RememberMeManager getRememberManager() { // 5 + CookieRememberMeManager rememberMeManager = new CookieRememberMeManager(); + SimpleCookie cookie = new SimpleCookie("MLDNJAVA-RememberMe"); + cookie.setHttpOnly(true); + cookie.setMaxAge(3600); + rememberMeManager.setCookie(cookie); + return rememberMeManager; + } + + @Bean + public QuartzSessionValidationScheduler getQuartzSessionValidationScheduler() { + QuartzSessionValidationScheduler sessionValidationScheduler = new QuartzSessionValidationScheduler(); + sessionValidationScheduler.setSessionValidationInterval(100000); + return sessionValidationScheduler; + } + + @Bean + public AuthorizationAttributeSourceAdvisor getAuthorizationAttributeSourceAdvisor( + DefaultWebSecurityManager securityManager) { + AuthorizationAttributeSourceAdvisor aasa = new AuthorizationAttributeSourceAdvisor(); + aasa.setSecurityManager(securityManager); + return aasa; + } + + @Bean + public DefaultWebSessionManager getSessionManager(SessionDAO sessionDAO, + QuartzSessionValidationScheduler sessionValidationScheduler) { // 6 + DefaultWebSessionManager sessionManager = new DefaultWebSessionManager(); + sessionManager.setGlobalSessionTimeout(1000000); + sessionManager.setDeleteInvalidSessions(true); + sessionManager.setSessionValidationScheduler(sessionValidationScheduler); + sessionManager.setSessionValidationSchedulerEnabled(true); + sessionManager.setSessionDAO(sessionDAO); + SimpleCookie sessionIdCookie = new SimpleCookie("mldn-session-id"); + sessionIdCookie.setHttpOnly(true); + sessionIdCookie.setMaxAge(-1); + sessionManager.setSessionIdCookie(sessionIdCookie); + sessionManager.setSessionIdCookieEnabled(true); + return sessionManager; + } + + @Bean + public DefaultWebSecurityManager getSecurityManager(Realm memberRealm, RedisCacheManager cacheManager, + SessionManager sessionManager, RememberMeManager rememberMeManager) {// 7 + DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager(); + securityManager.setRealm(memberRealm); + securityManager.setCacheManager(cacheManager); + securityManager.setSessionManager(sessionManager); + securityManager.setRememberMeManager(rememberMeManager); + return securityManager; + } + + public FormAuthenticationFilter getLoginFilter() { // 在ShiroFilterFactoryBean中使用 + FormAuthenticationFilter filter = new FormAuthenticationFilter(); + filter.setUsernameParam("mid"); + filter.setPasswordParam("password"); + filter.setRememberMeParam("rememberMe"); + filter.setLoginUrl("/loginPage"); // 登录提交页面 + filter.setFailureKeyAttribute("error"); + return filter; + } + + public LogoutFilter getLogoutFilter() { // 在ShiroFilterFactoryBean中使用 + LogoutFilter logoutFilter = new LogoutFilter(); + logoutFilter.setRedirectUrl("/"); // 首页路径,登录注销后回到的页面 + return logoutFilter; + } + + @Bean + public ShiroFilterFactoryBean getShiroFilterFactoryBean(DefaultWebSecurityManager securityManager) { + ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean(); + // 必须设置 SecurityManager + shiroFilterFactoryBean.setSecurityManager(securityManager); + shiroFilterFactoryBean.setLoginUrl("/loginPage"); // 设置登录页路径 + shiroFilterFactoryBean.setSuccessUrl("/pages/hello"); // 设置跳转成功页 + shiroFilterFactoryBean.setUnauthorizedUrl("/pages/unauthUrl"); // 授权错误页 + Map filters = new HashMap(); + filters.put("authc", this.getLoginFilter()); + filters.put("logout", this.getLogoutFilter()); + shiroFilterFactoryBean.setFilters(filters); + Map filterChainDefinitionMap = new HashMap(); + filterChainDefinitionMap.put("/logout", "logout"); + filterChainDefinitionMap.put("/loginPage", "authc"); // 定义内置登录处理 + filterChainDefinitionMap.put("/pages/back/**", "authc"); + filterChainDefinitionMap.put("/*", "anon"); + shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap); + return shiroFilterFactoryBean; + } +} diff --git a/microboot-shiro-web/src/main/java/cn/mldn/microboot/controller/DeptController.java b/microboot-shiro-web/src/main/java/cn/mldn/microboot/controller/DeptController.java new file mode 100644 index 0000000..96e1834 --- /dev/null +++ b/microboot-shiro-web/src/main/java/cn/mldn/microboot/controller/DeptController.java @@ -0,0 +1,20 @@ +package cn.mldn.microboot.controller; + +import org.apache.shiro.authz.annotation.RequiresAuthentication; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +@Controller +public class DeptController { + @RequiresAuthentication + @RequestMapping("/pages/back/dept/get") + @ResponseBody + public String get() { + return "部门信息" ; + } + @RequestMapping("/pages/back/dept/show") + public String show() { + return "dept_show" ; + } +} diff --git a/microboot-shiro-web/src/main/java/cn/mldn/microboot/controller/MemberController.java b/microboot-shiro-web/src/main/java/cn/mldn/microboot/controller/MemberController.java new file mode 100644 index 0000000..35e3180 --- /dev/null +++ b/microboot-shiro-web/src/main/java/cn/mldn/microboot/controller/MemberController.java @@ -0,0 +1,12 @@ +package cn.mldn.microboot.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +public class MemberController { + @RequestMapping("/loginPage") + public String get() { + return "member_login" ; + } +} diff --git a/microboot-shiro-web/src/main/java/cn/mldn/microboot/realm/CustomerCredentialsMatcher.java b/microboot-shiro-web/src/main/java/cn/mldn/microboot/realm/CustomerCredentialsMatcher.java new file mode 100644 index 0000000..87422e4 --- /dev/null +++ b/microboot-shiro-web/src/main/java/cn/mldn/microboot/realm/CustomerCredentialsMatcher.java @@ -0,0 +1,19 @@ +package cn.mldn.microboot.realm; + +import org.apache.shiro.authc.AuthenticationInfo; +import org.apache.shiro.authc.AuthenticationToken; +import org.apache.shiro.authc.credential.SimpleCredentialsMatcher; + +import cn.mldn.util.enctype.PasswordUtil; + +public class CustomerCredentialsMatcher extends SimpleCredentialsMatcher { + @Override + public boolean doCredentialsMatch(AuthenticationToken token, AuthenticationInfo info) { + // 取得原始的输入数据信息 + Object tokenCredentials = PasswordUtil.getPassword(super.toString(token.getCredentials())).getBytes(); + // 取得认证数据库中的数据 + Object accountCredentials = super.getCredentials(info); + return super.equals(tokenCredentials, accountCredentials); + } +} + diff --git a/microboot-shiro-web/src/main/java/cn/mldn/microboot/realm/MemberRealm.java b/microboot-shiro-web/src/main/java/cn/mldn/microboot/realm/MemberRealm.java new file mode 100644 index 0000000..3930e38 --- /dev/null +++ b/microboot-shiro-web/src/main/java/cn/mldn/microboot/realm/MemberRealm.java @@ -0,0 +1,77 @@ +package cn.mldn.microboot.realm; + +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.annotation.Resource; + +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.authc.AuthenticationException; +import org.apache.shiro.authc.AuthenticationInfo; +import org.apache.shiro.authc.AuthenticationToken; +import org.apache.shiro.authc.IncorrectCredentialsException; +import org.apache.shiro.authc.LockedAccountException; +import org.apache.shiro.authc.SimpleAuthenticationInfo; +import org.apache.shiro.authc.UnknownAccountException; +import org.apache.shiro.authz.AuthorizationInfo; +import org.apache.shiro.authz.SimpleAuthorizationInfo; +import org.apache.shiro.realm.AuthorizingRealm; +import org.apache.shiro.subject.PrincipalCollection; +import org.springframework.web.client.RestTemplate; + +import cn.mldn.util.enctype.PasswordUtil; +import cn.mldn.vo.Member; + +public class MemberRealm extends AuthorizingRealm { + @Resource + private RestTemplate restTemplate ; + @Override + protected AuthenticationInfo doGetAuthenticationInfo( + AuthenticationToken token) throws AuthenticationException { + System.out.println("============== 1、进行认证操作处理 =============="); + String mid = token.getPrincipal().toString(); // 用户名 + // 取得用户名之后就需要通过业务层获取用户对象以确定改用户名是否可用 + String url = "http://localhost:8001/member/get?mid=" + mid ; + Member member = this.restTemplate.postForObject(url, null, Member.class) ; // 通过用户名获取用户信息 + if (member == null) { // 表示该用户信息不存在,不存在则应该抛出一个异常 + throw new UnknownAccountException("搞什么搞,用户名不存在!"); + } + // 用户名如果存在了,那么就需要确定密码是否正确 + String password = PasswordUtil + .getPassword(new String((char[]) token.getCredentials())); + if (!password.equals(member.getPassword())) { // 密码验证 + throw new IncorrectCredentialsException("密码都记不住,去死吧!"); + } + // 随后还需要考虑用户被锁定的问题 + if (member.getLocked().equals(1)) { // 1表示非0,非0就是true + throw new LockedAccountException("被锁了,求解锁去吧!"); + } + // 定义需要进行返回的操作数据信息项,返回的认证信息使用应该是密文 + SimpleAuthenticationInfo auth = new SimpleAuthenticationInfo( + token.getPrincipal(), password, "memberRealm"); + // 在认证完成之后可以直接取得用户所需要的信息内容,保存在Session之中 + SecurityUtils.getSubject().getSession().setAttribute("name", "我的名字"); + return auth; + } + @SuppressWarnings("unchecked") + @Override + protected AuthorizationInfo doGetAuthorizationInfo( + PrincipalCollection principals) { + System.out.println("++++++++++++++ 2、进行授权操作处理 ++++++++++++++"); + // 该操作的主要目的是取得授权信息,说的直白一点就是角色和权限数据 + SimpleAuthorizationInfo auth = new SimpleAuthorizationInfo(); + // 执行到此方法的时候一定是已经进行过用户认证处理了(用户名和密码一定是正确的) + String mid = (String) principals.getPrimaryPrincipal(); // 取得用户名 + String url = "http://localhost:8001/member/auth?mid=" + mid ; + Map map = this.restTemplate.postForObject(url, null, Map.class) ; + Set allRoles = new HashSet() ; + Set allActions = new HashSet() ; + allRoles.addAll((List) map.get("allRoles")); + allActions.addAll((List) map.get("allActions")) ; + auth.setRoles(allRoles); // 保存所有的角色 + auth.setStringPermissions(allActions); // 保存所有的权限 + return auth; + } +} diff --git a/microboot-shiro-web/src/main/java/cn/mldn/microboot/session/RedisSessionDAO.java b/microboot-shiro-web/src/main/java/cn/mldn/microboot/session/RedisSessionDAO.java new file mode 100644 index 0000000..5972010 --- /dev/null +++ b/microboot-shiro-web/src/main/java/cn/mldn/microboot/session/RedisSessionDAO.java @@ -0,0 +1,52 @@ +package cn.mldn.microboot.session; + +import java.io.Serializable; + +import javax.annotation.Resource; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.shiro.session.Session; +import org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO; +// 此时的类将实现SessionDAO的改写 +import org.springframework.data.redis.core.RedisTemplate; +public class RedisSessionDAO extends EnterpriseCacheSessionDAO { + private Log log = LogFactory.getLog(RedisSessionDAO.class); + @Resource + private RedisTemplate redisTempate; // 要提供有Redis处理工具类 + @Override + protected Serializable doCreate(Session session) { // 创建Session,返回session id + log.info("*** doCreate : " + session); + Serializable sessionId = super.doCreate(session); // 创建sessionid + // 将当前创建好的Session的数据保存在Redis数据库里面 + this.redisTempate.opsForValue().set(sessionId.toString(), session, + 1800); + return sessionId; + } + @Override + protected Session doReadSession(Serializable sessionId) { // 根据session + // id读取session数据 + log.info("*** doReadSession : " + sessionId); + Session session = super.doReadSession(sessionId); // 读取Session数据 + if (session == null) { // 现在没有读取到session数据,通过Redis读取 + return (Session) this.redisTempate.opsForValue() + .get(sessionId.toString()); + } + return null; + } + @Override + protected void doUpdate(Session session) { // 实现Session更新,每次操作都要更新 + log.info("*** doUpdate : " + session); + super.doUpdate(session); + if (session != null) { + this.redisTempate.opsForValue().set(session.getId().toString(), + session, 1800); + } + } + @Override + protected void doDelete(Session session) { // session的删除处理 + log.info("*** doDelete : " + session); + super.doDelete(session); + this.redisTempate.delete(session.getId().toString()); + } +} \ No newline at end of file diff --git a/microboot-shiro-web/src/main/java/cn/mldn/microboot/util/RedisObjectSerializer.java b/microboot-shiro-web/src/main/java/cn/mldn/microboot/util/RedisObjectSerializer.java new file mode 100644 index 0000000..9c69d67 --- /dev/null +++ b/microboot-shiro-web/src/main/java/cn/mldn/microboot/util/RedisObjectSerializer.java @@ -0,0 +1,36 @@ +package cn.mldn.microboot.util; +import org.springframework.core.convert.converter.Converter; +import org.springframework.core.serializer.support.DeserializingConverter; +import org.springframework.core.serializer.support.SerializingConverter; +import org.springframework.data.redis.serializer.RedisSerializer; +import org.springframework.data.redis.serializer.SerializationException; +public class RedisObjectSerializer implements RedisSerializer { + private Converter serializer = new SerializingConverter(); + private Converter deserializer = new DeserializingConverter(); + private static final byte[] EMPTY_ARRAY = new byte[0]; + @Override + public byte[] serialize(Object object) throws SerializationException { + if (object == null) { + return EMPTY_ARRAY; + } + try { + return serializer.convert(object); + } catch (Exception ex) { + return EMPTY_ARRAY; + } + } + @Override + public Object deserialize(byte[] bytes) throws SerializationException { + if (this.isEmpty(bytes)) { + return null; + } + try { + return deserializer.convert(bytes); + } catch (Exception ex) { + throw new SerializationException("序列化对象出错!", ex); + } + } + private boolean isEmpty(byte[] data) { + return (data == null || data.length == 0); + } +} \ No newline at end of file diff --git a/microboot-shiro-web/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java b/microboot-shiro-web/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java new file mode 100644 index 0000000..6ee5c4a --- /dev/null +++ b/microboot-shiro-web/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java @@ -0,0 +1,26 @@ +package cn.mldn.microboot.util.controller; + +import java.text.SimpleDateFormat; +import java.util.Locale; + +import javax.annotation.Resource; + +import org.springframework.beans.propertyeditors.CustomDateEditor; +import org.springframework.context.MessageSource; +import org.springframework.web.bind.WebDataBinder; +import org.springframework.web.bind.annotation.InitBinder; + +public abstract class AbstractBaseController { + @Resource + private MessageSource messageSource; // 自动注入此资源对象 + public String getMessage(String key, String... args) { + return this.messageSource.getMessage(key, args, Locale.getDefault()); + } + @InitBinder + public void initBinder(WebDataBinder binder) { // 在本程序里面需要针对于日期格式进行处理 + // 首先建立一个可以将字符串转换为日期的工具程序类 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd") ; + // 明确的描述此时需要注册一个日期格式的转化处理程序类 + binder.registerCustomEditor(java.util.Date.class, new CustomDateEditor(sdf, true)); + } +} diff --git a/microboot-shiro-web/src/main/java/数据库创建脚本.sql b/microboot-shiro-web/src/main/java/数据库创建脚本.sql new file mode 100644 index 0000000..edd35b2 --- /dev/null +++ b/microboot-shiro-web/src/main/java/数据库创建脚本.sql @@ -0,0 +1,13 @@ +DROP DATBASE IF EXISTS mldn ; +CREATE DATBASE mldn CHARACTER SET UTF8 ; +USE mldn ; +CREATE TABLE dept ( + deptno BIGINT AUTO_INCREMENT , + dname VARCHAR(50) , + CONSTRAINT pk_deptno PRIMARY KEY(deptno) +) ; +INSERT INTO dept(dname) VALUES ('开发部') ; +INSERT INTO dept(dname) VALUES ('财务部') ; +INSERT INTO dept(dname) VALUES ('市场部') ; +INSERT INTO dept(dname) VALUES ('后勤部') ; +INSERT INTO dept(dname) VALUES ('公关部') ; \ No newline at end of file diff --git a/microboot-shiro-web/src/main/resources/application.yml b/microboot-shiro-web/src/main/resources/application.yml new file mode 100644 index 0000000..71097d8 --- /dev/null +++ b/microboot-shiro-web/src/main/resources/application.yml @@ -0,0 +1,14 @@ +spring: + redis: + host: 192.168.68.166 + port: 6379 + password: mldnjava + timeout: 1000 + database: 0 + pool: + max-active: 10 + max-idle: 8 + min-idle: 2 + max-wait: 100 +server: + port: 8080 \ No newline at end of file diff --git a/microboot-shiro-web/src/main/resources/ehcache.xml b/microboot-shiro-web/src/main/resources/ehcache.xml new file mode 100644 index 0000000..90a01da --- /dev/null +++ b/microboot-shiro-web/src/main/resources/ehcache.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-shiro-web/src/main/resources/i18n/Messages.properties b/microboot-shiro-web/src/main/resources/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-shiro-web/src/main/resources/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-shiro-web/src/main/resources/i18n/Pages.properties b/microboot-shiro-web/src/main/resources/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-shiro-web/src/main/resources/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-shiro-web/src/main/resources/logback.xml b/microboot-shiro-web/src/main/resources/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-shiro-web/src/main/resources/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-shiro-web/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml b/microboot-shiro-web/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml new file mode 100644 index 0000000..6557a3a --- /dev/null +++ b/microboot-shiro-web/src/main/resources/mybatis/mapper/cn/mldn/Dept.xml @@ -0,0 +1,11 @@ + + + + + + INSERT INTO dept(dname) VALUES (#{dname}) ; + + diff --git a/microboot-shiro-web/src/main/resources/mybatis/mybatis.cfg.xml b/microboot-shiro-web/src/main/resources/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4d128c0 --- /dev/null +++ b/microboot-shiro-web/src/main/resources/mybatis/mybatis.cfg.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/microboot-shiro-web/src/main/view/static/images/mldn.ico b/microboot-shiro-web/src/main/view/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-shiro-web/src/main/view/static/images/mldn.ico differ diff --git a/microboot-shiro-web/src/main/view/static/info/message_info.html b/microboot-shiro-web/src/main/view/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-shiro-web/src/main/view/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-shiro-web/src/main/view/static/js/main.js b/microboot-shiro-web/src/main/view/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-shiro-web/src/main/view/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-shiro-web/src/main/view/static/message_index.html b/microboot-shiro-web/src/main/view/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-shiro-web/src/main/view/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-shiro-web/src/main/view/templates/dept_show.html b/microboot-shiro-web/src/main/view/templates/dept_show.html new file mode 100644 index 0000000..8abb21f --- /dev/null +++ b/microboot-shiro-web/src/main/view/templates/dept_show.html @@ -0,0 +1,17 @@ + + + + SpringBoot模版渲染 + + + +

显示部门信息的内容

+

欢迎:

+

雇员管理

+

部门管理

+

雇员增加

+

部门修改

+

您还未登录,请先登录!

+

欢迎光临!

+ + \ No newline at end of file diff --git a/microboot-shiro-web/src/main/view/templates/member_login.html b/microboot-shiro-web/src/main/view/templates/member_login.html new file mode 100644 index 0000000..31dbfe8 --- /dev/null +++ b/microboot-shiro-web/src/main/view/templates/member_login.html @@ -0,0 +1,17 @@ + + + + SpringBoot模版渲染 + + + + + +

用户登录表单、

+
+ 登录名:
+ 密 码:
+ +
+ + \ No newline at end of file diff --git a/microboot-shiro-web/target/classes/META-INF/MANIFEST.MF b/microboot-shiro-web/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d4c16dd --- /dev/null +++ b/microboot-shiro-web/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Built-By: foreveriss +Build-Jdk: 1.8.0_121 +Created-By: Maven Integration for Eclipse + diff --git a/microboot-shiro-web/target/classes/META-INF/maven/cn.mldn/microboot-shiro-web/pom.properties b/microboot-shiro-web/target/classes/META-INF/maven/cn.mldn/microboot-shiro-web/pom.properties new file mode 100644 index 0000000..d0a0aea --- /dev/null +++ b/microboot-shiro-web/target/classes/META-INF/maven/cn.mldn/microboot-shiro-web/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Thu Jun 29 23:45:19 CST 2017 +version=0.0.1-SNAPSHOT +groupId=cn.mldn +m2e.projectName=microboot-shiro-web +m2e.projectLocation=/Users/foreveriss/workspace/microboot/microboot-shiro-web +artifactId=microboot-shiro-web diff --git a/microboot-shiro-web/target/classes/META-INF/maven/cn.mldn/microboot-shiro-web/pom.xml b/microboot-shiro-web/target/classes/META-INF/maven/cn.mldn/microboot-shiro-web/pom.xml new file mode 100644 index 0000000..de03e76 --- /dev/null +++ b/microboot-shiro-web/target/classes/META-INF/maven/cn.mldn/microboot-shiro-web/pom.xml @@ -0,0 +1,110 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-shiro-web + microboot-shiro-web + http://maven.apache.org + + UTF-8 + + + + cn.mldn + microboot-shiro-api + 0.0.1-SNAPSHOT + + + org.apache.shiro + shiro-spring + 1.3.2 + + + org.apache.shiro + shiro-core + 1.3.1 + + + org.apache.shiro + shiro-ehcache + 1.3.1 + + + org.apache.shiro + shiro-quartz + 1.3.1 + + + org.apache.shiro + shiro-web + 1.3.1 + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + org.springframework.boot + spring-boot-starter-mail + + + + ch.qos.logback + logback-core + + + + org.springframework.kafka + spring-kafka + + + com.github.theborakompanioni + thymeleaf-extras-shiro + 1.2.1 + + + org.springframework.boot + spring-boot-starter-data-redis + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-shiro-web/target/classes/application.yml b/microboot-shiro-web/target/classes/application.yml new file mode 100644 index 0000000..71097d8 --- /dev/null +++ b/microboot-shiro-web/target/classes/application.yml @@ -0,0 +1,14 @@ +spring: + redis: + host: 192.168.68.166 + port: 6379 + password: mldnjava + timeout: 1000 + database: 0 + pool: + max-active: 10 + max-idle: 8 + min-idle: 2 + max-wait: 100 +server: + port: 8080 \ No newline at end of file diff --git a/microboot-shiro-web/target/classes/cn/mldn/microboot/ShiroWEBStartSpringBootMain.class b/microboot-shiro-web/target/classes/cn/mldn/microboot/ShiroWEBStartSpringBootMain.class new file mode 100644 index 0000000..21428dc Binary files /dev/null and b/microboot-shiro-web/target/classes/cn/mldn/microboot/ShiroWEBStartSpringBootMain.class differ diff --git a/microboot-shiro-web/target/classes/cn/mldn/microboot/cache/RedisCache$1.class b/microboot-shiro-web/target/classes/cn/mldn/microboot/cache/RedisCache$1.class new file mode 100644 index 0000000..bf7f641 Binary files /dev/null and b/microboot-shiro-web/target/classes/cn/mldn/microboot/cache/RedisCache$1.class differ diff --git a/microboot-shiro-web/target/classes/cn/mldn/microboot/cache/RedisCache$2.class b/microboot-shiro-web/target/classes/cn/mldn/microboot/cache/RedisCache$2.class new file mode 100644 index 0000000..0c87723 Binary files /dev/null and b/microboot-shiro-web/target/classes/cn/mldn/microboot/cache/RedisCache$2.class differ diff --git a/microboot-shiro-web/target/classes/cn/mldn/microboot/cache/RedisCache$3.class b/microboot-shiro-web/target/classes/cn/mldn/microboot/cache/RedisCache$3.class new file mode 100644 index 0000000..d3f2c6e Binary files /dev/null and b/microboot-shiro-web/target/classes/cn/mldn/microboot/cache/RedisCache$3.class differ diff --git a/microboot-shiro-web/target/classes/cn/mldn/microboot/cache/RedisCache$4.class b/microboot-shiro-web/target/classes/cn/mldn/microboot/cache/RedisCache$4.class new file mode 100644 index 0000000..0b2d1af Binary files /dev/null and b/microboot-shiro-web/target/classes/cn/mldn/microboot/cache/RedisCache$4.class differ diff --git a/microboot-shiro-web/target/classes/cn/mldn/microboot/cache/RedisCache.class b/microboot-shiro-web/target/classes/cn/mldn/microboot/cache/RedisCache.class new file mode 100644 index 0000000..3fcc57e Binary files /dev/null and b/microboot-shiro-web/target/classes/cn/mldn/microboot/cache/RedisCache.class differ diff --git a/microboot-shiro-web/target/classes/cn/mldn/microboot/cache/RedisCacheManager.class b/microboot-shiro-web/target/classes/cn/mldn/microboot/cache/RedisCacheManager.class new file mode 100644 index 0000000..968ed82 Binary files /dev/null and b/microboot-shiro-web/target/classes/cn/mldn/microboot/cache/RedisCacheManager.class differ diff --git a/microboot-shiro-web/target/classes/cn/mldn/microboot/config/RedisConfig.class b/microboot-shiro-web/target/classes/cn/mldn/microboot/config/RedisConfig.class new file mode 100644 index 0000000..cfb821e Binary files /dev/null and b/microboot-shiro-web/target/classes/cn/mldn/microboot/config/RedisConfig.class differ diff --git a/microboot-shiro-web/target/classes/cn/mldn/microboot/config/RestConfig.class b/microboot-shiro-web/target/classes/cn/mldn/microboot/config/RestConfig.class new file mode 100644 index 0000000..0447b61 Binary files /dev/null and b/microboot-shiro-web/target/classes/cn/mldn/microboot/config/RestConfig.class differ diff --git a/microboot-shiro-web/target/classes/cn/mldn/microboot/config/ShiroConfig.class b/microboot-shiro-web/target/classes/cn/mldn/microboot/config/ShiroConfig.class new file mode 100644 index 0000000..ee6211d Binary files /dev/null and b/microboot-shiro-web/target/classes/cn/mldn/microboot/config/ShiroConfig.class differ diff --git a/microboot-shiro-web/target/classes/cn/mldn/microboot/controller/DeptController.class b/microboot-shiro-web/target/classes/cn/mldn/microboot/controller/DeptController.class new file mode 100644 index 0000000..c600bd3 Binary files /dev/null and b/microboot-shiro-web/target/classes/cn/mldn/microboot/controller/DeptController.class differ diff --git a/microboot-shiro-web/target/classes/cn/mldn/microboot/controller/MemberController.class b/microboot-shiro-web/target/classes/cn/mldn/microboot/controller/MemberController.class new file mode 100644 index 0000000..eee5e50 Binary files /dev/null and b/microboot-shiro-web/target/classes/cn/mldn/microboot/controller/MemberController.class differ diff --git a/microboot-shiro-web/target/classes/cn/mldn/microboot/realm/CustomerCredentialsMatcher.class b/microboot-shiro-web/target/classes/cn/mldn/microboot/realm/CustomerCredentialsMatcher.class new file mode 100644 index 0000000..857dfa7 Binary files /dev/null and b/microboot-shiro-web/target/classes/cn/mldn/microboot/realm/CustomerCredentialsMatcher.class differ diff --git a/microboot-shiro-web/target/classes/cn/mldn/microboot/realm/MemberRealm.class b/microboot-shiro-web/target/classes/cn/mldn/microboot/realm/MemberRealm.class new file mode 100644 index 0000000..54c86fd Binary files /dev/null and b/microboot-shiro-web/target/classes/cn/mldn/microboot/realm/MemberRealm.class differ diff --git a/microboot-shiro-web/target/classes/cn/mldn/microboot/session/RedisSessionDAO.class b/microboot-shiro-web/target/classes/cn/mldn/microboot/session/RedisSessionDAO.class new file mode 100644 index 0000000..1c66535 Binary files /dev/null and b/microboot-shiro-web/target/classes/cn/mldn/microboot/session/RedisSessionDAO.class differ diff --git a/microboot-shiro-web/target/classes/cn/mldn/microboot/util/RedisObjectSerializer.class b/microboot-shiro-web/target/classes/cn/mldn/microboot/util/RedisObjectSerializer.class new file mode 100644 index 0000000..8e55e39 Binary files /dev/null and b/microboot-shiro-web/target/classes/cn/mldn/microboot/util/RedisObjectSerializer.class differ diff --git a/microboot-shiro-web/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class b/microboot-shiro-web/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class new file mode 100644 index 0000000..e043da7 Binary files /dev/null and b/microboot-shiro-web/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class differ diff --git a/microboot-shiro-web/target/classes/ehcache.xml b/microboot-shiro-web/target/classes/ehcache.xml new file mode 100644 index 0000000..90a01da --- /dev/null +++ b/microboot-shiro-web/target/classes/ehcache.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-shiro-web/target/classes/i18n/Messages.properties b/microboot-shiro-web/target/classes/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-shiro-web/target/classes/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-shiro-web/target/classes/i18n/Pages.properties b/microboot-shiro-web/target/classes/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-shiro-web/target/classes/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-shiro-web/target/classes/logback.xml b/microboot-shiro-web/target/classes/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-shiro-web/target/classes/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-shiro-web/target/classes/mybatis/mapper/cn/mldn/Dept.xml b/microboot-shiro-web/target/classes/mybatis/mapper/cn/mldn/Dept.xml new file mode 100644 index 0000000..6557a3a --- /dev/null +++ b/microboot-shiro-web/target/classes/mybatis/mapper/cn/mldn/Dept.xml @@ -0,0 +1,11 @@ + + + + + + INSERT INTO dept(dname) VALUES (#{dname}) ; + + diff --git a/microboot-shiro-web/target/classes/mybatis/mybatis.cfg.xml b/microboot-shiro-web/target/classes/mybatis/mybatis.cfg.xml new file mode 100644 index 0000000..4d128c0 --- /dev/null +++ b/microboot-shiro-web/target/classes/mybatis/mybatis.cfg.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/microboot-shiro-web/target/classes/static/images/mldn.ico b/microboot-shiro-web/target/classes/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-shiro-web/target/classes/static/images/mldn.ico differ diff --git a/microboot-shiro-web/target/classes/static/info/message_info.html b/microboot-shiro-web/target/classes/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-shiro-web/target/classes/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-shiro-web/target/classes/static/js/main.js b/microboot-shiro-web/target/classes/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-shiro-web/target/classes/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-shiro-web/target/classes/static/message_index.html b/microboot-shiro-web/target/classes/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-shiro-web/target/classes/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-shiro-web/target/classes/templates/dept_show.html b/microboot-shiro-web/target/classes/templates/dept_show.html new file mode 100644 index 0000000..8abb21f --- /dev/null +++ b/microboot-shiro-web/target/classes/templates/dept_show.html @@ -0,0 +1,17 @@ + + + + SpringBoot模版渲染 + + + +

显示部门信息的内容

+

欢迎:

+

雇员管理

+

部门管理

+

雇员增加

+

部门修改

+

您还未登录,请先登录!

+

欢迎光临!

+ + \ No newline at end of file diff --git a/microboot-shiro-web/target/classes/templates/member_login.html b/microboot-shiro-web/target/classes/templates/member_login.html new file mode 100644 index 0000000..31dbfe8 --- /dev/null +++ b/microboot-shiro-web/target/classes/templates/member_login.html @@ -0,0 +1,17 @@ + + + + SpringBoot模版渲染 + + + + + +

用户登录表单、

+
+ 登录名:
+ 密 码:
+ +
+ + \ No newline at end of file diff --git a/microboot-task/.classpath b/microboot-task/.classpath new file mode 100644 index 0000000..a6f04e8 --- /dev/null +++ b/microboot-task/.classpath @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/microboot-task/.project b/microboot-task/.project new file mode 100644 index 0000000..6329a1d --- /dev/null +++ b/microboot-task/.project @@ -0,0 +1,35 @@ + + + microboot-task + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/microboot-task/.settings/org.eclipse.core.resources.prefs b/microboot-task/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..a6dcfb7 --- /dev/null +++ b/microboot-task/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/main/view=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/microboot-task/.settings/org.eclipse.jdt.core.prefs b/microboot-task/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..d59e09c --- /dev/null +++ b/microboot-task/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/microboot-task/.settings/org.eclipse.m2e.core.prefs b/microboot-task/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/microboot-task/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/microboot-task/.settings/org.eclipse.wst.common.project.facet.core.xml b/microboot-task/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..e822977 --- /dev/null +++ b/microboot-task/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ + + + + diff --git a/microboot-task/pom.xml b/microboot-task/pom.xml new file mode 100644 index 0000000..6ee93ba --- /dev/null +++ b/microboot-task/pom.xml @@ -0,0 +1,67 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-task + microboot-task + http://maven.apache.org + + UTF-8 + + + + org.springframework.boot + spring-boot-starter-mail + + + + ch.qos.logback + logback-core + + + + org.springframework.kafka + spring-kafka + + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-task/src/main/java/cn/mldn/microboot/StartSpringBootMain.java b/microboot-task/src/main/java/cn/mldn/microboot/StartSpringBootMain.java new file mode 100644 index 0000000..e9c871f --- /dev/null +++ b/microboot-task/src/main/java/cn/mldn/microboot/StartSpringBootMain.java @@ -0,0 +1,13 @@ +package cn.mldn.microboot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.scheduling.annotation.EnableScheduling; + +@SpringBootApplication // 启动SpringBoot程序,而后自带子包扫描 +@EnableScheduling // 启用间隔调度 +public class StartSpringBootMain { + public static void main(String[] args) throws Exception { + SpringApplication.run(StartSpringBootMain.class, args); + } +} diff --git a/microboot-task/src/main/java/cn/mldn/microboot/config/SchedulerConfig.java b/microboot-task/src/main/java/cn/mldn/microboot/config/SchedulerConfig.java new file mode 100644 index 0000000..6d168a3 --- /dev/null +++ b/microboot-task/src/main/java/cn/mldn/microboot/config/SchedulerConfig.java @@ -0,0 +1,16 @@ +package cn.mldn.microboot.config; + +import java.util.concurrent.Executors; + +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.SchedulingConfigurer; +import org.springframework.scheduling.config.ScheduledTaskRegistrar; + +@Configuration // 定时调度的配置类一定要实现指定的父接口 +public class SchedulerConfig implements SchedulingConfigurer { + @Override + public void configureTasks(ScheduledTaskRegistrar taskRegistrar) { // 开启一个线程调度池 + taskRegistrar.setScheduler(Executors.newScheduledThreadPool(100)); + } + +} diff --git a/microboot-task/src/main/java/cn/mldn/microboot/task/MyScheduler.java b/microboot-task/src/main/java/cn/mldn/microboot/task/MyScheduler.java new file mode 100644 index 0000000..089ba76 --- /dev/null +++ b/microboot-task/src/main/java/cn/mldn/microboot/task/MyScheduler.java @@ -0,0 +1,29 @@ +package cn.mldn.microboot.task; + +import java.text.SimpleDateFormat; +import java.util.Date; + +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +@Component +public class MyScheduler { + @Scheduled(fixedRate = 2000) // 采用间隔调度,每2秒执行一次 + public void runJobA() { // 定义一个要执行的任务 + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + System.out.println("【*** MyTaskA - 间隔调度 ***】" + + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS") + .format(new Date())); + } + @Scheduled(cron = "* * * * * ?") // 每秒调用一次 + public void runJobB() { + System.err.println("【*** MyTaskB - 间隔调度 ***】" + + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS") + .format(new Date())); + } +} diff --git a/microboot-task/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java b/microboot-task/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java new file mode 100644 index 0000000..5127e93 --- /dev/null +++ b/microboot-task/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java @@ -0,0 +1,15 @@ +package cn.mldn.microboot.util.controller; + +import java.util.Locale; + +import javax.annotation.Resource; + +import org.springframework.context.MessageSource; + +public abstract class AbstractBaseController { + @Resource + private MessageSource messageSource; // 自动注入此资源对象 + public String getMessage(String key, String... args) { + return this.messageSource.getMessage(key, args, Locale.getDefault()); + } +} diff --git a/microboot-task/src/main/java/cn/mldn/microboot/vo/Dept.java b/microboot-task/src/main/java/cn/mldn/microboot/vo/Dept.java new file mode 100644 index 0000000..7971469 --- /dev/null +++ b/microboot-task/src/main/java/cn/mldn/microboot/vo/Dept.java @@ -0,0 +1,25 @@ +package cn.mldn.microboot.vo; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class Dept implements Serializable { + private Long deptno ; + private String dname ; + public Long getDeptno() { + return deptno; + } + public void setDeptno(Long deptno) { + this.deptno = deptno; + } + public String getDname() { + return dname; + } + public void setDname(String dname) { + this.dname = dname; + } + @Override + public String toString() { + return "Dept [deptno=" + deptno + ", dname=" + dname + "]"; + } +} diff --git a/microboot-task/src/main/java/cn/mldn/microboot/vo/Member.java b/microboot-task/src/main/java/cn/mldn/microboot/vo/Member.java new file mode 100644 index 0000000..f6a9cd8 --- /dev/null +++ b/microboot-task/src/main/java/cn/mldn/microboot/vo/Member.java @@ -0,0 +1,44 @@ +package cn.mldn.microboot.vo; + +import java.io.Serializable; +import java.util.Date; + +@SuppressWarnings("serial") +public class Member implements Serializable { + private Long mid ; + private String name ; + private Integer age ; + private Date birthday ; + private Double salary ; + public Long getMid() { + return mid; + } + public void setMid(Long mid) { + this.mid = mid; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public Integer getAge() { + return age; + } + public void setAge(Integer age) { + this.age = age; + } + public Date getBirthday() { + return birthday; + } + public void setBirthday(Date birthday) { + this.birthday = birthday; + } + public Double getSalary() { + return salary; + } + public void setSalary(Double salary) { + this.salary = salary; + } +} + diff --git a/microboot-task/src/main/java/数据库创建脚本.sql b/microboot-task/src/main/java/数据库创建脚本.sql new file mode 100644 index 0000000..edd35b2 --- /dev/null +++ b/microboot-task/src/main/java/数据库创建脚本.sql @@ -0,0 +1,13 @@ +DROP DATBASE IF EXISTS mldn ; +CREATE DATBASE mldn CHARACTER SET UTF8 ; +USE mldn ; +CREATE TABLE dept ( + deptno BIGINT AUTO_INCREMENT , + dname VARCHAR(50) , + CONSTRAINT pk_deptno PRIMARY KEY(deptno) +) ; +INSERT INTO dept(dname) VALUES ('开发部') ; +INSERT INTO dept(dname) VALUES ('财务部') ; +INSERT INTO dept(dname) VALUES ('市场部') ; +INSERT INTO dept(dname) VALUES ('后勤部') ; +INSERT INTO dept(dname) VALUES ('公关部') ; \ No newline at end of file diff --git a/microboot-task/src/main/resources/application.yml b/microboot-task/src/main/resources/application.yml new file mode 100644 index 0000000..b9c9d71 --- /dev/null +++ b/microboot-task/src/main/resources/application.yml @@ -0,0 +1,3 @@ +spring: + messages: + basename: i18n/Messages,i18n/Pages diff --git a/microboot-task/src/main/resources/i18n/Messages.properties b/microboot-task/src/main/resources/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-task/src/main/resources/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-task/src/main/resources/i18n/Pages.properties b/microboot-task/src/main/resources/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-task/src/main/resources/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-task/src/main/resources/logback.xml b/microboot-task/src/main/resources/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-task/src/main/resources/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-task/src/main/view/static/images/mldn.ico b/microboot-task/src/main/view/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-task/src/main/view/static/images/mldn.ico differ diff --git a/microboot-task/src/main/view/static/info/message_info.html b/microboot-task/src/main/view/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-task/src/main/view/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-task/src/main/view/static/js/main.js b/microboot-task/src/main/view/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-task/src/main/view/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-task/src/main/view/static/message_index.html b/microboot-task/src/main/view/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-task/src/main/view/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-task/src/main/view/templates/upload_page.html b/microboot-task/src/main/view/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-task/src/main/view/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-task/src/main/view/templates/upload_show.html b/microboot-task/src/main/view/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-task/src/main/view/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-task/target/classes/META-INF/MANIFEST.MF b/microboot-task/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d4c16dd --- /dev/null +++ b/microboot-task/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Built-By: foreveriss +Build-Jdk: 1.8.0_121 +Created-By: Maven Integration for Eclipse + diff --git a/microboot-task/target/classes/META-INF/maven/cn.mldn/microboot-task/pom.properties b/microboot-task/target/classes/META-INF/maven/cn.mldn/microboot-task/pom.properties new file mode 100644 index 0000000..352efdb --- /dev/null +++ b/microboot-task/target/classes/META-INF/maven/cn.mldn/microboot-task/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Thu Jun 29 23:45:19 CST 2017 +version=0.0.1-SNAPSHOT +groupId=cn.mldn +m2e.projectName=microboot-task +m2e.projectLocation=/Users/foreveriss/workspace/microboot/microboot-task +artifactId=microboot-task diff --git a/microboot-task/target/classes/META-INF/maven/cn.mldn/microboot-task/pom.xml b/microboot-task/target/classes/META-INF/maven/cn.mldn/microboot-task/pom.xml new file mode 100644 index 0000000..6ee93ba --- /dev/null +++ b/microboot-task/target/classes/META-INF/maven/cn.mldn/microboot-task/pom.xml @@ -0,0 +1,67 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-task + microboot-task + http://maven.apache.org + + UTF-8 + + + + org.springframework.boot + spring-boot-starter-mail + + + + ch.qos.logback + logback-core + + + + org.springframework.kafka + spring-kafka + + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-task/target/classes/application.yml b/microboot-task/target/classes/application.yml new file mode 100644 index 0000000..b9c9d71 --- /dev/null +++ b/microboot-task/target/classes/application.yml @@ -0,0 +1,3 @@ +spring: + messages: + basename: i18n/Messages,i18n/Pages diff --git a/microboot-task/target/classes/cn/mldn/microboot/StartSpringBootMain.class b/microboot-task/target/classes/cn/mldn/microboot/StartSpringBootMain.class new file mode 100644 index 0000000..448ebe8 Binary files /dev/null and b/microboot-task/target/classes/cn/mldn/microboot/StartSpringBootMain.class differ diff --git a/microboot-task/target/classes/cn/mldn/microboot/config/SchedulerConfig.class b/microboot-task/target/classes/cn/mldn/microboot/config/SchedulerConfig.class new file mode 100644 index 0000000..3244116 Binary files /dev/null and b/microboot-task/target/classes/cn/mldn/microboot/config/SchedulerConfig.class differ diff --git a/microboot-task/target/classes/cn/mldn/microboot/task/MyScheduler.class b/microboot-task/target/classes/cn/mldn/microboot/task/MyScheduler.class new file mode 100644 index 0000000..6bf5296 Binary files /dev/null and b/microboot-task/target/classes/cn/mldn/microboot/task/MyScheduler.class differ diff --git a/microboot-task/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class b/microboot-task/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class new file mode 100644 index 0000000..57c2010 Binary files /dev/null and b/microboot-task/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class differ diff --git a/microboot-task/target/classes/cn/mldn/microboot/vo/Dept.class b/microboot-task/target/classes/cn/mldn/microboot/vo/Dept.class new file mode 100644 index 0000000..46f2356 Binary files /dev/null and b/microboot-task/target/classes/cn/mldn/microboot/vo/Dept.class differ diff --git a/microboot-task/target/classes/cn/mldn/microboot/vo/Member.class b/microboot-task/target/classes/cn/mldn/microboot/vo/Member.class new file mode 100644 index 0000000..59c00d5 Binary files /dev/null and b/microboot-task/target/classes/cn/mldn/microboot/vo/Member.class differ diff --git a/microboot-task/target/classes/i18n/Messages.properties b/microboot-task/target/classes/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-task/target/classes/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-task/target/classes/i18n/Pages.properties b/microboot-task/target/classes/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-task/target/classes/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-task/target/classes/logback.xml b/microboot-task/target/classes/logback.xml new file mode 100644 index 0000000..1f01e35 --- /dev/null +++ b/microboot-task/target/classes/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + + ${LOG_HOME}/${APP}_detail.log + + %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n + + + ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} + + + + ${LOG_HOME}/${APP}_access.log + + %d{yy-MM-dd.HH:mm:ss.SSS};%X{ServiceId};%m%n + + + ${LOG_HOME}/${APP}_access.log.%d{yyyyMMdd} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microboot-task/target/classes/static/images/mldn.ico b/microboot-task/target/classes/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-task/target/classes/static/images/mldn.ico differ diff --git a/microboot-task/target/classes/static/info/message_info.html b/microboot-task/target/classes/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-task/target/classes/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-task/target/classes/static/js/main.js b/microboot-task/target/classes/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-task/target/classes/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-task/target/classes/static/message_index.html b/microboot-task/target/classes/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-task/target/classes/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-task/target/classes/templates/upload_page.html b/microboot-task/target/classes/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-task/target/classes/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-task/target/classes/templates/upload_show.html b/microboot-task/target/classes/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-task/target/classes/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-thymeleaf/.classpath b/microboot-thymeleaf/.classpath new file mode 100644 index 0000000..a6f04e8 --- /dev/null +++ b/microboot-thymeleaf/.classpath @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/microboot-thymeleaf/.project b/microboot-thymeleaf/.project new file mode 100644 index 0000000..cdb39af --- /dev/null +++ b/microboot-thymeleaf/.project @@ -0,0 +1,35 @@ + + + microboot-thymeleaf + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/microboot-thymeleaf/.settings/org.eclipse.core.resources.prefs b/microboot-thymeleaf/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..a6dcfb7 --- /dev/null +++ b/microboot-thymeleaf/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/main/view=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/microboot-thymeleaf/.settings/org.eclipse.jdt.core.prefs b/microboot-thymeleaf/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..d59e09c --- /dev/null +++ b/microboot-thymeleaf/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/microboot-thymeleaf/.settings/org.eclipse.m2e.core.prefs b/microboot-thymeleaf/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/microboot-thymeleaf/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/microboot-thymeleaf/.settings/org.eclipse.wst.common.project.facet.core.xml b/microboot-thymeleaf/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..e822977 --- /dev/null +++ b/microboot-thymeleaf/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ + + + + diff --git a/microboot-thymeleaf/pom.xml b/microboot-thymeleaf/pom.xml new file mode 100644 index 0000000..45c13dc --- /dev/null +++ b/microboot-thymeleaf/pom.xml @@ -0,0 +1,52 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-thymeleaf + microboot-thymeleaf + http://maven.apache.org + + UTF-8 + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-thymeleaf/src/main/java/cn/mldn/microboot/StartSpringBootMain.java b/microboot-thymeleaf/src/main/java/cn/mldn/microboot/StartSpringBootMain.java new file mode 100644 index 0000000..87d91fa --- /dev/null +++ b/microboot-thymeleaf/src/main/java/cn/mldn/microboot/StartSpringBootMain.java @@ -0,0 +1,10 @@ +package cn.mldn.microboot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +@SpringBootApplication // 启动SpringBoot程序,而后自带子包扫描 +public class StartSpringBootMain { + public static void main(String[] args) throws Exception { + SpringApplication.run(StartSpringBootMain.class, args); + } +} diff --git a/microboot-thymeleaf/src/main/java/cn/mldn/microboot/controller/MemberController.java b/microboot-thymeleaf/src/main/java/cn/mldn/microboot/controller/MemberController.java new file mode 100644 index 0000000..264ebab --- /dev/null +++ b/microboot-thymeleaf/src/main/java/cn/mldn/microboot/controller/MemberController.java @@ -0,0 +1,66 @@ +package cn.mldn.microboot.controller; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +import cn.mldn.microboot.util.controller.AbstractBaseController; +import cn.mldn.microboot.vo.Member; + +@Controller +public class MemberController extends AbstractBaseController { + @RequestMapping(value = "/member/set", method = RequestMethod.GET) + public String set(Model model) { + Set allNames = new HashSet() ; + List allIds = new ArrayList() ; + for (int x = 0 ; x < 5 ; x ++) { + allNames.add("mldn-" + x) ; + allIds.add(x) ; + } + model.addAttribute("names", allNames) ; + model.addAttribute("ids", allIds) ; + model.addAttribute("mydate", new java.util.Date()) ; + return "member/member_set" ; + } + + @RequestMapping(value = "/member/map", method = RequestMethod.GET) + public String map(Model model) { + Map allMembers = new HashMap(); + for (int x = 0; x < 10; x++) { + Member vo = new Member(); + vo.setMid(101L + x); + vo.setName("啊三 - " + x); + vo.setAge(9); + vo.setSalary(99999.99); + vo.setBirthday(new Date()); + allMembers.put("mldn-" + x, vo); + } + model.addAttribute("allMembers", allMembers); + return "member/member_map"; + } + + @RequestMapping(value = "/member/list", method = RequestMethod.GET) + public String list(Model model) { + List allMembers = new ArrayList(); + for (int x = 0; x < 10; x++) { + Member vo = new Member(); + vo.setMid(101L + x); + vo.setName("啊三 - " + x); + vo.setAge(9); + vo.setSalary(99999.99); + vo.setBirthday(new Date()); + allMembers.add(vo) ; + } + model.addAttribute("allMembers", allMembers); + return "member/member_list"; + } +} diff --git a/microboot-thymeleaf/src/main/java/cn/mldn/microboot/controller/MessageController.java b/microboot-thymeleaf/src/main/java/cn/mldn/microboot/controller/MessageController.java new file mode 100644 index 0000000..8561d1c --- /dev/null +++ b/microboot-thymeleaf/src/main/java/cn/mldn/microboot/controller/MessageController.java @@ -0,0 +1,53 @@ +package cn.mldn.microboot.controller; + +import java.util.Date; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +import cn.mldn.microboot.util.controller.AbstractBaseController; +import cn.mldn.microboot.vo.Member; + +@Controller +public class MessageController extends AbstractBaseController { + @RequestMapping(value = "/message/member_show", method = RequestMethod.GET) + public String memberShow(Model model) { + Member vo = new Member(); + vo.setMid(101L); + vo.setName("啊三"); + vo.setAge(9); + vo.setSalary(99999.99); + vo.setBirthday(new Date()); + model.addAttribute("member", vo); + return "message/member_show"; + } + + @RequestMapping(value = "/message/inner", method = RequestMethod.GET) + public String inner(HttpServletRequest request, Model model) { + request.setAttribute("requestMessage", "mldnjava-request"); + request.getSession().setAttribute("sessionMessage", "mldnjava-session"); + request.getServletContext().setAttribute("applicationMessage", + "mldnjava-application"); + model.addAttribute("url", "www.mldn.cn"); + request.setAttribute("url2", + "www.mldn.cn"); + return "message/message_show_inner"; + } + + @RequestMapping(value = "/message/showStyle", method = RequestMethod.GET) + public String showStyle(Model model) { // 通过model可以实现内容的传递 + model.addAttribute("url", "www.mldn.cn"); // request属性传递包装 + return "message/message_show_style"; + } + + @RequestMapping(value = "/show", method = RequestMethod.GET) + public String show(String mid, Model model) { // 通过model可以实现内容的传递 + model.addAttribute("url", "www.mldn.cn"); // request属性传递包装 + model.addAttribute("mid", mid); // request属性传递包装 + return "message/message_show"; // 此处只返回一个路径, 该路径没有设置后缀,后缀默认是*.html + } +} diff --git a/microboot-thymeleaf/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java b/microboot-thymeleaf/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java new file mode 100644 index 0000000..5127e93 --- /dev/null +++ b/microboot-thymeleaf/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java @@ -0,0 +1,15 @@ +package cn.mldn.microboot.util.controller; + +import java.util.Locale; + +import javax.annotation.Resource; + +import org.springframework.context.MessageSource; + +public abstract class AbstractBaseController { + @Resource + private MessageSource messageSource; // 自动注入此资源对象 + public String getMessage(String key, String... args) { + return this.messageSource.getMessage(key, args, Locale.getDefault()); + } +} diff --git a/microboot-thymeleaf/src/main/java/cn/mldn/microboot/vo/Member.java b/microboot-thymeleaf/src/main/java/cn/mldn/microboot/vo/Member.java new file mode 100644 index 0000000..f6a9cd8 --- /dev/null +++ b/microboot-thymeleaf/src/main/java/cn/mldn/microboot/vo/Member.java @@ -0,0 +1,44 @@ +package cn.mldn.microboot.vo; + +import java.io.Serializable; +import java.util.Date; + +@SuppressWarnings("serial") +public class Member implements Serializable { + private Long mid ; + private String name ; + private Integer age ; + private Date birthday ; + private Double salary ; + public Long getMid() { + return mid; + } + public void setMid(Long mid) { + this.mid = mid; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public Integer getAge() { + return age; + } + public void setAge(Integer age) { + this.age = age; + } + public Date getBirthday() { + return birthday; + } + public void setBirthday(Date birthday) { + this.birthday = birthday; + } + public Double getSalary() { + return salary; + } + public void setSalary(Double salary) { + this.salary = salary; + } +} + diff --git a/microboot-thymeleaf/src/main/resources/application.yml b/microboot-thymeleaf/src/main/resources/application.yml new file mode 100644 index 0000000..12c1326 --- /dev/null +++ b/microboot-thymeleaf/src/main/resources/application.yml @@ -0,0 +1,5 @@ +server: + port: 80 +spring: + messages: + basename: i18n/Messages,i18n/Pages \ No newline at end of file diff --git a/microboot-thymeleaf/src/main/resources/i18n/Messages.properties b/microboot-thymeleaf/src/main/resources/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-thymeleaf/src/main/resources/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-thymeleaf/src/main/resources/i18n/Pages.properties b/microboot-thymeleaf/src/main/resources/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-thymeleaf/src/main/resources/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-thymeleaf/src/main/view/static/images/mldn.ico b/microboot-thymeleaf/src/main/view/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-thymeleaf/src/main/view/static/images/mldn.ico differ diff --git a/microboot-thymeleaf/src/main/view/static/info/message_info.html b/microboot-thymeleaf/src/main/view/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-thymeleaf/src/main/view/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-thymeleaf/src/main/view/static/js/main.js b/microboot-thymeleaf/src/main/view/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-thymeleaf/src/main/view/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-thymeleaf/src/main/view/static/message_index.html b/microboot-thymeleaf/src/main/view/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-thymeleaf/src/main/view/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-thymeleaf/src/main/view/templates/commons/footer.html b/microboot-thymeleaf/src/main/view/templates/commons/footer.html new file mode 100644 index 0000000..c62fcf1 --- /dev/null +++ b/microboot-thymeleaf/src/main/view/templates/commons/footer.html @@ -0,0 +1,5 @@ + +
+

魔乐科技(www.mldn.cn)

+

、

+

\ No newline at end of file diff --git a/microboot-thymeleaf/src/main/view/templates/member/member_list.html b/microboot-thymeleaf/src/main/view/templates/member/member_list.html new file mode 100644 index 0000000..a035f99 --- /dev/null +++ b/microboot-thymeleaf/src/main/view/templates/member/member_list.html @@ -0,0 +1,22 @@ + + + + SpringBoot模版渲染 + + + + + + + + + +
No.MID姓名年龄偶数奇数
+ + + + + +
+ + \ No newline at end of file diff --git a/microboot-thymeleaf/src/main/view/templates/member/member_map.html b/microboot-thymeleaf/src/main/view/templates/member/member_map.html new file mode 100644 index 0000000..216b861 --- /dev/null +++ b/microboot-thymeleaf/src/main/view/templates/member/member_map.html @@ -0,0 +1,26 @@ + + + + SpringBoot模版渲染 + + + + + +

+

+


+ + + + +
No.KEYMID姓名年龄偶数奇数
+ + + + + + +
+ + \ No newline at end of file diff --git a/microboot-thymeleaf/src/main/view/templates/member/member_set.html b/microboot-thymeleaf/src/main/view/templates/member/member_set.html new file mode 100644 index 0000000..637af18 --- /dev/null +++ b/microboot-thymeleaf/src/main/view/templates/member/member_set.html @@ -0,0 +1,25 @@ + + + + SpringBoot模版渲染 + + + + + +

+

+


+

+

+

+


+

+

+

+


+

+

+

+ + \ No newline at end of file diff --git a/microboot-thymeleaf/src/main/view/templates/message/member_show.html b/microboot-thymeleaf/src/main/view/templates/message/member_show.html new file mode 100644 index 0000000..e167238 --- /dev/null +++ b/microboot-thymeleaf/src/main/view/templates/message/member_show.html @@ -0,0 +1,20 @@ + + + + SpringBoot模版渲染 + + + + + + + 你还不满18岁,不能够看电影! + +


+ +

mid为101的员工来了

+

mid为102的员工来了

+

没有匹配成功的数据!

+
+ + \ No newline at end of file diff --git a/microboot-thymeleaf/src/main/view/templates/message/message_show.html b/microboot-thymeleaf/src/main/view/templates/message/message_show.html new file mode 100644 index 0000000..9126f0b --- /dev/null +++ b/microboot-thymeleaf/src/main/view/templates/message/message_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + +

+

+ + \ No newline at end of file diff --git a/microboot-thymeleaf/src/main/view/templates/message/message_show_inner.html b/microboot-thymeleaf/src/main/view/templates/message/message_show_inner.html new file mode 100644 index 0000000..0fce231 --- /dev/null +++ b/microboot-thymeleaf/src/main/view/templates/message/message_show_inner.html @@ -0,0 +1,19 @@ + + + + SpringBoot模版渲染 + + + + + +

+

+

+

+


+

+

+

+ + \ No newline at end of file diff --git a/microboot-thymeleaf/src/main/view/templates/message/message_show_style.html b/microboot-thymeleaf/src/main/view/templates/message/message_show_style.html new file mode 100644 index 0000000..1d27f27 --- /dev/null +++ b/microboot-thymeleaf/src/main/view/templates/message/message_show_style.html @@ -0,0 +1,20 @@ + + + + SpringBoot模版渲染 + + + + + + 访问 +


+

+

+


+

+

+
+

+ + \ No newline at end of file diff --git a/microboot-thymeleaf/src/test/java/cn/mldn/microboot/AppTest.java b/microboot-thymeleaf/src/test/java/cn/mldn/microboot/AppTest.java new file mode 100644 index 0000000..a094258 --- /dev/null +++ b/microboot-thymeleaf/src/test/java/cn/mldn/microboot/AppTest.java @@ -0,0 +1,38 @@ +package cn.mldn.microboot; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/microboot-thymeleaf/src/test/java/cn/mldn/microboot/test/TestMessageController.java b/microboot-thymeleaf/src/test/java/cn/mldn/microboot/test/TestMessageController.java new file mode 100644 index 0000000..21c04dd --- /dev/null +++ b/microboot-thymeleaf/src/test/java/cn/mldn/microboot/test/TestMessageController.java @@ -0,0 +1,19 @@ +package cn.mldn.microboot.test; + +import javax.annotation.Resource; + +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +import cn.mldn.microboot.StartSpringBootMain; +import cn.mldn.microboot.controller.MessageController; + +@SpringBootTest(classes = StartSpringBootMain.class) +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +public class TestMessageController { + @Resource + private MessageController messageController; +} diff --git a/microboot-thymeleaf/target/classes/META-INF/MANIFEST.MF b/microboot-thymeleaf/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d4c16dd --- /dev/null +++ b/microboot-thymeleaf/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Built-By: foreveriss +Build-Jdk: 1.8.0_121 +Created-By: Maven Integration for Eclipse + diff --git a/microboot-thymeleaf/target/classes/META-INF/maven/cn.mldn/microboot-thymeleaf/pom.properties b/microboot-thymeleaf/target/classes/META-INF/maven/cn.mldn/microboot-thymeleaf/pom.properties new file mode 100644 index 0000000..19ff13c --- /dev/null +++ b/microboot-thymeleaf/target/classes/META-INF/maven/cn.mldn/microboot-thymeleaf/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Thu Jun 29 23:45:20 CST 2017 +version=0.0.1-SNAPSHOT +groupId=cn.mldn +m2e.projectName=microboot-thymeleaf +m2e.projectLocation=/Users/foreveriss/workspace/microboot/microboot-thymeleaf +artifactId=microboot-thymeleaf diff --git a/microboot-thymeleaf/target/classes/META-INF/maven/cn.mldn/microboot-thymeleaf/pom.xml b/microboot-thymeleaf/target/classes/META-INF/maven/cn.mldn/microboot-thymeleaf/pom.xml new file mode 100644 index 0000000..45c13dc --- /dev/null +++ b/microboot-thymeleaf/target/classes/META-INF/maven/cn.mldn/microboot-thymeleaf/pom.xml @@ -0,0 +1,52 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-thymeleaf + microboot-thymeleaf + http://maven.apache.org + + UTF-8 + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-thymeleaf/target/classes/application.yml b/microboot-thymeleaf/target/classes/application.yml new file mode 100644 index 0000000..12c1326 --- /dev/null +++ b/microboot-thymeleaf/target/classes/application.yml @@ -0,0 +1,5 @@ +server: + port: 80 +spring: + messages: + basename: i18n/Messages,i18n/Pages \ No newline at end of file diff --git a/microboot-thymeleaf/target/classes/cn/mldn/microboot/StartSpringBootMain.class b/microboot-thymeleaf/target/classes/cn/mldn/microboot/StartSpringBootMain.class new file mode 100644 index 0000000..57c4fba Binary files /dev/null and b/microboot-thymeleaf/target/classes/cn/mldn/microboot/StartSpringBootMain.class differ diff --git a/microboot-thymeleaf/target/classes/cn/mldn/microboot/controller/MemberController.class b/microboot-thymeleaf/target/classes/cn/mldn/microboot/controller/MemberController.class new file mode 100644 index 0000000..18761dc Binary files /dev/null and b/microboot-thymeleaf/target/classes/cn/mldn/microboot/controller/MemberController.class differ diff --git a/microboot-thymeleaf/target/classes/cn/mldn/microboot/controller/MessageController.class b/microboot-thymeleaf/target/classes/cn/mldn/microboot/controller/MessageController.class new file mode 100644 index 0000000..0cb256b Binary files /dev/null and b/microboot-thymeleaf/target/classes/cn/mldn/microboot/controller/MessageController.class differ diff --git a/microboot-thymeleaf/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class b/microboot-thymeleaf/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class new file mode 100644 index 0000000..57c2010 Binary files /dev/null and b/microboot-thymeleaf/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class differ diff --git a/microboot-thymeleaf/target/classes/cn/mldn/microboot/vo/Member.class b/microboot-thymeleaf/target/classes/cn/mldn/microboot/vo/Member.class new file mode 100644 index 0000000..59c00d5 Binary files /dev/null and b/microboot-thymeleaf/target/classes/cn/mldn/microboot/vo/Member.class differ diff --git a/microboot-thymeleaf/target/classes/i18n/Messages.properties b/microboot-thymeleaf/target/classes/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-thymeleaf/target/classes/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-thymeleaf/target/classes/i18n/Pages.properties b/microboot-thymeleaf/target/classes/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-thymeleaf/target/classes/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-thymeleaf/target/classes/static/images/mldn.ico b/microboot-thymeleaf/target/classes/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-thymeleaf/target/classes/static/images/mldn.ico differ diff --git a/microboot-thymeleaf/target/classes/static/info/message_info.html b/microboot-thymeleaf/target/classes/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-thymeleaf/target/classes/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-thymeleaf/target/classes/static/js/main.js b/microboot-thymeleaf/target/classes/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-thymeleaf/target/classes/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-thymeleaf/target/classes/static/message_index.html b/microboot-thymeleaf/target/classes/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-thymeleaf/target/classes/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-thymeleaf/target/classes/templates/commons/footer.html b/microboot-thymeleaf/target/classes/templates/commons/footer.html new file mode 100644 index 0000000..c62fcf1 --- /dev/null +++ b/microboot-thymeleaf/target/classes/templates/commons/footer.html @@ -0,0 +1,5 @@ + +
+

魔乐科技(www.mldn.cn)

+

、

+

\ No newline at end of file diff --git a/microboot-thymeleaf/target/classes/templates/member/member_list.html b/microboot-thymeleaf/target/classes/templates/member/member_list.html new file mode 100644 index 0000000..a035f99 --- /dev/null +++ b/microboot-thymeleaf/target/classes/templates/member/member_list.html @@ -0,0 +1,22 @@ + + + + SpringBoot模版渲染 + + + + + + + + + +
No.MID姓名年龄偶数奇数
+ + + + + +
+ + \ No newline at end of file diff --git a/microboot-thymeleaf/target/classes/templates/member/member_map.html b/microboot-thymeleaf/target/classes/templates/member/member_map.html new file mode 100644 index 0000000..216b861 --- /dev/null +++ b/microboot-thymeleaf/target/classes/templates/member/member_map.html @@ -0,0 +1,26 @@ + + + + SpringBoot模版渲染 + + + + + +

+

+


+ + + + +
No.KEYMID姓名年龄偶数奇数
+ + + + + + +
+ + \ No newline at end of file diff --git a/microboot-thymeleaf/target/classes/templates/member/member_set.html b/microboot-thymeleaf/target/classes/templates/member/member_set.html new file mode 100644 index 0000000..637af18 --- /dev/null +++ b/microboot-thymeleaf/target/classes/templates/member/member_set.html @@ -0,0 +1,25 @@ + + + + SpringBoot模版渲染 + + + + + +

+

+


+

+

+

+


+

+

+

+


+

+

+

+ + \ No newline at end of file diff --git a/microboot-thymeleaf/target/classes/templates/message/member_show.html b/microboot-thymeleaf/target/classes/templates/message/member_show.html new file mode 100644 index 0000000..e167238 --- /dev/null +++ b/microboot-thymeleaf/target/classes/templates/message/member_show.html @@ -0,0 +1,20 @@ + + + + SpringBoot模版渲染 + + + + + + + 你还不满18岁,不能够看电影! + +


+ +

mid为101的员工来了

+

mid为102的员工来了

+

没有匹配成功的数据!

+
+ + \ No newline at end of file diff --git a/microboot-thymeleaf/target/classes/templates/message/message_show.html b/microboot-thymeleaf/target/classes/templates/message/message_show.html new file mode 100644 index 0000000..9126f0b --- /dev/null +++ b/microboot-thymeleaf/target/classes/templates/message/message_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + +

+

+ + \ No newline at end of file diff --git a/microboot-thymeleaf/target/classes/templates/message/message_show_inner.html b/microboot-thymeleaf/target/classes/templates/message/message_show_inner.html new file mode 100644 index 0000000..0fce231 --- /dev/null +++ b/microboot-thymeleaf/target/classes/templates/message/message_show_inner.html @@ -0,0 +1,19 @@ + + + + SpringBoot模版渲染 + + + + + +

+

+

+

+


+

+

+

+ + \ No newline at end of file diff --git a/microboot-thymeleaf/target/classes/templates/message/message_show_style.html b/microboot-thymeleaf/target/classes/templates/message/message_show_style.html new file mode 100644 index 0000000..1d27f27 --- /dev/null +++ b/microboot-thymeleaf/target/classes/templates/message/message_show_style.html @@ -0,0 +1,20 @@ + + + + SpringBoot模版渲染 + + + + + + 访问 +


+

+

+


+

+

+
+

+ + \ No newline at end of file diff --git a/microboot-thymeleaf/target/test-classes/cn/mldn/microboot/AppTest.class b/microboot-thymeleaf/target/test-classes/cn/mldn/microboot/AppTest.class new file mode 100644 index 0000000..d317ee0 Binary files /dev/null and b/microboot-thymeleaf/target/test-classes/cn/mldn/microboot/AppTest.class differ diff --git a/microboot-thymeleaf/target/test-classes/cn/mldn/microboot/test/TestMessageController.class b/microboot-thymeleaf/target/test-classes/cn/mldn/microboot/test/TestMessageController.class new file mode 100644 index 0000000..c014017 Binary files /dev/null and b/microboot-thymeleaf/target/test-classes/cn/mldn/microboot/test/TestMessageController.class differ diff --git a/microboot-tomcat/.classpath b/microboot-tomcat/.classpath new file mode 100644 index 0000000..6fd795d --- /dev/null +++ b/microboot-tomcat/.classpath @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/microboot-tomcat/.project b/microboot-tomcat/.project new file mode 100644 index 0000000..34a8644 --- /dev/null +++ b/microboot-tomcat/.project @@ -0,0 +1,43 @@ + + + microboot-tomcat + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.wst.jsdt.core.jsNature + + diff --git a/microboot-tomcat/.settings/.jsdtscope b/microboot-tomcat/.settings/.jsdtscope new file mode 100644 index 0000000..e34514d --- /dev/null +++ b/microboot-tomcat/.settings/.jsdtscope @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/microboot-tomcat/.settings/org.eclipse.core.resources.prefs b/microboot-tomcat/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..a6dcfb7 --- /dev/null +++ b/microboot-tomcat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/main/view=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/microboot-tomcat/.settings/org.eclipse.jdt.core.prefs b/microboot-tomcat/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..1ab2bb5 --- /dev/null +++ b/microboot-tomcat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/microboot-tomcat/.settings/org.eclipse.m2e.core.prefs b/microboot-tomcat/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/microboot-tomcat/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/microboot-tomcat/.settings/org.eclipse.wst.common.component b/microboot-tomcat/.settings/org.eclipse.wst.common.component new file mode 100644 index 0000000..62c5d02 --- /dev/null +++ b/microboot-tomcat/.settings/org.eclipse.wst.common.component @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/microboot-tomcat/.settings/org.eclipse.wst.common.project.facet.core.xml b/microboot-tomcat/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..3214ffe --- /dev/null +++ b/microboot-tomcat/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/microboot-tomcat/.settings/org.eclipse.wst.jsdt.ui.superType.container b/microboot-tomcat/.settings/org.eclipse.wst.jsdt.ui.superType.container new file mode 100644 index 0000000..3bd5d0a --- /dev/null +++ b/microboot-tomcat/.settings/org.eclipse.wst.jsdt.ui.superType.container @@ -0,0 +1 @@ +org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/microboot-tomcat/.settings/org.eclipse.wst.jsdt.ui.superType.name b/microboot-tomcat/.settings/org.eclipse.wst.jsdt.ui.superType.name new file mode 100644 index 0000000..05bd71b --- /dev/null +++ b/microboot-tomcat/.settings/org.eclipse.wst.jsdt.ui.superType.name @@ -0,0 +1 @@ +Window \ No newline at end of file diff --git a/microboot-tomcat/.settings/org.eclipse.wst.validation.prefs b/microboot-tomcat/.settings/org.eclipse.wst.validation.prefs new file mode 100644 index 0000000..6f1cba6 --- /dev/null +++ b/microboot-tomcat/.settings/org.eclipse.wst.validation.prefs @@ -0,0 +1,2 @@ +disabled=06target +eclipse.preferences.version=1 diff --git a/microboot-tomcat/pom.xml b/microboot-tomcat/pom.xml new file mode 100644 index 0000000..19df157 --- /dev/null +++ b/microboot-tomcat/pom.xml @@ -0,0 +1,65 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + war + microboot-tomcat + microboot-tomcat + http://maven.apache.org + + UTF-8 + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + + microboot-tomcat + + + org.apache.maven.plugins + maven-war-plugin + + mldn + + + + + diff --git a/microboot-tomcat/src/main/java/cn/mldn/microboot/StartSpringBootMain.java b/microboot-tomcat/src/main/java/cn/mldn/microboot/StartSpringBootMain.java new file mode 100644 index 0000000..2e5c42f --- /dev/null +++ b/microboot-tomcat/src/main/java/cn/mldn/microboot/StartSpringBootMain.java @@ -0,0 +1,17 @@ +package cn.mldn.microboot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.support.SpringBootServletInitializer; +@SpringBootApplication // 启动SpringBoot程序,而后自带子包扫描 +public class StartSpringBootMain extends SpringBootServletInitializer { // 必须继承指定的父类 + @Override + protected SpringApplicationBuilder configure( + SpringApplicationBuilder builder) { + return builder.sources(StartSpringBootMain.class) ; + } + public static void main(String[] args) throws Exception { + SpringApplication.run(StartSpringBootMain.class, args); + } +} diff --git a/microboot-tomcat/src/main/java/cn/mldn/microboot/advice/GlobalExceptionHandler.java b/microboot-tomcat/src/main/java/cn/mldn/microboot/advice/GlobalExceptionHandler.java new file mode 100644 index 0000000..1214c4b --- /dev/null +++ b/microboot-tomcat/src/main/java/cn/mldn/microboot/advice/GlobalExceptionHandler.java @@ -0,0 +1,50 @@ +package cn.mldn.microboot.advice; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; + +//@ControllerAdvice// 作为一个控制层的切面处理 +@RestControllerAdvice +public class GlobalExceptionHandler { + public static final String DEFAULT_ERROR_VIEW = "error"; // 定义错误显示页,error.html + @ExceptionHandler(Exception.class) // 所有的异常都是Exception子类 + public Object defaultErrorHandler(HttpServletRequest request,Exception e) { + class ErrorInfo { + private Integer code ; + private String message ; + private String url ; + public Integer getCode() { + return code; + } + public void setCode(Integer code) { + this.code = code; + } + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + public String getUrl() { + return url; + } + public void setUrl(String url) { + this.url = url; + } + } + ErrorInfo info = new ErrorInfo() ; + info.setCode(100); // 标记一个错误信息类型 + info.setMessage(e.getMessage()); + info.setUrl(request.getRequestURL().toString()); + return info ; + } +// public ModelAndView defaultErrorHandler(HttpServletRequest request, +// Exception e) { // 出现异常之后会跳转到此方法 +// ModelAndView mav = new ModelAndView(DEFAULT_ERROR_VIEW); // 设置跳转路径 +// mav.addObject("exception", e); // 将异常对象传递过去 +// mav.addObject("url", request.getRequestURL()); // 获得请求的路径 +// return mav; +// } +} diff --git a/microboot-tomcat/src/main/java/cn/mldn/microboot/config/ErrorPageConfig.java b/microboot-tomcat/src/main/java/cn/mldn/microboot/config/ErrorPageConfig.java new file mode 100644 index 0000000..09e856d --- /dev/null +++ b/microboot-tomcat/src/main/java/cn/mldn/microboot/config/ErrorPageConfig.java @@ -0,0 +1,29 @@ +package cn.mldn.microboot.config; + +import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; +import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer; +import org.springframework.boot.web.servlet.ErrorPage; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.HttpStatus; + +@Configuration +public class ErrorPageConfig { + @Bean + public EmbeddedServletContainerCustomizer containerCustomizer() { + return new EmbeddedServletContainerCustomizer() { + @Override + public void customize( + ConfigurableEmbeddedServletContainer container) { + ErrorPage errorPage400 = new ErrorPage(HttpStatus.BAD_REQUEST, + "/error-400.html"); + ErrorPage errorPage404 = new ErrorPage(HttpStatus.NOT_FOUND, + "/error-404.html"); + ErrorPage errorPage500 = new ErrorPage( + HttpStatus.INTERNAL_SERVER_ERROR, "/error-500.html"); + container.addErrorPages(errorPage400, errorPage404, + errorPage500); + } + }; + } +} diff --git a/microboot-tomcat/src/main/java/cn/mldn/microboot/config/HttpConnectorConfig.java b/microboot-tomcat/src/main/java/cn/mldn/microboot/config/HttpConnectorConfig.java new file mode 100644 index 0000000..37dba94 --- /dev/null +++ b/microboot-tomcat/src/main/java/cn/mldn/microboot/config/HttpConnectorConfig.java @@ -0,0 +1,38 @@ +package cn.mldn.microboot.config; + +import org.apache.catalina.connector.Connector; +import org.apache.tomcat.util.descriptor.web.SecurityCollection; +import org.apache.tomcat.util.descriptor.web.SecurityConstraint; +import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class HttpConnectorConfig { // 此类专门负责HTTP的连接的相关配置 + public Connector initConnector() { + Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol") ; + connector.setScheme("http"); // 如果现在用户使用普通的http的方式进行访问 + connector.setPort(80); // 用户访问的是80端口 + connector.setSecure(false); // 如果该连接为跳转则表示不是一个新的连接对象 + connector.setRedirectPort(443); // 设置转发操作端口 + return connector; + } + + @Bean + public TomcatEmbeddedServletContainerFactory servletContainerFactory() { + TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory() { + protected void postProcessContext( + org.apache.catalina.Context context) {// 该方法主要进行请求处理的上下文配置 + SecurityConstraint securityConstraint = new SecurityConstraint(); // 定义新的安全访问策略 + securityConstraint.setUserConstraint("CONFIDENTIAL"); // 定义用户的访问约束要求 + SecurityCollection collection = new SecurityCollection() ; + collection.addPattern("/*"); // 匹配所有的访问映射路径 + securityConstraint.addCollection(collection); // 追加路径映射访问配置 + context.addConstraint(securityConstraint); + }; + }; + factory.addAdditionalTomcatConnectors(this.initConnector()); + return factory; + } +} + \ No newline at end of file diff --git a/microboot-tomcat/src/main/java/cn/mldn/microboot/controller/MemberController.java b/microboot-tomcat/src/main/java/cn/mldn/microboot/controller/MemberController.java new file mode 100644 index 0000000..9134e99 --- /dev/null +++ b/microboot-tomcat/src/main/java/cn/mldn/microboot/controller/MemberController.java @@ -0,0 +1,28 @@ +package cn.mldn.microboot.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import cn.mldn.microboot.util.controller.AbstractBaseController; +import cn.mldn.microboot.vo.Member; + +@Controller +public class MemberController extends AbstractBaseController { + @RequestMapping(value="/") + @ResponseBody + public String get() { + return "hello world" ; + } + + @RequestMapping(value = "/add", method = RequestMethod.POST) + @ResponseBody + public Object add(Member vo) { // 增加前的准备操作路径 + return vo; + } + @RequestMapping(value = "/addPre", method = RequestMethod.GET) + public String addPre() { // 增加前的准备操作路径 + return "member_add"; + } +} diff --git a/microboot-tomcat/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java b/microboot-tomcat/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java new file mode 100644 index 0000000..93c1b2c --- /dev/null +++ b/microboot-tomcat/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java @@ -0,0 +1,27 @@ +package cn.mldn.microboot.util.controller; + +import java.text.SimpleDateFormat; +import java.util.Locale; + +import javax.annotation.Resource; + +import org.springframework.beans.propertyeditors.CustomDateEditor; +import org.springframework.context.MessageSource; +import org.springframework.web.bind.WebDataBinder; +import org.springframework.web.bind.annotation.InitBinder; + +public abstract class AbstractBaseController { + @Resource + private MessageSource messageSource; // 自动注入此资源对象 + public String getMessage(String key, String... args) { + return this.messageSource.getMessage(key, args, Locale.getDefault()); + } + @InitBinder + public void initBinder(WebDataBinder binder) { // 在本程序里面需要针对于日期格式进行处理 + // 首先建立一个可以将字符串转换为日期的工具程序类 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd") ; + // 明确的描述此时需要注册一个日期格式的转化处理程序类 + binder.registerCustomEditor(java.util.Date.class, new CustomDateEditor(sdf, true)); + } + +} diff --git a/microboot-tomcat/src/main/java/cn/mldn/microboot/vo/Member.java b/microboot-tomcat/src/main/java/cn/mldn/microboot/vo/Member.java new file mode 100644 index 0000000..d3ac3ad --- /dev/null +++ b/microboot-tomcat/src/main/java/cn/mldn/microboot/vo/Member.java @@ -0,0 +1,41 @@ +package cn.mldn.microboot.vo; + +import java.io.Serializable; +import java.util.Date; + +@SuppressWarnings("serial") +public class Member implements Serializable { + private String mid; + private Integer age; + private Double salary; + private Date birthday; + public String getMid() { + return mid; + } + public void setMid(String mid) { + this.mid = mid; + } + public Integer getAge() { + return age; + } + public void setAge(Integer age) { + this.age = age; + } + public Double getSalary() { + return salary; + } + public void setSalary(Double salary) { + this.salary = salary; + } + public Date getBirthday() { + return birthday; + } + public void setBirthday(Date birthday) { + this.birthday = birthday; + } + @Override + public String toString() { + return "Member [mid=" + mid + ", age=" + age + ", salary=" + salary + + ", birthday=" + birthday + "]"; + } +} diff --git a/microboot-tomcat/src/main/resources/application.yml b/microboot-tomcat/src/main/resources/application.yml new file mode 100644 index 0000000..ed9c39f --- /dev/null +++ b/microboot-tomcat/src/main/resources/application.yml @@ -0,0 +1,7 @@ +server: + port: 443 # https的端口设置为443 + ssl: + key-store: classpath:keystore.p12 # keystore配置文件路径 + key-store-type: PKCS12 # keystore类型 + key-alias: mytomcat # 设置的别名 + key-password: mldnjava # 访问密码 \ No newline at end of file diff --git a/microboot-tomcat/src/main/resources/i18n/Messages.properties b/microboot-tomcat/src/main/resources/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-tomcat/src/main/resources/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-tomcat/src/main/resources/i18n/Pages.properties b/microboot-tomcat/src/main/resources/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-tomcat/src/main/resources/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-tomcat/src/main/resources/keystore.p12 b/microboot-tomcat/src/main/resources/keystore.p12 new file mode 100644 index 0000000..98aaf41 Binary files /dev/null and b/microboot-tomcat/src/main/resources/keystore.p12 differ diff --git a/microboot-tomcat/src/main/view/static/error-400.html b/microboot-tomcat/src/main/view/static/error-400.html new file mode 100644 index 0000000..b2c0354 --- /dev/null +++ b/microboot-tomcat/src/main/view/static/error-400.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + +

对不起,出现了400错误!

+ + + \ No newline at end of file diff --git a/microboot-tomcat/src/main/view/static/error-404.html b/microboot-tomcat/src/main/view/static/error-404.html new file mode 100644 index 0000000..b8c630a --- /dev/null +++ b/microboot-tomcat/src/main/view/static/error-404.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + +

对不起,出现了404错误!

+ + + \ No newline at end of file diff --git a/microboot-tomcat/src/main/view/static/error-500.html b/microboot-tomcat/src/main/view/static/error-500.html new file mode 100644 index 0000000..5e115ec --- /dev/null +++ b/microboot-tomcat/src/main/view/static/error-500.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + +

对不起,出现了500错误!

+ + + \ No newline at end of file diff --git a/microboot-tomcat/src/main/view/static/images/dog.jpg b/microboot-tomcat/src/main/view/static/images/dog.jpg new file mode 100644 index 0000000..07753f6 Binary files /dev/null and b/microboot-tomcat/src/main/view/static/images/dog.jpg differ diff --git a/microboot-tomcat/src/main/view/static/images/mldn.ico b/microboot-tomcat/src/main/view/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-tomcat/src/main/view/static/images/mldn.ico differ diff --git a/microboot-tomcat/src/main/view/static/message_index.html b/microboot-tomcat/src/main/view/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-tomcat/src/main/view/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-tomcat/src/main/view/templates/error.html b/microboot-tomcat/src/main/view/templates/error.html new file mode 100644 index 0000000..844ac14 --- /dev/null +++ b/microboot-tomcat/src/main/view/templates/error.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + +

+

+ + \ No newline at end of file diff --git a/microboot-tomcat/src/main/view/templates/member_add.html b/microboot-tomcat/src/main/view/templates/member_add.html new file mode 100644 index 0000000..bf0ff61 --- /dev/null +++ b/microboot-tomcat/src/main/view/templates/member_add.html @@ -0,0 +1,18 @@ + + + + SpringBoot模版渲染 + + + + +

+ 用户邮箱:
+ 用户年龄:
+ 用户工资:
+ 用户生日:
+ + +
+ + \ No newline at end of file diff --git a/microboot-tomcat/src/main/view/templates/message/message_show.html b/microboot-tomcat/src/main/view/templates/message/message_show.html new file mode 100644 index 0000000..9126f0b --- /dev/null +++ b/microboot-tomcat/src/main/view/templates/message/message_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + +

+

+ + \ No newline at end of file diff --git a/microboot-tomcat/src/main/webapp/WEB-INF/web.xml b/microboot-tomcat/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..8f738ef --- /dev/null +++ b/microboot-tomcat/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,30 @@ + + + + + Welcome to Tomcat + + Welcome to Tomcat + + + diff --git a/microboot-tomcat/src/test/java/cn/mldn/microboot/AppTest.java b/microboot-tomcat/src/test/java/cn/mldn/microboot/AppTest.java new file mode 100644 index 0000000..a094258 --- /dev/null +++ b/microboot-tomcat/src/test/java/cn/mldn/microboot/AppTest.java @@ -0,0 +1,38 @@ +package cn.mldn.microboot; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/microboot-tomcat/src/test/java/cn/mldn/microboot/test/TestMessageController.java b/microboot-tomcat/src/test/java/cn/mldn/microboot/test/TestMessageController.java new file mode 100644 index 0000000..2f21c5d --- /dev/null +++ b/microboot-tomcat/src/test/java/cn/mldn/microboot/test/TestMessageController.java @@ -0,0 +1,19 @@ +package cn.mldn.microboot.test; + +import javax.annotation.Resource; + +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +import cn.mldn.microboot.StartSpringBootMain; +import cn.mldn.microboot.controller.MemberController; + +@SpringBootTest(classes = StartSpringBootMain.class) +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +public class TestMessageController { + @Resource + private MemberController messageController; +} diff --git a/microboot-tomcat/target/classes/application.yml b/microboot-tomcat/target/classes/application.yml new file mode 100644 index 0000000..ed9c39f --- /dev/null +++ b/microboot-tomcat/target/classes/application.yml @@ -0,0 +1,7 @@ +server: + port: 443 # https的端口设置为443 + ssl: + key-store: classpath:keystore.p12 # keystore配置文件路径 + key-store-type: PKCS12 # keystore类型 + key-alias: mytomcat # 设置的别名 + key-password: mldnjava # 访问密码 \ No newline at end of file diff --git a/microboot-tomcat/target/classes/cn/mldn/microboot/StartSpringBootMain.class b/microboot-tomcat/target/classes/cn/mldn/microboot/StartSpringBootMain.class new file mode 100644 index 0000000..3028186 Binary files /dev/null and b/microboot-tomcat/target/classes/cn/mldn/microboot/StartSpringBootMain.class differ diff --git a/microboot-tomcat/target/classes/cn/mldn/microboot/advice/GlobalExceptionHandler$1ErrorInfo.class b/microboot-tomcat/target/classes/cn/mldn/microboot/advice/GlobalExceptionHandler$1ErrorInfo.class new file mode 100644 index 0000000..75991a7 Binary files /dev/null and b/microboot-tomcat/target/classes/cn/mldn/microboot/advice/GlobalExceptionHandler$1ErrorInfo.class differ diff --git a/microboot-tomcat/target/classes/cn/mldn/microboot/advice/GlobalExceptionHandler.class b/microboot-tomcat/target/classes/cn/mldn/microboot/advice/GlobalExceptionHandler.class new file mode 100644 index 0000000..7d764b7 Binary files /dev/null and b/microboot-tomcat/target/classes/cn/mldn/microboot/advice/GlobalExceptionHandler.class differ diff --git a/microboot-tomcat/target/classes/cn/mldn/microboot/config/ErrorPageConfig$1.class b/microboot-tomcat/target/classes/cn/mldn/microboot/config/ErrorPageConfig$1.class new file mode 100644 index 0000000..c64746a Binary files /dev/null and b/microboot-tomcat/target/classes/cn/mldn/microboot/config/ErrorPageConfig$1.class differ diff --git a/microboot-tomcat/target/classes/cn/mldn/microboot/config/ErrorPageConfig.class b/microboot-tomcat/target/classes/cn/mldn/microboot/config/ErrorPageConfig.class new file mode 100644 index 0000000..ba8fb13 Binary files /dev/null and b/microboot-tomcat/target/classes/cn/mldn/microboot/config/ErrorPageConfig.class differ diff --git a/microboot-tomcat/target/classes/cn/mldn/microboot/config/HttpConnectorConfig$1.class b/microboot-tomcat/target/classes/cn/mldn/microboot/config/HttpConnectorConfig$1.class new file mode 100644 index 0000000..b53306f Binary files /dev/null and b/microboot-tomcat/target/classes/cn/mldn/microboot/config/HttpConnectorConfig$1.class differ diff --git a/microboot-tomcat/target/classes/cn/mldn/microboot/config/HttpConnectorConfig.class b/microboot-tomcat/target/classes/cn/mldn/microboot/config/HttpConnectorConfig.class new file mode 100644 index 0000000..4dac0e9 Binary files /dev/null and b/microboot-tomcat/target/classes/cn/mldn/microboot/config/HttpConnectorConfig.class differ diff --git a/microboot-tomcat/target/classes/cn/mldn/microboot/controller/MemberController.class b/microboot-tomcat/target/classes/cn/mldn/microboot/controller/MemberController.class new file mode 100644 index 0000000..49f0a7f Binary files /dev/null and b/microboot-tomcat/target/classes/cn/mldn/microboot/controller/MemberController.class differ diff --git a/microboot-tomcat/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class b/microboot-tomcat/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class new file mode 100644 index 0000000..e043da7 Binary files /dev/null and b/microboot-tomcat/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class differ diff --git a/microboot-tomcat/target/classes/cn/mldn/microboot/vo/Member.class b/microboot-tomcat/target/classes/cn/mldn/microboot/vo/Member.class new file mode 100644 index 0000000..d4a21c9 Binary files /dev/null and b/microboot-tomcat/target/classes/cn/mldn/microboot/vo/Member.class differ diff --git a/microboot-tomcat/target/classes/i18n/Messages.properties b/microboot-tomcat/target/classes/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-tomcat/target/classes/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-tomcat/target/classes/i18n/Pages.properties b/microboot-tomcat/target/classes/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-tomcat/target/classes/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-tomcat/target/classes/keystore.p12 b/microboot-tomcat/target/classes/keystore.p12 new file mode 100644 index 0000000..0884b8b Binary files /dev/null and b/microboot-tomcat/target/classes/keystore.p12 differ diff --git a/microboot-tomcat/target/classes/static/error-400.html b/microboot-tomcat/target/classes/static/error-400.html new file mode 100644 index 0000000..b2c0354 --- /dev/null +++ b/microboot-tomcat/target/classes/static/error-400.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + +

对不起,出现了400错误!

+ + + \ No newline at end of file diff --git a/microboot-tomcat/target/classes/static/error-404.html b/microboot-tomcat/target/classes/static/error-404.html new file mode 100644 index 0000000..b8c630a --- /dev/null +++ b/microboot-tomcat/target/classes/static/error-404.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + +

对不起,出现了404错误!

+ + + \ No newline at end of file diff --git a/microboot-tomcat/target/classes/static/error-500.html b/microboot-tomcat/target/classes/static/error-500.html new file mode 100644 index 0000000..5e115ec --- /dev/null +++ b/microboot-tomcat/target/classes/static/error-500.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + +

对不起,出现了500错误!

+ + + \ No newline at end of file diff --git a/microboot-tomcat/target/classes/static/images/dog.jpg b/microboot-tomcat/target/classes/static/images/dog.jpg new file mode 100644 index 0000000..07753f6 Binary files /dev/null and b/microboot-tomcat/target/classes/static/images/dog.jpg differ diff --git a/microboot-tomcat/target/classes/static/images/mldn.ico b/microboot-tomcat/target/classes/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-tomcat/target/classes/static/images/mldn.ico differ diff --git a/microboot-tomcat/target/classes/static/message_index.html b/microboot-tomcat/target/classes/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-tomcat/target/classes/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-tomcat/target/classes/templates/error.html b/microboot-tomcat/target/classes/templates/error.html new file mode 100644 index 0000000..844ac14 --- /dev/null +++ b/microboot-tomcat/target/classes/templates/error.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + +

+

+ + \ No newline at end of file diff --git a/microboot-tomcat/target/classes/templates/member_add.html b/microboot-tomcat/target/classes/templates/member_add.html new file mode 100644 index 0000000..bf0ff61 --- /dev/null +++ b/microboot-tomcat/target/classes/templates/member_add.html @@ -0,0 +1,18 @@ + + + + SpringBoot模版渲染 + + + + +

+ 用户邮箱:
+ 用户年龄:
+ 用户工资:
+ 用户生日:
+ + +
+ + \ No newline at end of file diff --git a/microboot-tomcat/target/classes/templates/message/message_show.html b/microboot-tomcat/target/classes/templates/message/message_show.html new file mode 100644 index 0000000..9126f0b --- /dev/null +++ b/microboot-tomcat/target/classes/templates/message/message_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + +

+

+ + \ No newline at end of file diff --git a/microboot-tomcat/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF b/microboot-tomcat/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d4c16dd --- /dev/null +++ b/microboot-tomcat/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Built-By: foreveriss +Build-Jdk: 1.8.0_121 +Created-By: Maven Integration for Eclipse + diff --git a/microboot-tomcat/target/m2e-wtp/web-resources/META-INF/maven/cn.mldn/microboot-tomcat/pom.properties b/microboot-tomcat/target/m2e-wtp/web-resources/META-INF/maven/cn.mldn/microboot-tomcat/pom.properties new file mode 100644 index 0000000..7d13d54 --- /dev/null +++ b/microboot-tomcat/target/m2e-wtp/web-resources/META-INF/maven/cn.mldn/microboot-tomcat/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Thu Jun 29 23:45:22 CST 2017 +version=0.0.1-SNAPSHOT +groupId=cn.mldn +m2e.projectName=microboot-tomcat +m2e.projectLocation=/Users/foreveriss/workspace/microboot/microboot-tomcat +artifactId=microboot-tomcat diff --git a/microboot-tomcat/target/m2e-wtp/web-resources/META-INF/maven/cn.mldn/microboot-tomcat/pom.xml b/microboot-tomcat/target/m2e-wtp/web-resources/META-INF/maven/cn.mldn/microboot-tomcat/pom.xml new file mode 100644 index 0000000..19df157 --- /dev/null +++ b/microboot-tomcat/target/m2e-wtp/web-resources/META-INF/maven/cn.mldn/microboot-tomcat/pom.xml @@ -0,0 +1,65 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + war + microboot-tomcat + microboot-tomcat + http://maven.apache.org + + UTF-8 + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + + microboot-tomcat + + + org.apache.maven.plugins + maven-war-plugin + + mldn + + + + + diff --git a/microboot-tomcat/target/test-classes/cn/mldn/microboot/AppTest.class b/microboot-tomcat/target/test-classes/cn/mldn/microboot/AppTest.class new file mode 100644 index 0000000..d317ee0 Binary files /dev/null and b/microboot-tomcat/target/test-classes/cn/mldn/microboot/AppTest.class differ diff --git a/microboot-tomcat/target/test-classes/cn/mldn/microboot/test/TestMessageController.class b/microboot-tomcat/target/test-classes/cn/mldn/microboot/test/TestMessageController.class new file mode 100644 index 0000000..d803ec7 Binary files /dev/null and b/microboot-tomcat/target/test-classes/cn/mldn/microboot/test/TestMessageController.class differ diff --git a/microboot-upload/.classpath b/microboot-upload/.classpath new file mode 100644 index 0000000..a6f04e8 --- /dev/null +++ b/microboot-upload/.classpath @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/microboot-upload/.project b/microboot-upload/.project new file mode 100644 index 0000000..4d6a9b9 --- /dev/null +++ b/microboot-upload/.project @@ -0,0 +1,35 @@ + + + microboot-upload + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/microboot-upload/.settings/org.eclipse.core.resources.prefs b/microboot-upload/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..a6dcfb7 --- /dev/null +++ b/microboot-upload/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/main/view=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/microboot-upload/.settings/org.eclipse.jdt.core.prefs b/microboot-upload/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..d59e09c --- /dev/null +++ b/microboot-upload/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/microboot-upload/.settings/org.eclipse.m2e.core.prefs b/microboot-upload/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/microboot-upload/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/microboot-upload/.settings/org.eclipse.wst.common.project.facet.core.xml b/microboot-upload/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..e822977 --- /dev/null +++ b/microboot-upload/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ + + + + diff --git a/microboot-upload/pom.xml b/microboot-upload/pom.xml new file mode 100644 index 0000000..d203f91 --- /dev/null +++ b/microboot-upload/pom.xml @@ -0,0 +1,58 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-upload + microboot-upload + http://maven.apache.org + + UTF-8 + + + + com.github.kischang + fastdfs-client + 0.1 + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-upload/src/main/java/cn/mldn/microboot/StartSpringBootMain.java b/microboot-upload/src/main/java/cn/mldn/microboot/StartSpringBootMain.java new file mode 100644 index 0000000..3e42f08 --- /dev/null +++ b/microboot-upload/src/main/java/cn/mldn/microboot/StartSpringBootMain.java @@ -0,0 +1,11 @@ +package cn.mldn.microboot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.web.multipart.MultipartFile; +@SpringBootApplication // 启动SpringBoot程序,而后自带子包扫描 +public class StartSpringBootMain { + public static void main(String[] args) throws Exception { + SpringApplication.run(StartSpringBootMain.class, args); + } +} diff --git a/microboot-upload/src/main/java/cn/mldn/microboot/config/UploadConfig.java b/microboot-upload/src/main/java/cn/mldn/microboot/config/UploadConfig.java new file mode 100644 index 0000000..8585d63 --- /dev/null +++ b/microboot-upload/src/main/java/cn/mldn/microboot/config/UploadConfig.java @@ -0,0 +1,19 @@ +package cn.mldn.microboot.config; + +import javax.servlet.MultipartConfigElement; + +import org.springframework.boot.web.servlet.MultipartConfigFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class UploadConfig { + @Bean + public MultipartConfigElement getMultipartConfig() { + MultipartConfigFactory config = new MultipartConfigFactory() ; + config.setMaxFileSize("10MB"); // 设置上传文件的单个大小限制 + config.setMaxRequestSize("100MB"); // 设置总的上传的大小限制 + config.setLocation("/"); // 设置临时保存目录 + return config.createMultipartConfig() ; // 创建一个上传配置 + } +} diff --git a/microboot-upload/src/main/java/cn/mldn/microboot/controller/UploadController.java b/microboot-upload/src/main/java/cn/mldn/microboot/controller/UploadController.java new file mode 100644 index 0000000..c0a678f --- /dev/null +++ b/microboot-upload/src/main/java/cn/mldn/microboot/controller/UploadController.java @@ -0,0 +1,103 @@ +package cn.mldn.microboot.controller; + +import java.util.Iterator; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; + +import org.csource.common.NameValuePair; +import org.csource.fastdfs.ClientGlobal; +import org.csource.fastdfs.ProtoCommon; +import org.csource.fastdfs.StorageClient1; +import org.csource.fastdfs.StorageServer; +import org.csource.fastdfs.TrackerClient; +import org.csource.fastdfs.TrackerServer; +import org.springframework.core.io.ClassPathResource; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; + +import cn.mldn.microboot.util.controller.AbstractBaseController; + +@Controller +public class UploadController extends AbstractBaseController { + @RequestMapping(value = "/uploadPre", method = RequestMethod.GET) + public String uploadPre() { // 通过model可以实现内容的传递 + return "upload_page"; + } + @RequestMapping(value = "/show", method = RequestMethod.GET) + public String show(String groupId, String fileId,Model model) throws Exception { + // 通过ClassPath路径获取要使用的配置文件 + ClassPathResource classPathResource = new ClassPathResource( + "fastdfs_client.conf"); + // 进行客户端访问的整体配置,需要知道配置文件的完整路径 + ClientGlobal.init(classPathResource.getClassLoader() + .getResource("fastdfs_client.conf").getPath()); + // FastDFS的核心操作在于tracker处理上,所以此时需要定义Tracker客户端 + TrackerClient trackerClient = new TrackerClient(); + // 定义TrackerServer的配置信息 + TrackerServer trackerServer = trackerClient.getConnection(); + int ts = (int) (System.currentTimeMillis() / 1000);// 时间参考 + StringBuffer fileUrl = new StringBuffer(); + fileUrl.append("http://"); + fileUrl.append("fastdfs-tracker"); + fileUrl.append("/" + groupId + "/").append(fileId); + fileUrl.append("?token=").append( + ProtoCommon.getToken(fileId, ts, ClientGlobal.g_secret_key)); + fileUrl.append("&ts=").append(ts); + System.out.println(fileUrl); + trackerServer.close(); + model.addAttribute("image", fileUrl) ; + return "upload_show" ; + } + + @RequestMapping(value = "/upload", method = RequestMethod.POST) + @ResponseBody + public String upload(String name, HttpServletRequest request) + throws Exception { + if (request instanceof MultipartHttpServletRequest) { // 如果你现在是MultipartHttpServletRequest对象 + MultipartHttpServletRequest mrequest = (MultipartHttpServletRequest) request; + List files = mrequest.getFiles("photo"); + Iterator iter = files.iterator(); + while (iter.hasNext()) { + MultipartFile photo = iter.next(); + if (photo != null) { // 现在有文件上传 + // 如果要想进行上传则一定需要获取到文件的扩展名称 + String fileExtName = photo.getContentType().substring( + photo.getContentType().lastIndexOf("/") + 1); + // 通过ClassPath路径获取要使用的配置文件 + ClassPathResource classPathResource = new ClassPathResource( + "fastdfs_client.conf"); + // 进行客户端访问的整体配置,需要知道配置文件的完整路径 + ClientGlobal.init(classPathResource.getClassLoader() + .getResource("fastdfs_client.conf").getPath()); + // FastDFS的核心操作在于tracker处理上,所以此时需要定义Tracker客户端 + TrackerClient trackerClient = new TrackerClient(); + // 定义TrackerServer的配置信息 + TrackerServer trackerServer = trackerClient.getConnection(); + // 在整个FastDFS之中真正负责干活的就是Storage + StorageServer storageServer = null; + StorageClient1 storageClient = new StorageClient1( + trackerServer, storageServer); + // 定义上传文件的元数据 + NameValuePair[] metaList = new NameValuePair[3]; + metaList[0] = new NameValuePair("fileName", + photo.getOriginalFilename()); + metaList[1] = new NameValuePair("fileExtName", fileExtName); + metaList[2] = new NameValuePair("fileLength", + String.valueOf(photo.getSize())); + // 如果要上传则使用trackerClient对象完成 + String upload_file = storageClient.upload_file1( + photo.getBytes(), fileExtName, metaList); + System.out.println(upload_file); + trackerServer.close(); + } + } + } + return "upload-file"; + } +} diff --git a/microboot-upload/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java b/microboot-upload/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java new file mode 100644 index 0000000..5127e93 --- /dev/null +++ b/microboot-upload/src/main/java/cn/mldn/microboot/util/controller/AbstractBaseController.java @@ -0,0 +1,15 @@ +package cn.mldn.microboot.util.controller; + +import java.util.Locale; + +import javax.annotation.Resource; + +import org.springframework.context.MessageSource; + +public abstract class AbstractBaseController { + @Resource + private MessageSource messageSource; // 自动注入此资源对象 + public String getMessage(String key, String... args) { + return this.messageSource.getMessage(key, args, Locale.getDefault()); + } +} diff --git a/microboot-upload/src/main/java/cn/mldn/microboot/vo/Member.java b/microboot-upload/src/main/java/cn/mldn/microboot/vo/Member.java new file mode 100644 index 0000000..f6a9cd8 --- /dev/null +++ b/microboot-upload/src/main/java/cn/mldn/microboot/vo/Member.java @@ -0,0 +1,44 @@ +package cn.mldn.microboot.vo; + +import java.io.Serializable; +import java.util.Date; + +@SuppressWarnings("serial") +public class Member implements Serializable { + private Long mid ; + private String name ; + private Integer age ; + private Date birthday ; + private Double salary ; + public Long getMid() { + return mid; + } + public void setMid(Long mid) { + this.mid = mid; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public Integer getAge() { + return age; + } + public void setAge(Integer age) { + this.age = age; + } + public Date getBirthday() { + return birthday; + } + public void setBirthday(Date birthday) { + this.birthday = birthday; + } + public Double getSalary() { + return salary; + } + public void setSalary(Double salary) { + this.salary = salary; + } +} + diff --git a/microboot-upload/src/main/resources/application.yml b/microboot-upload/src/main/resources/application.yml new file mode 100644 index 0000000..3fcd375 --- /dev/null +++ b/microboot-upload/src/main/resources/application.yml @@ -0,0 +1,12 @@ +server: + port: 80 +spring: + messages: + basename: i18n/Messages,i18n/Pages +# http: +# multipart: +# enabled: true # 可以启用http上传 +# max-file-size: 1KB # 设置支持的单个上传文件的大小限制 +# max-request-size: 20MB # 设置最大的请求的文件大小,设置总体大小请求 +# file-size-threshold: 512KB # 当上传文件达到指定配置量的时候会将文件内容写入磁盘 +# location: / # 设置上传的临时目录 \ No newline at end of file diff --git a/microboot-upload/src/main/resources/fastdfs_client.conf b/microboot-upload/src/main/resources/fastdfs_client.conf new file mode 100644 index 0000000..3f0fbb0 --- /dev/null +++ b/microboot-upload/src/main/resources/fastdfs_client.conf @@ -0,0 +1,6 @@ +# 配置上你tracker的连接地址 +tracker_server=fastdfs-tracker:22122 +# 表示现在要进行token检测 +http.anti_steal_token=true +# 进行认证的密码处理 +http.secret_key=mldnhelloworldhahheihanhheiehinajueduicaibudao \ No newline at end of file diff --git a/microboot-upload/src/main/resources/i18n/Messages.properties b/microboot-upload/src/main/resources/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-upload/src/main/resources/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-upload/src/main/resources/i18n/Pages.properties b/microboot-upload/src/main/resources/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-upload/src/main/resources/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-upload/src/main/view/static/images/mldn.ico b/microboot-upload/src/main/view/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-upload/src/main/view/static/images/mldn.ico differ diff --git a/microboot-upload/src/main/view/static/info/message_info.html b/microboot-upload/src/main/view/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-upload/src/main/view/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-upload/src/main/view/static/js/main.js b/microboot-upload/src/main/view/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-upload/src/main/view/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-upload/src/main/view/static/message_index.html b/microboot-upload/src/main/view/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-upload/src/main/view/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-upload/src/main/view/templates/upload_page.html b/microboot-upload/src/main/view/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-upload/src/main/view/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-upload/src/main/view/templates/upload_show.html b/microboot-upload/src/main/view/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-upload/src/main/view/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-upload/src/test/java/cn/mldn/microboot/AppTest.java b/microboot-upload/src/test/java/cn/mldn/microboot/AppTest.java new file mode 100644 index 0000000..a094258 --- /dev/null +++ b/microboot-upload/src/test/java/cn/mldn/microboot/AppTest.java @@ -0,0 +1,38 @@ +package cn.mldn.microboot; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/microboot-upload/src/test/java/cn/mldn/microboot/test/TestMessageController.java b/microboot-upload/src/test/java/cn/mldn/microboot/test/TestMessageController.java new file mode 100644 index 0000000..9c48742 --- /dev/null +++ b/microboot-upload/src/test/java/cn/mldn/microboot/test/TestMessageController.java @@ -0,0 +1,19 @@ +package cn.mldn.microboot.test; + +import javax.annotation.Resource; + +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +import cn.mldn.microboot.StartSpringBootMain; +import cn.mldn.microboot.controller.UploadController; + +@SpringBootTest(classes = StartSpringBootMain.class) +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +public class TestMessageController { + @Resource + private UploadController messageController; +} diff --git a/microboot-upload/target/classes/META-INF/MANIFEST.MF b/microboot-upload/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d4c16dd --- /dev/null +++ b/microboot-upload/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Built-By: foreveriss +Build-Jdk: 1.8.0_121 +Created-By: Maven Integration for Eclipse + diff --git a/microboot-upload/target/classes/META-INF/maven/cn.mldn/microboot-upload/pom.properties b/microboot-upload/target/classes/META-INF/maven/cn.mldn/microboot-upload/pom.properties new file mode 100644 index 0000000..1fe1ef5 --- /dev/null +++ b/microboot-upload/target/classes/META-INF/maven/cn.mldn/microboot-upload/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Thu Jun 29 23:45:23 CST 2017 +version=0.0.1-SNAPSHOT +groupId=cn.mldn +m2e.projectName=microboot-upload +m2e.projectLocation=/Users/foreveriss/workspace/microboot/microboot-upload +artifactId=microboot-upload diff --git a/microboot-upload/target/classes/META-INF/maven/cn.mldn/microboot-upload/pom.xml b/microboot-upload/target/classes/META-INF/maven/cn.mldn/microboot-upload/pom.xml new file mode 100644 index 0000000..d203f91 --- /dev/null +++ b/microboot-upload/target/classes/META-INF/maven/cn.mldn/microboot-upload/pom.xml @@ -0,0 +1,58 @@ + + + 4.0.0 + + cn.mldn + microboot + 0.0.1-SNAPSHOT + + microboot-upload + microboot-upload + http://maven.apache.org + + UTF-8 + + + + com.github.kischang + fastdfs-client + 0.1 + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + + + org.springframework + springloaded + + + org.springframework.boot + spring-boot-devtools + + + + diff --git a/microboot-upload/target/classes/application.yml b/microboot-upload/target/classes/application.yml new file mode 100644 index 0000000..3fcd375 --- /dev/null +++ b/microboot-upload/target/classes/application.yml @@ -0,0 +1,12 @@ +server: + port: 80 +spring: + messages: + basename: i18n/Messages,i18n/Pages +# http: +# multipart: +# enabled: true # 可以启用http上传 +# max-file-size: 1KB # 设置支持的单个上传文件的大小限制 +# max-request-size: 20MB # 设置最大的请求的文件大小,设置总体大小请求 +# file-size-threshold: 512KB # 当上传文件达到指定配置量的时候会将文件内容写入磁盘 +# location: / # 设置上传的临时目录 \ No newline at end of file diff --git a/microboot-upload/target/classes/cn/mldn/microboot/StartSpringBootMain.class b/microboot-upload/target/classes/cn/mldn/microboot/StartSpringBootMain.class new file mode 100644 index 0000000..eb9ab34 Binary files /dev/null and b/microboot-upload/target/classes/cn/mldn/microboot/StartSpringBootMain.class differ diff --git a/microboot-upload/target/classes/cn/mldn/microboot/config/UploadConfig.class b/microboot-upload/target/classes/cn/mldn/microboot/config/UploadConfig.class new file mode 100644 index 0000000..307567c Binary files /dev/null and b/microboot-upload/target/classes/cn/mldn/microboot/config/UploadConfig.class differ diff --git a/microboot-upload/target/classes/cn/mldn/microboot/controller/UploadController.class b/microboot-upload/target/classes/cn/mldn/microboot/controller/UploadController.class new file mode 100644 index 0000000..7423c0e Binary files /dev/null and b/microboot-upload/target/classes/cn/mldn/microboot/controller/UploadController.class differ diff --git a/microboot-upload/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class b/microboot-upload/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class new file mode 100644 index 0000000..57c2010 Binary files /dev/null and b/microboot-upload/target/classes/cn/mldn/microboot/util/controller/AbstractBaseController.class differ diff --git a/microboot-upload/target/classes/cn/mldn/microboot/vo/Member.class b/microboot-upload/target/classes/cn/mldn/microboot/vo/Member.class new file mode 100644 index 0000000..59c00d5 Binary files /dev/null and b/microboot-upload/target/classes/cn/mldn/microboot/vo/Member.class differ diff --git a/microboot-upload/target/classes/fastdfs_client.conf b/microboot-upload/target/classes/fastdfs_client.conf new file mode 100644 index 0000000..3f0fbb0 --- /dev/null +++ b/microboot-upload/target/classes/fastdfs_client.conf @@ -0,0 +1,6 @@ +# 配置上你tracker的连接地址 +tracker_server=fastdfs-tracker:22122 +# 表示现在要进行token检测 +http.anti_steal_token=true +# 进行认证的密码处理 +http.secret_key=mldnhelloworldhahheihanhheiehinajueduicaibudao \ No newline at end of file diff --git a/microboot-upload/target/classes/i18n/Messages.properties b/microboot-upload/target/classes/i18n/Messages.properties new file mode 100644 index 0000000..83d9229 --- /dev/null +++ b/microboot-upload/target/classes/i18n/Messages.properties @@ -0,0 +1,2 @@ +welcome.url=www.mldn.cn +welcome.msg=\u6b22\u8fce{0}\u5149\u4e34\uff01 \ No newline at end of file diff --git a/microboot-upload/target/classes/i18n/Pages.properties b/microboot-upload/target/classes/i18n/Pages.properties new file mode 100644 index 0000000..7acc581 --- /dev/null +++ b/microboot-upload/target/classes/i18n/Pages.properties @@ -0,0 +1,2 @@ +member.add.page=/pages/back/admin/member/member_add.jsp +member.add.action=/pages/back/admin/member/member_add.action \ No newline at end of file diff --git a/microboot-upload/target/classes/static/images/mldn.ico b/microboot-upload/target/classes/static/images/mldn.ico new file mode 100644 index 0000000..da399ba Binary files /dev/null and b/microboot-upload/target/classes/static/images/mldn.ico differ diff --git a/microboot-upload/target/classes/static/info/message_info.html b/microboot-upload/target/classes/static/info/message_info.html new file mode 100644 index 0000000..1b66139 --- /dev/null +++ b/microboot-upload/target/classes/static/info/message_info.html @@ -0,0 +1,11 @@ + + + + SpringBoot模版渲染 + + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-upload/target/classes/static/js/main.js b/microboot-upload/target/classes/static/js/main.js new file mode 100644 index 0000000..c8ae7c9 --- /dev/null +++ b/microboot-upload/target/classes/static/js/main.js @@ -0,0 +1,3 @@ +window.onload = function() { + console.log("****** www.mldn.cn ******") ; +} \ No newline at end of file diff --git a/microboot-upload/target/classes/static/message_index.html b/microboot-upload/target/classes/static/message_index.html new file mode 100644 index 0000000..af5e4d0 --- /dev/null +++ b/microboot-upload/target/classes/static/message_index.html @@ -0,0 +1,10 @@ + + + + SpringBoot模版渲染 + + + +

www.mldn.cn

+ + \ No newline at end of file diff --git a/microboot-upload/target/classes/templates/upload_page.html b/microboot-upload/target/classes/templates/upload_page.html new file mode 100644 index 0000000..5f71423 --- /dev/null +++ b/microboot-upload/target/classes/templates/upload_page.html @@ -0,0 +1,21 @@ + + + + SpringBoot模版渲染 + + + + + +
+ 姓名:
+ 照片:
+ 照片:
+ 照片:
+ +
+ 查看照片 + 查看照片 + 查看照片 + + \ No newline at end of file diff --git a/microboot-upload/target/classes/templates/upload_show.html b/microboot-upload/target/classes/templates/upload_show.html new file mode 100644 index 0000000..0e86d94 --- /dev/null +++ b/microboot-upload/target/classes/templates/upload_show.html @@ -0,0 +1,12 @@ + + + + SpringBoot模版渲染 + + + + + + + + \ No newline at end of file diff --git a/microboot-upload/target/test-classes/cn/mldn/microboot/AppTest.class b/microboot-upload/target/test-classes/cn/mldn/microboot/AppTest.class new file mode 100644 index 0000000..d317ee0 Binary files /dev/null and b/microboot-upload/target/test-classes/cn/mldn/microboot/AppTest.class differ diff --git a/microboot-upload/target/test-classes/cn/mldn/microboot/test/TestMessageController.class b/microboot-upload/target/test-classes/cn/mldn/microboot/test/TestMessageController.class new file mode 100644 index 0000000..ae5d598 Binary files /dev/null and b/microboot-upload/target/test-classes/cn/mldn/microboot/test/TestMessageController.class differ diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..28c82f1 --- /dev/null +++ b/pom.xml @@ -0,0 +1,135 @@ + + 4.0.0 + cn.mldn + microboot + 0.0.1-SNAPSHOT + pom + microboot + http://maven.apache.org + + 1.8 + UTF-8 + + + + + org.springframework.boot + spring-boot-dependencies + 1.5.4.RELEASE + pom + import + + + mysql + mysql-connector-java + 5.0.4 + + + com.alibaba + druid + 1.0.31 + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 1.3.0 + + + + + microboot + + + src/main/resources + + **/*.properties + **/*.yml + **/*.xml + **/*.tld + **/*.p12 + **/*.conf + + true + + + src/main/java + + **/*.properties + **/*.xml + **/*.tld + + false + + + src/main/view + + **/*.* + + false + + + + + org.apache.maven.plugins + maven-resources-plugin + + + $ + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + ${jdk.version} + ${jdk.version} + ${project.build.sourceEncoding} + + + + org.springframework.boot + spring-boot-maven-plugin + + cn.mldn.microboot.StartSpringBootMain + + + + + repackage + + + + + + + + microboot-base + microboot-advance + microboot-error + microboot-tomcat + microboot-thymeleaf + microboot-upload + microboot-interceptor + microboot-mybatis + microboot-activemq + microboot-rabbitmq-consumer + microboot-rabbitmq-producer + microboot-kafka-consumer + microboot-kafka-producer + microboot-email + microboot-task + microboot-actuator + microboot-redis + microboot-restful-api + microboot-restful-provider + microboot-restful-consumer + microboot-restful-swagger + microboot-restful-log + microboot-shiro-api + microboot-shiro-member-provider + microboot-shiro-web + +