Commit Graph

3337 Commits

Author SHA1 Message Date
Phillip Webb bec7b5f118 Merge pull request #1483 from liujiong1982/spring-boot-1412
* spring-boot-1412:
  Add fork option for mvn spring-boot:run

Closes gh-1483
2014-11-04 13:23:31 -08:00
David Liu 9bf1c89750 Add fork option for mvn spring-boot:run
Update RunMojo to include a `fork` option and change the default
to only fork if agent or jvmArguments are specified.

Fixes gh-1412
2014-11-04 13:22:02 -08:00
Phillip Webb 026b89f58c Support PID file location in Spring Environment
Update ApplicationPidFileWriter to support the Spring Environment,
picking up the `spring.application.pidfile` property if specified.

Fixes gh-1579
2014-11-04 11:18:48 -08:00
Phillip Webb f9fe8ed55e Merge pull request #1783 from Loki-Afro/gh-1777
* gh-1777:
  Add PropertiesPropertySourceLoader test
  Add XML support to PropertiesPropertySourceLoader
2014-11-04 09:33:14 -08:00
Phillip Webb 907f60e871 Add PropertiesPropertySourceLoader test 2014-11-04 09:32:22 -08:00
Phillip Wirth ed12f97fda Add XML support to PropertiesPropertySourceLoader
Fixes gh-1777
Closes 1783
2014-11-04 09:32:02 -08:00
Phillip Webb f5a52ddd5a Optimize property sources pattern matching
Create a PropertyNamePatternsMatcher strategy interface that
PropertySourcesPropertyValues can use to determine when a property
can be used.

PropertiesConfigurationFactory uses DefaultPropertyNamePatternsMatcher
which is heavily optimized for frequent calls.

Fixes gh-1823
2014-11-04 09:12:30 -08:00
Phillip Webb adffb7a30f Guard default conversion service creation
Update ConfigurationPropertiesBindingPostProcessor to ensure that
the defaultConversionService is only created once.

Fixes gh-1822
2014-11-04 09:09:40 -08:00
Phillip Webb edaed415fb Polish 2014-11-04 09:09:26 -08:00
Stephane Nicoll 9dec27e7bf Permit to disable JTA using a single property
Disable JTA auto-configuration altogether with a simple property. This
can be useful if the environment is JTA capable but the application does
not require it.

Fixes gh-1457
2014-11-04 16:53:54 +01:00
Stephane Nicoll 814803046a polishing 2014-11-04 16:31:37 +01:00
Stephane Nicoll 47cd9e0765 Fix ConditionalOnJndi evaluation
Enable ConditionalOnJndi evaluation and add tests that validate it works
as expected

Fixes gh-1820
2014-11-04 15:42:30 +01:00
Stephane Nicoll cbd3c39640 Override StringHttpMessageConverter with UTF-8
Override the default StringHttpMessageConverter provided by the standard
Spring MVC configuration so that is uses UTF-8 instead of the aging
default of the servlet spec (that is ISO-8859-1)

Fixes gh-1800
2014-11-04 13:12:19 +01:00
Dave Syer 8be97fa47d Tweak docs on Maven resource filtering some more 2014-11-04 10:41:47 +00:00
Dave Syer d210810535 Tweak docs on Maven resource filtering
Fixes gh-1816
2014-11-04 10:29:55 +00:00
Phillip Webb 43c07e8b44 Protect against duplicate datasource MBeans
See gh-1590
2014-11-03 18:49:27 -08:00
Phillip Webb a973fd41f4 Polish 2014-11-03 18:49:20 -08:00
Dave Syer 9b6cb83be5 Add documentation for Servlet 2.5 and GAE
Fixes gh-1104
2014-11-03 17:04:57 +00:00
Dave Syer f304d46955 Add JMX MBean for Tomcat DataSource
If the DataSource is a Tomcat one we force it to register an MBean
if spring.jmx.enabled=true

Fixes gh-1590
2014-11-03 13:38:05 +00:00
Stephane Nicoll 0061f237b8 Add examples to the CLI
This commit updates the help command to also show some example(s) to
illustrate how the command can be used. The commit also defines useful
examples for the init command

Fixes gh-1809
2014-11-03 14:06:35 +01:00
Stephane Nicoll fb0d9d2a2e Fix build failure
This commit reworks a7e1ec8 to fix the build failure and update the
documentation regarding default maven filtering option with
spring-boot-starter-parent

Fixes gh-1199
2014-11-03 14:01:51 +01:00
Stephane Nicoll 6a18ece6a2 Explicit type takes precedence over build and format
Prior to this commit, specifying the --format and/or --build options
alongside --type did not use the explicit type as it should. This commit
ignores the --build and --format options if a type is explicitly set.

Fixes gh-1807
2014-11-03 13:12:06 +01:00
Andy Wilkinson a85e02fbb9 Update to Spring Data Evans SR1
Closes gh-1709
2014-11-03 11:31:58 +00:00
Dave Syer a7e1ec842d Use @*@ delimiters in Maven resource filtering
It *is* very useful to have filtering on by default, so that is now
the case (in spring-boot-starter-parent). Users can filter resources
by default by adding @*@ placeholders (so as not to clash with Spring
${} placeholders).

Fixes gh-1199
2014-11-03 11:12:11 +00:00
Stephane Nicoll 2e07f003c9 Init command takes the output as last argument
This commit moves the --output switch to a regular argument. This aligns
to other command, i.e. spring init my-project.zip would save the project
to "my-project.zip" in the current directory.

This commit also auto-detects the --extract option if the location ends
with a slash, i.e. spring init demo/ would extract the content of the
project in a demo directory that is local to the current directory.

Fixes gh-1802
2014-11-03 11:52:16 +01:00
Stephane Nicoll 96198e2999 polishing 2014-11-03 11:52:16 +01:00
Dave Syer 3e97cdbc3b Trim some fat from groovy templates
The old resolver class is deprecated already, and there's no reason
to continue to support the View and View resolver implementations
from Boot 1.1, so I removed those. Also there is no need to support
older versions of Groovy, so I removed a config class that was
conditional on a groovy version (by looking for the markup support).

Fixes gh-1578
2014-11-03 09:59:25 +00:00
Brian Clozel 18b8929335 Migrate to groovy templates from Spring 4.1
Update `GroovyTemplateAutoConfiguration` to use Spring 4.1 Groovy
Markup Template infrastructure instead of Boot's.

Fixes gh-1552
2014-11-03 09:59:25 +00:00
Phillip Webb 7dd6ae76c6 Merge branch 'gh-1001' 2014-11-02 21:52:17 -08:00
Phillip Webb 9d01d4fa84 Document configuration meta-data
Add an appendix to the reference documentation describing the format
of configuration meta-data and how the annotation processor can be used.

Closes gh-1001
2014-11-02 21:49:42 -08:00
Stephane Nicoll a46396f691 Add @NestedConfigurationProperty meta-data support
Add a @NestedConfigurationProperty annotation which can be used to
customize how configuration mete-data is generated.

Prior to this commit only inner-classes where considered nested
(see Tomcat in ServerProperties). Using this new annotation, the Ssl
property in ServerProperties can be detected as well.

See gh-1001
2014-11-02 21:46:36 -08:00
Stephane Nicoll fbf8f56a97 Generate standard configuration meta-data
Update the `spring-boot`, `spring-boot-autoconfigure` and
`spring-boot-actuator` project to generate configuration meta-data
files during compilation.

See gh-1001
2014-11-02 21:46:36 -08:00
Phillip Webb c73adcd198 Add a defaultValue attribute to config meta-data
Update `ConfigurationMetadataAnnotationProcessor` to include the
'defaultValue' of a property when possible. For example the
'defaultValue' or 'server.port' is '8080'.

Default values are detected by inspecting the field assignments of
@ConfigurationProperties items. In order to detect field values some
internals of the Java compiler are used. To save a dependency on
'tools.jar' internal javac classes are accessed using reflection.

See gh-1001
2014-11-02 21:46:35 -08:00
Stephane Nicoll 884c058e57 Add processor to generate configuration meta-data
Adds an annotation processor to generates a JSON meta-data file at
compile time from @ConfigurationProperties items. Each meta-data file
can include an array or 'properties' and 'groups'.

A 'property' is a single item that may appear in a Spring Boot
'application.properties' file with a given value. For example,
'server.port' and 'server.context-path' are properties. Each property
may optionally include 'type' and 'description' attributes to provide
the data type (e.g. `java.lang.Integer`, `java.lang.String`) and
some short documentation (taken from the field javadoc) about what the
property is for. For consistency, the type of a primitive is translated
to its wrapper counterpart, i.e. `boolean` becomes `java.lang.Boolean`.

A 'group' provides a higher level grouping of properties. For example
the 'server.port' and 'server.context-path' properties are in the
'server' group.

Both 'property' and 'group' items may additional have 'sourceType' and
'sourceMethod' attributes to indicate the source that contributed them.

Users may use `META-INF/additional-spring-configuration-metadata.json`
to manually provide additionally meta-data that is not covered by
@ConfigurationProperties objects. The contents of this file will be
read and merged with harvested items. The complete meta-data file is
finally written to `META-INF/spring-configuration-metadata.json`.

See gh-1001
2014-11-02 21:46:28 -08:00
Phillip Webb 45b579c439 Improve OnBeanCondition Performance
Update OnBeanCondition to use a new BeanTypeRegistry which includes
optimized code when using a DefaultListableBeanFactory. The optimized
version calculates bean types only once per bean and caches the result.

Prior to this change the sample "pet clinic" application would spend
400-500 milliseconds evaluating OnBeanConditions, after this change it
spends around 120 milliseconds.

Fixes gh-1803
2014-11-02 13:55:06 -08:00
Phillip Webb d6f2f0deee Merge branch '1.1.x' 2014-11-02 13:23:33 -08:00
Phillip Webb 5f80f3556b Use more specific WebSecurityConfigurer @Bean type
Update ManagementSecurityAutoConfiguration to return
IgnoredPathsWebSecurityConfigurerAdapter rather than
WebSecurityConfigurer<WebSecurity>.
2014-11-02 13:20:37 -08:00
Phillip Webb a490aef888 Merge remote-tracking branch 'springsource/1.1.x'
Conflicts:
	spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfigurationTests.java
2014-11-01 19:47:47 -07:00
Phillip Webb 8ba71c88f5 Polish 2014-11-01 19:46:04 -07:00
Dave Syer b20d02a31d Make a lazy AuthenticationManager if we think it's already configured
Instead of just blindly creating the default authentication manager, after
thic change we count the beans of type GlobalAuthenticationManagerConfigurer
and assume that if we detect more than we expect (one from Boot and one from
Spring Security) then the user is telling us they want to configure the
AuthenticationManager themselves.

Fixes gh-1801
2014-11-01 18:10:27 +00:00
Phillip Webb aa2e32a041 Restore CLI startup performance
Change InitializrService to use a late binding CloseableHttpClient
since the calling `HttpClientBuilder.create().build()` is slow.

Fixes gh-1764
2014-11-01 09:56:28 -07:00
Phillip Webb 830ce80824 Polish CLI init command
Rename a few classes and methods and extract some logic into helper
classes. Also change 2 char shortcuts to a single char.

Closes gh-1751
2014-11-01 09:05:47 -07:00
Phillip Webb b89e5e0ab7 Apply eclipse formatting rules
Apply eclipse formatting rules to b2fe2dd9.

See gh-1751
2014-11-01 08:20:12 -07:00
Phillip Webb 8e16dfc951 Polish 2014-11-01 08:20:12 -07:00
Dave Syer f15cb7a720 Add tests for AuthenticationManager injected into security configurer
See gh-1801
2014-11-01 08:58:46 +00:00
Dave Syer 49fbf215a1 Switch to Dropwizard metrics 3.1.0
Fixes gh-1775
2014-10-31 18:52:42 +00:00
Dave Syer afb7156804 Add missing method for Java 1.7 2014-10-31 18:52:25 +00:00
Dave Syer a284d7bd3f Add Codahale metrics to /metrics endpoint
All metrics in the MetricRegistry have been added unconditionally for now.

Fixes gh-1795
2014-10-31 09:33:33 +00:00
Stephane Nicoll b2fe2dd912 Add init command to the CLI
This commit adds a new command to the CLI that allows to initialize a new
project from the command line. It uses the Spring initializr service to
actually generate the project.

The command offers two main operations:

1. Listing the capabilities of the service (--list or -l). This basically
dumps the defaults of a given service and the list of dependencies and
project types it supports
2. Generating a project. By default, http://start.spring.io is used and
its configured defaults are applied. Running spring init would therefore
have the same effect as clicking the 'generate project' on the UI without
entering any extra information. No file is overwritten by default.

The generation can be customized with the following options:

* --boot-version (-bv) Spring Boot version the project should use
* --dependencies (-d) comma separated list of dependencies to add to the
generated project
* --java-version (-jv) Java version to use
* --packaging (-p) the packaging for the project (jar, war)
* --target the url of the service to use

The actual type of the project can be defined in several ways:

1. Using the --type (-t) option that identifies a type that is supported
by the service
2. A combination of --build and/or --format that can be used to uniquely
identify matching these tags. Build represents the build system to use
(e.g. maven or gradle) while --format defines the format of the generated
project.

The project is saved on disk with the name provided by the server through
the Content-Disposition header, if any. It is possible to force it with
the --output option. It is possible to overwrite existing files by adding
the --force (-f) flag.

The --extract (-x) option allows to extract the project instead of saving
the zip archive. By default, the project is extracted in the current
working directory but it is possible to specify an alternate directory
using the --output option.

Fixes gh-1751
2014-10-31 08:39:03 +01:00
Phillip Webb 4b45ce9e57 Upgrade to Spring 4.1.2.BUILD-SNAPSHOT 2014-10-30 13:54:25 -07:00