diff --git a/README.md b/README.md new file mode 100644 index 0000000..a4fbd47 --- /dev/null +++ b/README.md @@ -0,0 +1,156 @@ +# Spring Boot Demo + +spring boot demo 是整合 logback、mybatis的 demo 项目,后续会加整合ctivemq,redis,email, freemarker,shiro,websocket,sitemesh,ehcache,easyui,kindeditor,quartz,springfox,swagger,jpa,hibernate,querydsl,netty等的 demo。 + +依赖的 Spring Boot 版本: + +```xml + + org.springframework.boot + spring-boot-starter-parent + 1.5.8.RELEASE + + +``` + +### spring-boot-demo-parent + +所有的 **Module** 均依赖:[**spring-boot-demo-parent**](./spring-boot-demo-parent) + +### pom.xml + +```xml + + + 4.0.0 + + com.xkcoding + spring-boot-demo-parent + 0.0.1-SNAPSHOT + pom + + spring-boot-demo-parent + The parent of spring-boot-demo + + + ../spring-boot-demo-helloworld + ../spring-boot-demo-logback + ../spring-boot-demo-mybatis + + + + org.springframework.boot + spring-boot-starter-parent + 1.5.8.RELEASE + + + + + UTF-8 + UTF-8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + + + mysql + mysql-connector-java + + + + com.xiaoleilu + hutool-all + 3.1.2 + + + com.google.guava + guava + 20.0 + + + org.projectlombok + lombok + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + +``` + +### 各 Module 介绍 + +| Module 名称 | Module 介绍 | +| ---------------------------------------- | ---------------------------------------- | +| [spring-boot-demo-helloworld](./spring-boot-demo-helloworld) | spring-boot 的一个 helloworld | +| [spring-boot-demo-logback](./spring-boot-demo-logback) | spring-boot 集成 logback 日志 | +| [spring-boot-demo-mybatis](./spring-boot-demo-mybatis) | spring-boot 集成 [mybatis-spring-boot-starter](https://github.com/mybatis/spring-boot-starter)、[mybatis-spring-boot-starter](https://github.com/alibaba/druid/tree/master/druid-spring-boot-starter) | + + + +# 官方提供的 starter 介绍 + +| Name | Description | +| :------------------------------------- | :--------------------------------------- | +| spring-boot-starter | The core Spring Boot starter, including auto-configuration support, logging and YAML. | +| spring-boot-starter-actuator | Production ready features to help you monitor and manage your application. | +| spring-boot-starter-amqp | are neat | +| spring-boot-starter-aop | Support for aspect-oriented programming including spring-aop and AspectJ. | +| spring-boot-starter-artemis | Support for “Java Message Service API” via Apache Artemis. | +| spring-boot-starter-batch | Support for “Spring Batch” including HSQLDB database. | +| spring-boot-starter-cache | Support for Spring’s Cache abstraction. | +| spring-boot-starter-cloud-connectors | Support for “Spring Cloud Connectors” which simplifies connecting to services in cloud platforms like Cloud Foundry and Heroku. | +| spring-boot-starter-data-elasticsearch | Support for the Elasticsearch search and analytics engine including spring-data-elasticsearch. | +| spring-boot-starter-data-gemfire | Support for the GemFire distributed data store including spring-data-gemfire. | +| spring-boot-starter-data-jpa | Support for the “Java Persistence API” including spring-data-jpa, spring-orm and Hibernate. | +| spring-boot-starter-data-mongodb | Support for the MongoDB NoSQL Database, including spring-data-mongodb. | +| spring-boot-starter-data-rest | Support for exposing Spring Data repositories over REST via spring-data-rest-webmvc. | +| spring-boot-starter-data-solr | Support for the Apache Solr search platform, including spring-data-solr. | +| spring-boot-starter-freemarker | Support for the FreeMarker templating engine. | +| spring-boot-starter-groovy-templates | Support for the Groovy templating engine. | +| spring-boot-starter-hateoas | Support for HATEOAS-based RESTful services via spring-hateoas. | +| spring-boot-starter-hornetq | Support for “Java Message Service API” via HornetQ. | +| spring-boot-starter-integration | Support for common spring-integration modules. | +| spring-boot-starter-jdbc | Support for JDBC databases. | +| spring-boot-starter-jersey | Support for the Jersey RESTful Web Services framework. | +| spring-boot-starter-jta-atomikos | Support for JTA distributed transactions via Atomikos. | +| spring-boot-starter-jta-bitronix | Support for JTA distributed transactions via Bitronix. | +| spring-boot-starter-mail | Support for javax.mail. | +| spring-boot-starter-mobile | Support for spring-mobile. | +| spring-boot-starter-mustache | Support for the Mustache templating engine. | +| spring-boot-starter-redis | Support for the REDIS key-value data store, including spring-redis. | +| spring-boot-starter-security | Support for spring-security. | +| spring-boot-starter-social-facebook | Support for spring-social-facebook. | +| spring-boot-starter-social-linkedin | Support for spring-social-linkedin. | +| spring-boot-starter-social-twitter | Support for spring-social-twitter. | +| spring-boot-starter-test | Support for common test dependencies, including JUnit, Hamcrest and Mockito along with the spring-test module. | +| spring-boot-starter-thymeleaf | Support for the Thymeleaf templating engine, including integration with Spring. | +| spring-boot-starter-velocity | Support for the Velocity templating engine. | +| spring-boot-starter-web | Support for full-stack web development, including Tomcat and spring-webmvc. | +| spring-boot-starter-websocket | Support for WebSocket development. | +| spring-boot-starter-ws | Support for Spring Web Services. | + diff --git a/spring-boot-demo-helloworld/README.md b/spring-boot-demo-helloworld/README.md new file mode 100644 index 0000000..9c907cc --- /dev/null +++ b/spring-boot-demo-helloworld/README.md @@ -0,0 +1,55 @@ +# spring-boot-demo-helloworld + +依赖 [spring-boot-demo-helloworld](../spring-boot-demo-parent) + +SpringBootDemoHelloworldApplication.java + +```java +@RestController +@SpringBootApplication +@Configuration +public class SpringBootDemoHelloworldApplication { + @Value("${spring.boot.demo.helloworld.data.version}") + private String version; + + public static void main(String[] args) { + SpringApplication.run(SpringBootDemoHelloworldApplication.class, args); + } + + @GetMapping("/hello") + public Map sayHello(@Value("${author}") String author, @Value("${exclusions}") String exclusions, @Value("${connectionProperties}") String connectionProperties) { + Map result = Maps.newHashMap(); + result.put("ret", true); + result.put("msg", StrUtil.format("hello,world,{}", author)); + Map data = Maps.newHashMap(); + data.put("version", version); + data.put("exclusions", exclusions.split(",")); + Map connectionProperty = Maps.newHashMap(); + for (String connection : connectionProperties.split(";")) { + String[] conn = connection.split("="); + connectionProperty.put(conn[0], conn[1]); + } + data.put("connectionProperties", connectionProperty); + result.put("data", data); + return result; + } +} +``` + +application.yml + +```yml +server: + port: 8080 + context-path: /demo +spring: + boot: + demo: + helloworld: + data: + version: 1.0.0 +author: xkcoding +exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*" +connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 +``` +