spring-boot学习记录——创建spring-boot应用

     闲来无事,想起来学习spring-boot,但是网上资料少之又少,现有资料讲得又很粗糙,迫于无奈,只好翻看官方英文版文档了。平时不怎么看英文文档,所以英文单词量较少,借助有道词典的桌面取词功能慢慢看吧,后悔当初没好好背单词了。~~~~(>_<)~~~~

     本文不在于讲解spring-boot,仅仅是用来记录自己所看过的文档知识,以便于以后自己翻阅。废话不多说了,开始记录吧。

    创建spring项目

     通过maven创建,pom文件继承于:

<parent>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-parent</artifactId>
	<version>1.3.2.RELEASE</version>
</parent>

     但是并非不是每个人都喜欢继承于这个parent,所以spring-boot提供了另一种依赖方式

<dependencyManagement>
    <dependencies>
        <!-- Override Spring Data release train provided by Spring Boot -->
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-releasetrain</artifactId>
            <version>Fowler-SR2</version>
            <scope>import</scope>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <version>1.3.2.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

      两种方式是一样的效果。

    spring-boot默认使用了java1.6版本,如果需要使用更高版本的jdk,则可以添加属性覆盖默认属性:

<properties>
    <java.version>1.8</java.version>
</properties>
      spring-boot使用了嵌入式web容器,使得web应用可以像普通java应用一样,通过jar包执行,那么我们就需要在packing时为应用生成一个可执行的jar包,spring-boot提供了一个maven插件生成可执行jar:
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>
      spring-boot提供了很多starter,他们的groupId均为org.springframework.boot:


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

Support for the “Advanced Message Queuing Protocol” via spring-rabbit.

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.

     好了,今天就写到这里吧,洗洗睡吧,晚安!

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.jsunw.com/?post=25

相关推荐

你肿么看?

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。