Commit Graph

49394 Commits

Author SHA1 Message Date
Dave Syer
61a94f212d [bs-89] Allow user to plugin validator for @ConfigurationProperties
* Also fix ordering problem in integration tests
(An application context not being closed led  to port 8080
being already in use.)
* Validator can be specified by providing a Spring Validator with
bean id configurationPropertiesValidator.

[Fixes #49067859]
2013-05-02 16:23:08 +01:00
Dave Syer
504d96eb51 [bs-92] Add simple main wrapper for SpringApplication
* Added Spring class
* Used in demo project in README
* Also fixed cycle in spring-bootstrap jar

[Fixes #49121565]
2013-05-02 15:37:47 +01:00
Dave Syer
0a730beb2a [bs-15] Integrate audit abstraction into Spring Security setup
* By default all authentication events are passed onto the
audit listener
* Access denied exceptions are still not published by Spring
Security because of a bug in the Java config support

[Fixes #48155753]
2013-05-02 12:23:57 +01:00
Dave Syer
a310a79909 [bs-15] Add audit abstraction and sensible opinionated defaults
* Added AuditEvent and AuditEventRepository
* Also AuditApplicationEvent and AuditListener for
handling AUditEvents as Spring ApplicationEvents

[Fixes #48155753]
2013-05-02 09:22:59 +01:00
Dave Syer
cee78386ee [bs-87] Add /dump endpoint
* Just dumps ThreadInfo, simple but effective
* Implementation is part of TraceEndpoint

[Fixes #49056831]
2013-05-02 08:32:22 +01:00
Dave Syer
a968b140cc Add java docs to SpringApplication.main 2013-05-02 07:15:55 +01:00
Dave Syer
68960cca4e Fix confusing sentence in README 2013-05-01 16:16:13 +01:00
Dave Syer
ce0e443b0a [bs-84] Add basic getting started guide to service project
Still work in progress, bubt enough there to get someone up a
nd running I hope
[#49047467]
2013-05-01 16:10:57 +01:00
Dave Syer
bd79ec2362 [bs-22] Move @ConfigurationProperties processing to main jar
Also add unit tests.  Note also the start.groovy for the service
sample now works.

[#48127729]
2013-05-01 14:01:13 +01:00
Dave Syer
89748028b4 [bs-35] Add validation for EndpointsProperties
[Fixes #48245695]
2013-05-01 11:38:49 +01:00
Dave Syer
30087cf6b9 [bs-55] Add strategy for setting system exit code
* Added ExitCodeGenerator and SpringApplication.exit
convenience method
* User can add bean of type ExitCodeGenerator or supply
one in the call to exit()

[Fixes #48475971]
2013-05-01 11:17:27 +01:00
Dave Syer
4d372bcc25 Remove runComponents from SpringApplication
It was basically duplicating run(Object[], String[]) - unless
there is some harm in registering a non-component with the context
that I haven't seen yet.
2013-05-01 09:59:10 +01:00
Dave Syer
5501adc862 [bs-35] Add @ConfigurationProperties EndpointsProperties and bind to application.yml
[Fixes #48245695]
2013-05-01 09:14:01 +01:00
Dave Syer
ce2a2beab4 [bs-83] Rename "container" -> "server"
* Also extracted ManagementServerProperties into a separate
bean
* TraceRepository was still causing problems during startup,
fixed that
* Allow management endpoints to be switched off with port=0

[Fixes #49046013]
2013-05-01 08:41:05 +01:00
Dave Syer
ec0e9b17ad More ordering issues in service apps
* The TraceAutoConfiguration in the service project
was loading too early because it contains a BPP
* It also had a Spring Security dependency without any
@Conditional* configuration
* Fixed by nesting the BPP in a class with @Conditional*
2013-04-30 17:37:08 +01:00
Dave Syer
0a58e560b3 Fix ordering snafu with container properties and shutdown 2013-04-30 17:05:30 +01:00
Dave Syer
833b13bbbc [bs-80] Add configurable / switchable web request trace logging (headers etc)
* Added a bean post processor for the Spring Security filter chain
(so you only get traces by default if security is on)
* Every request is logged at trace level if the dump requests flag is
on
* Requests are also dumped to a TraceRepository for later analysis (very
useful for tracing problems in real time when a support call comes in)

[Fixes #48976001]
2013-04-30 15:24:27 +01:00
Dave Syer
dd1fc3f992 Fix service integration tests 2013-04-30 15:24:27 +01:00
Dave Syer
361f500ed5 [bs-28] Add /shutdown endpoint to service apps
Disabled by default use container.allow_shutdown=true to switch
it on.  Then POST to /shutdown to shut down the app.

[#48059059]
2013-04-30 10:17:39 +01:00
Dave Syer
c4028656ef Move context initializers into subpackage 2013-04-29 17:28:04 +01:00
Dave Syer
e3d5bf2e21 [bs-29] Support for XML configuration in groovy apps
Mixed .groovy and .xml now supported bia spring CLI, e.g.

$ spring samples/runner.groovy samples/runner.xml

[Fixes #48059037]
2013-04-29 16:12:29 +01:00
Dave Syer
bb62ca835e [bs-24] Support multi-file compile from command line
* Each non-option arg is tested to see if it is a file
* If it is .groovy (or .java) it is compiled

[#48127661]
2013-04-29 15:54:09 +01:00
Dave Syer
a5f7b6ead3 Remove old groovy script code 2013-04-29 13:50:58 +01:00
Dave Syer
e8e059bc90 [bs-78] Add port=0 option to switch off main servlet container
[Fixes #48888639]
2013-04-29 09:15:03 +01:00
Dave Syer
628a8c79aa [bs-19] Medley of changes supporting integration apps
* Use file adapters in sample instead of internal flow
* Add Exception to signature of CommandLineRunner for
implementation convenience
* Updates for Security snapshots
2013-04-29 08:35:01 +01:00
Dave Syer
10c333ea10 [bs-73] Tweak algorithm for detecting anonymous classes
@Bean definitions in Groovy that contain closures have the bean name in
the class name.  Ugh.  Added regex match to catch that.

[#48718891]
2013-04-26 12:02:49 +01:00
Dave Syer
ec351e5f7d Add test for custom context initializer
[#48127729] [bs-22] Add missing unit tests
2013-04-26 11:05:17 +01:00
Dave Syer
4ca26058fa [bs-73] Tweak configuration class detection algorithm some more
This looks like becoming a recurring theme. Unfortunately it's
not very easy to test if a class might eventually be instantiatable
by Spring.

This change fixes the main bootstrap SpringApplicationTests
which were failing because they used non-static inner classes
for test configurations.
2013-04-26 10:45:17 +01:00
Dave Syer
d6a670e13e [bs-47] Add default command line args to SpringApplication
* See SpringApplication.setDefaultCommandLineArgs
* Assumes command line is in "simple" form (TODO: if we
need JOpt etc. support then the command line args parsing from
Spring needs to be exposed)
* If defaults are provided the command line might be re-ordered
slightly (non-option args come after option args)
* Allows custom application.properties file names to be specified
as a side effect (--spring.config.name=... or
--spring.config.location=...}.

[Fixes #48284369]
2013-04-26 10:45:08 +01:00
Dave Syer
61fa55b524 [bs-62] Add assertions to CLI integration tests
[Fixes #48658503]
2013-04-26 08:22:30 +01:00
Dave Syer
bcf86b320e [bs-72], [bs-75] Add Batch plugin features
* Auto config in main bootstrap jar
* Compiler enhancements in groovy cli
* Sample script in cli samples

[Fixes #48716881], [Fixes #48788313]
2013-04-26 07:01:37 +01:00
Dave Syer
83e0ea22c1 [bs-19] Add samples and CLI support for Spring Integration
$ cd spring-bootstrap-cli
    $ export SPRING_HOME=target
    $ src/main/scripts/spring run samples/integration.groovy

The big disadvantage at the moment is that there is no goo way to
detect Spring Integration in the AST (at least not as good as @Enable*).
So for now we are looking for @MessageEndpoint or a class name with
SpringIntegration in it.

[#48151147]
2013-04-25 17:15:05 +01:00
Dave Syer
d82c50804f [bs-73] Tweak algorithm for detecting anonymous classes
Apparently an anonymous class in Groovy is no anonymous in the compiled code,
so we need another heuristic.  We now check for non-existence of public
constructors (if there are none then there's no point regsistering that
class with an application context).

[#48718891]
2013-04-25 17:12:01 +01:00
Dave Syer
a2d328ae3a [bs-73] Anonymous classes cannot be used in @Bean definitions in .groovy scripts
* Added a test for each of the classes loaded by the SpringApplication
* If it's an anonymous class or looks like a Groovy closure we ignore it
* The CLI sample job.groovy also modified to take advantage

[Fixes #48718891]
2013-04-25 16:02:44 +01:00
Dave Syer
737886e4da Fix help and extend clean command
Examples:

    $ spring clean --all org.springframework commons-logging
    $ spring clean --all org.springframework:spring-tx
2013-04-25 11:25:13 +01:00
Dave Syer
ca99e4d7b9 Remove unnecessary explicit FQCN 2013-04-25 10:18:32 +01:00
Dave Syer
c9a8cb9341 [bs-72] Add Batch compiler by default
We could take this out again when we decide what to do about plugins
but it's good to have it in for now because it shows how to do it,
and exposes some holes.  The job.groovy script now works, but
a lot of it should be defaulted through auto-configuration.

(See also [bs-73] for a non-Batch related bug.)

[#48716881]
2013-04-25 09:36:32 +01:00
Dave Syer
214b3a28db [bs-71] "spring run app.groovy" stalls at end (non-daemon thread)
* Change default so that file is not watched (add --watch to watch it)
* The runner thread is set to daemon mode

[Fixes #48716955]
2013-04-25 09:06:54 +01:00
Dave Syer
a91b482849 Improve readability of SpringBootstrapCompilerAutoConfiguration 2013-04-25 08:42:22 +01:00
Dave Syer
38f0cf1ed2 [bs-62] Add integration tests for CLI samples
[Fixes #48658503]
2013-04-24 16:09:17 +01:00
Dave Syer
c91e83c7d2 [bs-59] Add zip packaging for cli module
* Also added "spring" shell script (in zip), so you can
unzip it and run out of the box
* To run in developer mode use SPRING_HOME, e.g.

        $ cd spring-bootstrap-cli
        $ SPRING_HOME=target src/main/scripts/spring run samples/web.groovy
* Also added "clean" command to remove spring bootstrap grapes
(useful to force a refresh of snapshot jars)

[#48644271]
2013-04-24 11:38:57 +01:00
Dave Syer
8a4b50e289 [bs-14] Ensure all servlet context initializers are called
Misuse of TreeSet in EmbeddedWebApplicationContext corrected
(use List and Comparator instead of TreeSet).

[Fixes #48055339]
2013-04-24 10:14:22 +01:00
Dave Syer
fb6b224470 Fast forward existing prototype work 2013-04-24 10:02:07 +01:00
Phillip Webb
80b151e2b3 first commit 2012-10-21 10:53:52 -07:00