mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
parent
b665a2bb1d
commit
65a9953c86
98
README.md
98
README.md
@ -1,29 +1,29 @@
|
||||
# Spring Zero
|
||||
Spring Zero is "Spring for Snowboarders". If you are kewl, or just impatient, and you
|
||||
want to use Spring, then this is the place to be. Spring Zero is the code-name for a
|
||||
group of related technologies, that will get you up and running with
|
||||
Spring-powered, production-grade applications and services with absolute minimum fuss.
|
||||
It takes an opinionated view of the Spring family so that new and existing users can
|
||||
quickly get to the bits they need. Assumes limited knowledge of the Java development
|
||||
# Spring Boot
|
||||
Spring Boot is "Spring for Snowboarders". If you are kewl, or just impatient, and you
|
||||
want to use Spring, then this is the place to be. Spring Boot is the code-name for a
|
||||
group of related technologies, that will get you up and running with
|
||||
Spring-powered, production-grade applications and services with absolute minimum fuss.
|
||||
It takes an opinionated view of the Spring family so that new and existing users can
|
||||
quickly get to the bits they need. Assumes limited knowledge of the Java development
|
||||
ecosystem. Absolutely no code generation and no XML (unless you really want it).
|
||||
|
||||
The goals are:
|
||||
|
||||
* Radically faster and widely accessible getting started experience for Spring
|
||||
development
|
||||
* Be opinionated out of the box, but get out of the way quickly as requirements start to
|
||||
* Be opinionated out of the box, but get out of the way quickly as requirements start to
|
||||
diverge from the defaults
|
||||
* Provide a range of non-functional features that are common to large classes of projects
|
||||
(e.g. embedded servers, security, metrics, health checks, externalized configuration)
|
||||
* First class support for REST-ful services, modern web applications, batch jobs, and
|
||||
* First class support for REST-ful services, modern web applications, batch jobs, and
|
||||
enterprise integration
|
||||
* Applications that adapt their behavior or configuration to their environment
|
||||
* Optionally use Groovy features like DSLs and AST transformations to accelerate the
|
||||
* Optionally use Groovy features like DSLs and AST transformations to accelerate the
|
||||
implementation of basic business requirements
|
||||
|
||||
|
||||
## Installing
|
||||
You need to [build from source](#building-from-source) for now, but when it's done
|
||||
You need to [build from source](#building-from-source) for now, but when it's done
|
||||
instructions will look like this:
|
||||
|
||||
1) Get Java. Download and install the Java SDK from [www.java.com](http://www.java.com)
|
||||
@ -36,20 +36,20 @@ instructions will look like this:
|
||||
|
||||
|
||||
## Building from source
|
||||
Spring Zero can be [built with maven](http://maven.apache.org/run-maven/index.html) v3.0
|
||||
Spring Zero can be [built with maven](http://maven.apache.org/run-maven/index.html) v3.0
|
||||
or above.
|
||||
|
||||
$ mvn clean install
|
||||
|
||||
An `alias` can be used for the Spring Zero command line tool:
|
||||
An `alias` can be used for the Spring Boot command line tool:
|
||||
|
||||
$ alias spring="java -jar ~/.m2/repository/org/springframework/boot/spring-cli/0.5.0.BUILD-SNAPSHOT/spring-cli-0.5.0.BUILD-SNAPSHOT.jar"
|
||||
|
||||
_Also see [docs/CONTRIBUTING](docs/CONTRIBUTING.md) if you want to submit pull requests._
|
||||
_Also see [docs/CONTRIBUTING](docs/CONTRIBUTING.md) if you want to submit pull requests._
|
||||
|
||||
|
||||
## Quick Start Example
|
||||
The Spring Zero command line tool uses Groovy underneath so that we can present simple
|
||||
The Spring Zero command line tool uses Groovy underneath so that we can present simple
|
||||
snippets that can just run, for example:
|
||||
|
||||
$ cat > app.groovy
|
||||
@ -67,18 +67,18 @@ snippets that can just run, for example:
|
||||
Hello World!
|
||||
|
||||
|
||||
If you don't want to use the command line tool, or you would rather work using Java and
|
||||
an IDE you can. Just add a `main()` method that calls `SpringApplication` and
|
||||
If you don't want to use the command line tool, or you would rather work using Java and
|
||||
an IDE you can. Just add a `main()` method that calls `SpringApplication` and
|
||||
add `@EnableAutoConfiguration`:
|
||||
|
||||
import org.springframework.stereotype.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.boot.context.annotation.*;
|
||||
|
||||
|
||||
@Controller
|
||||
@EnableAutoConfiguration
|
||||
public class SampleController {
|
||||
|
||||
|
||||
@RequestMapping("/")
|
||||
@ResponseBody
|
||||
String home() {
|
||||
@ -88,83 +88,83 @@ add `@EnableAutoConfiguration`:
|
||||
public static void main(String[] args) throws Exception {
|
||||
SpringApplication.run(SampleController.class, args);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
_NOTE: the above example assumes your build system has imported the `spring-starter-web`
|
||||
maven pom._
|
||||
|
||||
|
||||
## Spring Zero Components
|
||||
There are a number of components in Zero. Here are the important ones:
|
||||
## Spring Boot Components
|
||||
There are a number of components in Boot. Here are the important ones:
|
||||
|
||||
### The Spring CLI
|
||||
The 'spring' command line application compiles and runs Groovy source, making it super
|
||||
easy to write the absolute minimum of code to get an application running. Spring CLI
|
||||
The 'spring' command line application compiles and runs Groovy source, making it super
|
||||
easy to write the absolute minimum of code to get an application running. Spring CLI
|
||||
can also watch files, automatically recompiling and restarting when they change.
|
||||
|
||||
*See [spring-cli/README](spring-cli/README.md).*
|
||||
|
||||
|
||||
### Spring Bootstrap
|
||||
The main library providing features that support the other parts of Spring Zero.
|
||||
### Spring Boot
|
||||
The main library providing features that support the other parts of Spring Boot.
|
||||
Features include:
|
||||
|
||||
* `SpringApplication` - a class with static convenience methods that make it really easy
|
||||
to write a standalone Spring Application. Its sole job is to create and refresh an
|
||||
* `SpringApplication` - a class with static convenience methods that make it really easy
|
||||
to write a standalone Spring Application. Its sole job is to create and refresh an
|
||||
appropriate Spring `ApplicationContext`.
|
||||
* Embedded web applications with a choice of container (Tomcat or Jetty for now)
|
||||
* First class externalized configuration support
|
||||
* First class externalized configuration support
|
||||
|
||||
_See [spring-boot/README](spring-boot/README.md)._
|
||||
|
||||
|
||||
### Spring Autoconfigure
|
||||
Spring Zero can configure large parts of common applications based on detecting the
|
||||
content of the classpath and any existing application context. A single
|
||||
`@EnableAutoConfigure` annotation triggers auto-configuration of the Spring context.
|
||||
|
||||
Auto-configuration attempts to guess what beans a user might want based on their
|
||||
classpath. For example, If a 'HSQLDB' is on the classpath the user probably wants an
|
||||
in-memory database to be defined. Auto-configuration will back away as the user starts
|
||||
### Spring Autoconfigure
|
||||
Spring Zero can configure large parts of common applications based on detecting the
|
||||
content of the classpath and any existing application context. A single
|
||||
`@EnableAutoConfigure` annotation triggers auto-configuration of the Spring context.
|
||||
|
||||
Auto-configuration attempts to guess what beans a user might want based on their
|
||||
classpath. For example, If a 'HSQLDB' is on the classpath the user probably wants an
|
||||
in-memory database to be defined. Auto-configuration will back away as the user starts
|
||||
to define their own beans.
|
||||
|
||||
_See [spring-autoconfigure/README](spring-autoconfigure/README.md)._
|
||||
|
||||
|
||||
### Spring Actuator
|
||||
Spring Actuator uses auto-configuration to decorate your application with features that
|
||||
make it instantly deployable and supportable in production. For instance if you are
|
||||
Spring Actuator uses auto-configuration to decorate your application with features that
|
||||
make it instantly deployable and supportable in production. For instance if you are
|
||||
writing a JSON web service then it will provide a server, security, logging, externalized
|
||||
configuration, management endpoints, an audit abstraction, and more. If you want to
|
||||
configuration, management endpoints, an audit abstraction, and more. If you want to
|
||||
switch off the built in features, or extend or replace them, it makes that really easy as well.
|
||||
|
||||
_See [spring-actuator/README](spring-actuator/README.md)._
|
||||
|
||||
|
||||
### Spring Starters
|
||||
Spring Starters are a set of convenient dependency descriptors that you can include in
|
||||
your application. You get a one-stop-shop for all the Spring and related technology
|
||||
Spring Starters are a set of convenient dependency descriptors that you can include in
|
||||
your application. You get a one-stop-shop for all the Spring and related technology
|
||||
that you need without having to hunt through sample code and copy paste loads of
|
||||
dependency descriptors. For example, if you want to get started using Spring and JPA for
|
||||
dependency descriptors. For example, if you want to get started using Spring and JPA for
|
||||
database access just include one dependency in your project, and you are good to go.
|
||||
|
||||
_See [spring-starters/README](spring-starters/README.md)._
|
||||
|
||||
|
||||
### Packaging
|
||||
The [spring-launcher](spring-launcher/) and
|
||||
The [spring-launcher](spring-launcher/) and
|
||||
[spring-maven-packaging-plugin](spring-maven-packaging-plugin) provide a convenient way
|
||||
to package you application for release. Applications can be released as a single jar
|
||||
file that can simply be launched using `java -jar`.
|
||||
|
||||
_See [spring-launcher/README](spring-launcher/README.md) &
|
||||
_See [spring-launcher/README](spring-launcher/README.md) &
|
||||
[spring-package-maven-plugin/README](spring-package-maven-plugin/README.md)._
|
||||
|
||||
|
||||
## Samples
|
||||
Groovy samples for use with the command line application are available in
|
||||
[spring-cli/samples](spring-cli/samples/#). To run the CLI samples type
|
||||
[spring-cli/samples](spring-cli/samples/#). To run the CLI samples type
|
||||
`spring run <sample>.groovy` from samples directory.
|
||||
|
||||
Java samples are available in [spring-boot-sample](spring-boot-samples/#) and should
|
||||
@ -181,8 +181,8 @@ samples are provided:
|
||||
* spring-sample-data-jpa - Spring Data JPA + Hibernate + HSQLDB
|
||||
* spring-boot-sample-integration - A spring integration application
|
||||
* spring-boot-sample-profile - example showing Spring's `@profile` support
|
||||
* spring-boot-sample-traditional - shows Spring Zero with more traditional WAR packaging
|
||||
* spring-boot-sample-traditional - shows Spring Zero with more traditional WAR packaging
|
||||
(but also executable using `java -jar`)
|
||||
* spring-boot-sample-xml - Example show how Spring Zero can be mixed with trditional XML
|
||||
* spring-boot-sample-xml - Example show how Spring Boot can be mixed with traditional XML
|
||||
configuration
|
||||
|
||||
|
@ -1,19 +1,19 @@
|
||||
# Contributing to Spring Zero
|
||||
Spring Zero is released under the non-restrictive Apache 2.0 license. If you would like
|
||||
# Contributing to Spring Boot
|
||||
Spring Boot is released under the non-restrictive Apache 2.0 license. If you would like
|
||||
to contribute something, or simply want to hack on the code this document should help
|
||||
you get started.
|
||||
|
||||
|
||||
## Working with the code
|
||||
If you don't have an IDE preference we would recommend that you use
|
||||
[Spring Tools Suite](http://www.springsource.com/developer/sts) or
|
||||
[Eclipse](http://eclipse.org) when working with the code. We use the
|
||||
If you don't have an IDE preference we would recommend that you use
|
||||
[Spring Tools Suite](http://www.springsource.com/developer/sts) or
|
||||
[Eclipse](http://eclipse.org) when working with the code. We use the
|
||||
[m2eclipe](http://eclipse.org/m2e/) eclipse plugin for maven support. Other IDEs
|
||||
and tools should also work without issue.
|
||||
|
||||
|
||||
### Building from source
|
||||
To build the source you will need to install
|
||||
To build the source you will need to install
|
||||
[Apache Maven](http://maven.apache.org/run-maven/index.html) v3.0 or above. The project
|
||||
can be build using the standard maven command:
|
||||
|
||||
@ -30,7 +30,7 @@ We recommend the [m2eclipe](http://eclipse.org/m2e/) eclipse plugin when working
|
||||
eclipse. If you don't already have m2eclipse installed it is available from the "eclipse
|
||||
marketplace".
|
||||
|
||||
Spring Zero includes project specific source formatting settings, in order to have these
|
||||
Spring Boot includes project specific source formatting settings, in order to have these
|
||||
work with m2eclipse, we provide an additional eclipse plugin that you can install:
|
||||
|
||||
* Select `Install new software` from the `help` menu
|
||||
@ -40,12 +40,12 @@ work with m2eclipse, we provide an additional eclipse plugin that you can instal
|
||||
from the `eclipse` folder in this checkout
|
||||
* Install "Maven Integration for the maven-eclipse-plugin"
|
||||
|
||||
_NOTE: This plugin is optional. Projects can be imported without the plugin, your code
|
||||
changes just won't be automatically formatted._
|
||||
_NOTE: This plugin is optional. Projects can be imported without the plugin, your code
|
||||
changes just won't be automatically formatted._
|
||||
|
||||
With the requisite eclipse plugins installed you can select
|
||||
With the requisite eclipse plugins installed you can select
|
||||
`import existing maven projects` from the `file` menu to import the code. You will
|
||||
need to import the root `spring-boot` pom and the `spring-boot-samples` pom separately.
|
||||
need to import the root `spring-boot` pom and the `spring-boot-samples` pom separately.
|
||||
|
||||
|
||||
### Importing into eclipse without m2eclipse
|
||||
@ -69,4 +69,4 @@ The sample application are used as integration tests during the build
|
||||
instead are launched via the `maven-invoker-plugin`. If you encounter
|
||||
build failures running the integration tests, check the `build.log`
|
||||
file in the appropriate sample directory.
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<profiles version="12">
|
||||
<profile kind="CodeFormatterProfile" name="Spring Zero" version="12">
|
||||
<profile kind="CodeFormatterProfile" name="Spring Boot" version="12">
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
|
||||
|
Loading…
Reference in New Issue
Block a user