Commit Graph

518 Commits

Author SHA1 Message Date
Martin Lippert
511c6d39fa Replace ignore with lifecycle mapping to smooth import into Eclipse
Closes gh-3516
2015-08-13 13:24:15 +01:00
Stephane Nicoll
3763eda64e Merge branch '1.2.x' 2015-08-10 16:36:11 +02:00
Stephane Nicoll
1ee31e73d3 Avoid NPE if @ConfigurationProperties is not present
The annotation processor detects `@ConfigurationProperties` bean or
method definition and merges manual meta-data. The former step will fail
with a NPE if the annotation is not present on the classpath. This could
happen if the annotation processor is added to a module that is not
actually using Spring Boot.

We now have a defensive check that skips that steps but still attempts to
merge manual meta-data if present.

Closes gh-3720
2015-08-10 16:34:30 +02:00
Dave Syer
25ac258d22 Clarify plugin documentation for requiresUnpack 2015-08-10 12:52:00 +01:00
Phillip Webb
891dd5a0f6 Polish 2015-08-03 11:03:48 -07:00
Andy Wilkinson
4660a3ed4d Merge branch '1.2.x' 2015-08-03 15:50:26 +01:00
Andy Wilkinson
d241171fff Use fast exceptions in hasMoreElements in LaunchedURLClassLoader
When nested jars are being used, hasMoreElements requires opening a
connection for an entry in every nested jar. If that entry doesn't
exist, a FileNotFoundException is thrown to indicate that a particular
jar doesn't contain the requested entry. This exception is used to
indicate the lack of an entry and is then swallowed, i.e. its stack
trace is of no importance. This means that the performance of
hasMoreElements can be improved by switching on fast exceptions while
it's being called. When fast exceptions are switched on a general
purpose pre-initialized FileNotFoundException is thrown rather than
creating a new FileNotFoundException instance each time.

In certain situations, the use of fast exceptions as described above
can improve performance fairly significantly. The JRE's default SAAJ
implementation uses META-INF/services-based discovery for _every_
request that's handled by Spring Web Services. Each discovery attempt
results in hasMoreElements being called making its performance
critical to throughput.

See gh-3640
2015-08-03 15:39:56 +01:00
Stephane Nicoll
bc0487f791 Polish
Make sure that the meta-data can be serialized.
2015-07-29 14:01:21 +02:00
arghya88
64c6e5b403 Fix typo
Closes gh-3610
2015-07-28 10:39:10 +02:00
arghya88
9de4fd7913 Fix typo
Closes gh-3606
2015-07-27 15:30:48 +02:00
Stephane Nicoll
057824aca7 Fix maven plugin configuration
Closes gh-3601
2015-07-27 08:18:09 +02:00
Stephane Nicoll
94405455dd Fix maven plugin configuration
Closes gh-3601
2015-07-26 09:09:43 +02:00
Stephane Nicoll
e033daed0f Use standard name for main thread
DevTools look for a main thread named "main". The maven plugin is
actually using a different value and there is no real reason to. This
change fixes DevTools support as long as forking is enabled.

See gh-3315
2015-07-24 10:36:14 +02:00
Stephane Nicoll
42e230192f Polish 2015-07-24 07:19:53 +02:00
Stephane Nicoll
e9a6245a44 Remove unnecessary System.out 2015-07-22 16:59:53 +02:00
Stephane Nicoll
178c690d37 Fix meta-data root attributes ordering 2015-07-22 16:59:25 +02:00
Andy Wilkinson
434f528e0a Fix Gradle plugin task dependencies broken by removal of app plugin
8673250 updated the plugin so that the application plugin is no longer
applied by default. This exposed three problems:

 1. bootRepackage may run before findMainClass has run, leaving it with
    an unknown main class.
 2. findMainClass may run before the classes have been built, making it
    unable to find the main class by examining the class files
 3. The project's mainClassName property was still being used as a
    convention for the bootRun task's main property. If the application
    plugin has not be applied, then this property does not exist.

The first problem has been addressed by configuring bootRepackage to
depend on findMainClass.

The second problem has been addressed by configuring the main source
set's output as an input of findMainClass, and configuring findMainClass
to depend on the tasks that build the output.

The third problem has been addressed by only using the mainClassName
property if it exists and its value is not null. We then fallback to
using the mainClassName property on the project's extra properties in
the same way. 

See gh-2679
2015-07-22 13:47:29 +01:00
Andy Wilkinson
8673250955 Make use of Gradle's application plugin optional when using Boot plugin
Previously, the Spring Boot Gradle plugin would always apply the
application plugin to a project. It then piggy-backed on the application
plugin’s mainClassName and applicationDefaultJvmArgs properties for the
configuration of the bootRun task.

This commit updates the Spring Boot Gradle plugin so that it no longer
applies the application plugin. If the user applies the application
plugin then its configuration will be used, but it’s a no longer
requirement.

Users who do not need the application plugin, but who were using the
mainClassName or applicationDefaultJvmArgs properties will need to
change their builds as a result of this change as those properties will
no longer exist. As before, the mainClassName can be configured on the
springBoot extension:

springBoot {
	mainClassName 'com.example.YourApplication'
}

The applicationDefaultJvmArgs property can be used, but it must now be
declared with the project's ext block. For example:

ext {
	applicationDefaultJvmArgs = [ '-Dcom.example.property=true' ]
}

Closes gh-2679
2015-07-22 11:38:15 +01:00
Phillip Webb
e9d252e05c Add @DeprecatedConfigurationProperties annotation
Add a new @DeprecatedConfigurationProperties annotation which can be
used by the `ConfigurationMetadataAnnotationProcessor` to generating
meta-data deprecated blocks.

Fixes gh-3543
2015-07-17 14:14:37 -07:00
Phillip Webb
728e64b929 Polish 2015-07-16 12:56:49 -07:00
izeye
f4589e7cc3 Fix typos
Closes gh-3504
2015-07-15 15:45:02 +02:00
Stephane Nicoll
f2d32d3e98 Add support for property deprecation
Previously, an item could only have a 'deprecated' boolean flag to
indicate that the property is deprecated. It is desirable to provide an
additional description for the deprecation as well as the name of the
property to use instead.

The `deprecated` boolean flag is now supported. Instead, a `deprecated`
object can be specified with two optional attributes: `reason` to provide
an explanation for the deprecation and `replacement` to refer to the
property that should be used instead. If none of them is present, an
empty deprecation object should be set.

For backward compatibility, the `deprecated` field is still set.

Deprecation information can only set via manual meta-data.

Closes gh-3449
2015-07-15 15:41:52 +02:00
izeye
019140c901 Remove redundant check
Closes gh-3497
2015-07-15 09:58:15 +02:00
Phillip Webb
f0f5f78e25 Polish 2015-07-14 22:17:52 -07:00
Stephane Nicoll
68d875bdc6 Fix windows build 2015-07-14 21:39:54 +02:00
Stephane Nicoll
c4c24b1f44 Detect default value from factory method
If a field is initialized via a factory method taking a single argument,
we can relatively safely consider that said argument is a good
representation of its default value. This is typically the case for
Charset or MimeType instances.

We now make sure to detect such use case (i.e. method argument with a
single argument).

Closes gh-3482
2015-07-14 15:08:43 +02:00
Dave Syer
de02eaa26b Add missing jar (.gitignored) 2015-07-14 12:44:23 +01:00
Dave Syer
bfa816f2a3 Maintain classpath order in PropertiesLauncher
I think this is safe, judging by the integration tests, but I'm not
putting it in 1.2.x until we've had some feedback on it. The
integration tests actually had a bug that was masking this problem
because they were merging Properties from the whole classpath instead
of picking the first available resource (which is generally what
we do in Spring Boot applications for application.properties for
instance).

Fixes gh-3048
2015-07-14 10:22:36 +01:00
Phillip Webb
9ebe15232e Polish 2015-07-13 11:05:46 -07:00
Stephane Nicoll
cb5eccb5c1 Add missing handle-as meta-data
Liquibase has a `changeLog` property that is definitely used as a
`Resource` but cannot be defined as such as the original String value
should be kept against an API we don't control.

Update the tests also to make it more clear that if hints are added
against a property that is detected automatically, said property still
keeps all its auto-discovered capabilities.

Closes gh-3457
2015-07-13 13:45:23 +02:00
Stephane Nicoll
d64ee99b20 Add configuration meta-data parser
Add a new `spring-boot-configuration-metadata` module that provides an
API to manipulate Spring Boot configuration meta-data. Can read meta-data
from arbitrary locations, though the standard
`META-INF/spring-configuration-metadata.json` location must be preferred.

Closes gh-1970
2015-07-13 11:53:31 +02:00
izeye
f85f316873 Polish toString()
Closes gh-3465
2015-07-13 09:52:29 +02:00
Stephane Nicoll
3664895f04 Polish 2015-07-12 09:20:12 +02:00
Dave Syer
b2a2c5b168 Add Maven incantation to make STS 3.7 happy 2015-07-10 15:56:40 +01:00
Phillip Webb
e3b59774c8 Merge branch '1.2.x' 2015-07-09 10:37:30 -07:00
Phillip Webb
4b17f3ceef Formatting 2015-07-09 10:37:21 -07:00
Andy Wilkinson
a2d58030dd Merge branch '1.2.x' 2015-07-09 16:42:37 +01:00
Andy Wilkinson
68e54e1d5d Favour entries in source jar over standard libraries when repackaging
When writing a jar, once an entry has been written it will never be
overwritten, i.e. the first write of a given entry will win. Previously,
when repackaging a jar, the existing contents were written followed by
any libraries. This caused a problem when repackaged a WAR file and
a library needed to be unpacked as the existing entry in WEB-INF/lib
would prevent the library with the UNPACK comment from being written.
This was addressed in f761916b by inverting the order so libraries
would take precedence over entries in the source jar.

It’s now become apparent that this change in the order causes a problem
for users who are obfuscating their code. The obfuscated code exists in
the source jar but is also provided to the repackager in its original
form as a library. When libraries take precedence, this means that the
code in its original form ends up in the repackaged war and the
obfuscation is lost.

This commit updates the repackager to write libraries that require
unpacking first. This allows the UNPACK comment to be written even if
there’s also a source entry for the library. Next, source entries are
written. This allows obfuscated source entries to take precedence over
any unobfuscated library equivalents. Lastly, standard libraries that
do not require unpacking are written into the repackaged archive.

Closes gh-3444
2015-07-09 16:37:10 +01:00
Stephane Nicoll
97634e85ac Remove unnecessary keyword 2015-07-09 14:33:01 +02:00
Andy Wilkinson
2263095bbb Update launch.script to match chkconfig start levels with defaults
Closes gh-3419
2015-07-07 17:57:47 +01:00
Phillip Webb
0cf6efca4f Polish 2015-07-06 13:05:09 -07:00
Stephane Nicoll
e307fe3137 Honor outputDirectory properly
Previously, if the repackaged file was different from the main artifact
of the build, the maven plugin wrongly considered that it should attach
the file with a classifier.

The outputDirectory is honored properly now, regardless of the fact a
classifier is defined or not.

Fixes gh-3177
2015-07-06 15:24:48 +02:00
Stephane Nicoll
162cbdd5cb Fail the build if the meta-data are invalid
Make sure to fail the build with a proper compilation error message if
the user-defined meta-data are invalid. For now, this takes care of the
JSON format but other checks may be added in the future.

Closes gh-3329
2015-07-06 11:35:57 +02:00
Spring Buildmaster
7ce391db4f Next development version 2015-07-01 22:48:01 -07:00
Phillip Webb
b1f8a692a8 Merge branch '1.2.x' 2015-07-01 19:30:12 -07:00
Phillip Webb
a1b87766a7 Fix PropertiesLauncher javadoc
See gh-3392
2015-07-01 18:09:56 -07:00
Matt Benson
ae4559eb4f Create spring-boot-antlib module
Create a new spring-boot-antlib module which allows Apache Ant users
to easily create executable jars.

Fixes gh-3339
2015-06-30 00:30:28 -07:00
Phillip Webb
7879743b9f Polish 2015-06-25 12:00:48 -07:00
Stephane Nicoll
0ec9de9137 Add support for value provider
Improve the "hints" section of the metadata so that each hint can provide
the reference to a value provider.

A value provider defines how a tool can discover the potential values of
a property based on the context. The provider is identifed by a name and
may have an arbitrary number of parameters.

Closes gh-3303
2015-06-25 14:58:10 +02:00
Phillip Webb
778e3eb091 Polish 2015-06-24 16:15:12 -07:00