Commit Graph

5742 Commits

Author SHA1 Message Date
Dave Syer
322af41d72 Revert CLI to JarLauncher
Affects gh-212
2014-01-11 07:15:47 +00:00
Phillip Webb
d125357bf6 Protect against JARs with different local headers
Fix JarEntryData to re-read the local header, rather than relying on
the central directory record.

This protects against the situation where a JAR file is written with an
'Extra Field Length' that is different in the local header to the
central directory header.

This appears to be the case with aspectj 1.7.4 which contains the
following central directory file header for ProceedingJoinPoint:

	50 4B 01 02     signature
	14 03           version made by
	0A 00           version required
	00 00           general
	08 00           compress methods
	0E 40 59 43     last modified
	2D 59 20 70     crc
	EC 00 00 00     csize
	8D 01 00 00     size
	2A 00           fname len
	00 00           ext field len
	00 00           file comment len
	00 00           disk num
	00 00           int file att
	00 00 A4 81     ext file att
	97 F3 00 00     relative offset of the local file header
	...             file name

and the following local header:

	50 4B 03 04     signature
	0A 00           version required
	00 00           general
	08 00           compress method
	0E 40 59 43     last modified
	2D 59 20 70     crc
	EC 00 00 00     csize
	8D 01 00 00     size
	2A 00           fname len
	14 00           ext field len
	...             file name
	...             extra field

Note that the 'ext field len' is 0x00 in the central record but 0x14 in
the local record.

Fixes gh-203
2014-01-10 16:57:51 -08:00
Phillip Webb
47da8a817a Polish 2014-01-10 13:06:54 -08:00
Phillip Webb
26d900f3ad Revert "Allow maven build with JDK 1.8"
Revert commit fd15b62a9d to
ensure that we don't accidentally use Java 8 features.
2014-01-10 12:32:18 -08:00
Phillip Webb
18a666caf8 Replaces references to 'files' with 'sources'
Replace references to 'files' throughout the code-base with 'sources'
following the rename of `FileOptions` to `SourceOptions`.

Also cleanup ResourceUtils a little
2014-01-10 12:27:23 -08:00
Phillip Webb
2c6231a0fc Restore eclipse settings to stop m2e errors 2014-01-10 10:47:49 -08:00
Dave Syer
f038da1fe5 Throw an exception if a config file that exists cannot be parsed
Fixes gh-209 in a general way
2014-01-10 17:09:39 +00:00
Dave Syer
cc996ce7f9 Extend YAML map key special cases to nested maps
Fixes gh-208
2014-01-10 15:53:17 +00:00
Dave Syer
ff3af47ef0 Watch out for non-Strings in YAML map keys
Fixes gh-205
2014-01-10 12:16:03 +00:00
Dave Syer
bd73705393 FileOptions -> SourceOptions to work with String paths instead of Files
We check for existence of the sources and (as before) resolve multiple
resources on the classpath if a path is not a File. In addition supports
Spring pseudo-URL prefixes as well as normal URLs as source locations.

In addition sources can now be specified as a directory (searched
recursively by default), or a resource pattern (e.g. app/**/*.groovy).

Fixes gh-207
2014-01-10 11:59:04 +00:00
Christian Dupuis
62e02d3d81 Add initialSize configuration property to datasource auto configuration
fixes #206
2014-01-10 11:32:18 +01:00
Dave Syer
edaaac8993 Fix broken test
Recent changes to the repository configuration for @Grab
didn't update the tests which use the GroovyCompiler as
a standalone. Fixed that by using the
RepositoryConfigurationFactory.
2014-01-10 08:25:28 +00:00
Dave Syer
5bbb01c071 Move properties file to correct location 2014-01-10 08:10:22 +00:00
Christian Dupuis
1a44b3e676 Fix sorting of auto configuration classes on JDK 8 2014-01-09 20:56:06 +01:00
Christian Dupuis
fd15b62a9d Allow maven build with JDK 1.8 2014-01-09 20:56:05 +01:00
Dave Syer
d6b2ade8df Ensure logging initializer listens to the right event
This should make a difference to gh-196. It might even fix it
(depending on what snapshot the user had there).
2014-01-09 18:01:13 +00:00
Dave Syer
2377bd9ec9 Don't load BatchAutoConfiguration at all if there is no JobLauncher
Fixes gh-204
2014-01-09 17:50:03 +00:00
Dave Syer
b1db714c23 Allow @EnableGlobalMethodSecurity in a non webapp
Fixes gh-202
2014-01-09 17:13:59 +00:00
Christian Dupuis
b8b948d366 Migrate JolokiaAutoConfiguration to use ConfigurationProperties instead of accessing the environment directly to obtain configuration properties 2014-01-09 17:52:55 +01:00
Dave Syer
51f9189923 Prevent 404 in gh-pages 2014-01-09 14:30:06 +00:00
Dave Syer
889a97a6b2 Default spring.config.location to file: if no prefix supplied
Fixes gh-198
2014-01-09 12:22:50 +00:00
Dave Syer
aebaa580db Add test for user overriding @EnableJpaRepositories 2014-01-09 11:14:18 +00:00
Dave Syer
c8152bfc70 SpringBootTestUtils->EnvironmentTestUtils 2014-01-09 10:56:33 +00:00
Dave Syer
478e655758 Change algorithm for determining active profile from external config
Instead of adding active prpfiles for every one we encounter, we need to
build up a complete "default" Environment and then ask it what the active
profiles are. Implemented in ConfigFileApplicationListener.

Fixes gh-198
2014-01-08 18:03:37 +00:00
Dave Syer
7d846c835a Allow user to disable all JMX exports with spring.jmx.enabled 2014-01-08 14:27:34 +00:00
Dave Syer
561cb3a50f TestUtils -> SpringBootTestUtils 2014-01-08 13:58:21 +00:00
Andy Wilkinson
73b9899708 Use a single <manifestEntries> element
Previously, there were two <manifestEntries> elements in the CLI's
pom.xml. With certain versions of Maven, this appeared to cause the
first element to be ignored in favour of the second. The problem did
not occur when built locally with Maven 3.1.1, but did occur when built
by Bamboo which, I believe, uses 3.0.x

This commit combines the two <manifestEntries> into one.
2014-01-08 13:14:54 +00:00
Andy Wilkinson
9a5be9f4cd Revert "Test that auto configurations can be added by init scripts"
The test passes locally, both in Eclipse and on the command line, but
fails on the CI server. Revert the addition of the test while I
hopefully figure out why.

This reverts commit 2e81b1d0d0.
2014-01-08 11:43:59 +00:00
Andy Wilkinson
a010de955d Reinstate ./repository as a "remote" repository
The grab command downloads the dependencies of one or more Groovy
scripts to ./repository. This commit ensures that those previously
downloaded dependencies can be used by a subsequent invocation of the
run command.

The location and behaviour of the local cache is unaffected by this
change. If the dependencies in ./repository do not exist in the local
cache, Aether will "download" them from ./repository and store them in
the local cache.

Fixes #191
2014-01-08 11:34:17 +00:00
Andy Wilkinson
a58e4cbb1f Add support for configuring Aether via settings.xml
Previously, Aether's configuration was largely hard-coded making it
impossible to configure a mirror, provide credentials for accessing
a repository, etc.

This commit adds support for configuring Aether via Maven's
settings.xml file. The support is optional and must be enabled by
grabbing spring-boot-maven-settings in an init script. The Aether
instance that's used when running the application will then be
configured using settings.xml. The settings file is expected to be
found in ${user.home}/.m2/settings.xml.

The configuration of the following items is currently supported:

 - Offline
 - Proxies
 - Mirrors
 - Server authentication
 - Local repository location

If the support is not enabled, settings.xml does not exist, or
settings.xml does not configure certain things then sensible defaults
are applied.
2014-01-08 11:21:56 +00:00
Andy Wilkinson
2e81b1d0d0 Test that auto configurations can be added by init scripts
When an init command is run, it may add entries to the classpath. This
commit adds a test that verifies that, if an entry that is added to
the classpath contains a CompilerAutoConfiguration file in
META-INF/services, then the CompilerAutoConfigurations declared in it
are found by subsequent ServiceLoader.load calls.
2014-01-08 11:21:56 +00:00
Dave Syer
321ce3aad2 TestUtils -> SpringBootTestUtils 2014-01-08 10:46:42 +00:00
Dave Syer
147968cf83 Set isolation to DEFAULT for JPA transaction manager
Also logs a warning about the fact that locks may not be taken when
starting a Job. JPA and Batch don't really work that well together
in general so it's probably not worth a lot of effort to work aoround
this. If anyone needs to they should create a custom JpaDialect
(and a BatchConfigurer).

Fixes gh-197
2014-01-08 09:58:23 +00:00
Dave Syer
2066c04a3e Make Map<String,String> a special case in RelaxedDataBinder
Fixes gh-195
2014-01-08 09:37:51 +00:00
Dave Syer
7b58718453 Add missing YAML file for test 2014-01-08 07:30:58 +00:00
Dave Syer
4e1245d9ee Restore changes from 0332501 (fix class loader test failure) 2014-01-08 07:30:09 +00:00
Dave Syer
e00db0de24 Ignore other failing test as short term measure 2014-01-08 07:25:36 +00:00
Dave Syer
bf69da3983 Ignore failing test as short term measure 2014-01-07 19:48:56 +00:00
Janne Valkealahti
780397bd6b Fix for wildcard recursive classpath handling
Previous fix for handling wildcard entries in a classpath
imposed a new problem in a case where entry is a directory
with a jar files but also contains a lot of nested directories.

For example entry "./*" resulted for scanning whole disk starting
from "/". In case of default hadoop classpath, it scanned everything
under hadoop's installation. On some cases this deep scan was hidden
and was revealed by NPE's for file access exceptions.

When we want to support wildcard entries we only want to get
jar files from that directory, while boot itself have a need
to travel recursively to find classfiles from an expoded archive.

We handle this case by using recursive(true by default) flag in
ExplodedArchive and this flag is set to false in PropertiesLauncher
if we match wildcard.
2014-01-07 18:05:10 +00:00
Dave Syer
633dea9d80 Add declarative ApplicationListener 2014-01-07 17:53:34 +00:00
Dave Syer
73c2216732 Migrate file encoding initializer to listener 2014-01-07 17:52:46 +00:00
Dave Syer
4d28e1b601 Migrate VCAP initializer to a listener 2014-01-07 17:52:46 +00:00
Dave Syer
441572c61c Migrate config file initializer to a listener 2014-01-07 17:52:46 +00:00
Dave Syer
3dacf4be17 Migrate Logging and Liquibase initializers to be listeners 2014-01-07 17:52:45 +00:00
Dave Syer
27ae6a5fd6 Add ApplicationListener as first class component in Spring Application 2014-01-07 17:52:45 +00:00
Andy Wilkinson
3336b6da44 Remove redundant @GrabResolver transform
Previously, a transform was used to add @GrabResolver annotations
during compilation that added the Spring milestone and snapshot
repositories. This functionality is now handled by
RepositoryConfigurationFactory so the transform is no longer required.
2014-01-07 10:31:10 +00:00
Phillip Webb
751beda2cb Additional fixes for auto-configuration report
Fix the following issues that were introduced in commit 0610378:

- Formatting of code including imports
- Improve hashcode/equals implementations by using ObjectUtils
- Provide hashcode/equals for ConditionOutcome
- Use LinkedHashSet in ConditionAndOutcomes to maintain insert order

Fixed gh-127
2014-01-06 10:52:33 -08:00
Greg Turnquist
b5b86d07ba Add Spring MVC's org.springframework.ui package to the list of automatic imports 2014-01-06 17:30:05 +00:00
Dave Syer
8fe696944a Delete duplicate logback.xml if running from Maven plugin
Fixes gh-143
2014-01-06 17:28:22 +00:00
Dave Syer
ac34f9c993 First proper draft of DSL for Groovy Commands
Users can declare or Command, OptionHandler classes in an init script
or they can use a DSL, e.g.

command("foo") { args -> println "Do stuff with ${args} array" }

or

command("foo") {
  options { option "bar", "Help text for bar option" ithOptionArg() ofType Integer }
  run { options -> println "Do stuff with ${options.valueOf('bar')}" }
}
2014-01-06 16:00:10 +00:00