Commit Graph

1919 Commits (687199e6887f83cc63a62cc837b9f1f4d826c656)

Author SHA1 Message Date
Phillip Webb ed6f11d60d Polish 9 years ago
Brian Clozel 6dc0ecb182 Add WebMvcRegistrations for custom MVC components
Add `WebMvcRegistrations` which can be used to provide custom
instances of `RequestMappingHandlerMapping`,
`RequestMappingHandlerAdapter` and `ExceptionHandlerExceptionResolver`.
Those instances are then used and processed by the Boot MVC
configuration.

Prior to this commit, developers could provide their custom instances
of MVC infrstructure components such as `RequestMappingHandlerMapping`
and `RequestMappingHandlerAdapter` only by using advanced configuration
strategies. Those advanced configurations involved subclassing
`WebMvcConfigurationSupport` which effectively turns off MVC
auto-configuration in Boot.

Fixes gh-5004
Closes gh-6100
9 years ago
Phillip Webb 99c6194e17 Don't use MockitoJUnitRunner
Replace `@RunWith(MockitoJUnitRunner.class)` with direct Mockito
initialization since the running doesn't support parallel test
execution.
9 years ago
Stephane Nicoll 8ea5524d6a Polish 9 years ago
Stephane Nicoll 72e4064230 Merge branch '1.3.x' 9 years ago
Vedran Pavic 6dde498b87 Update DataSourceBuilder aliases
This commit adds a `user` alias for the `username` property which permits
the use of `OracleDataSource`.

Closes gh-6124, gh-6027, gh-6125
9 years ago
Brian Clozel 091664078f Split up DispatcherServletConfiguration condition
Prior to this commit, defining a custom `DispatcherServlet` and/or a
`ServletRegistrationBean` with the default name would turn off
completely the `DispatcherServletAutoConfiguration`.

This commit splits this auto-configuration in two parts:

- First, a `DispatcherServlet` is automatically registered if no
instance is already defined with the default name.
- Then, a `ServletRegistrationBean` is registered is registered if a
`DispatcherServlet` instance exists with the default name *and* no
`ServletRegistrationBean` exists with the default name

This allows developers to register manually a `ServletRegistrationBean`
or a `DispatcherServlet` without having to redefine the whole
auto-configuration.

Fixes gh-4893
Closes gh-6108
9 years ago
Phillip Webb 0fa4d2e260 Make SocialAutoConfigurerAdapter/Properties public
Fixes gh-6078
9 years ago
Johnny Lim 5de9516255 Fix typos
Closes gh-6114
9 years ago
Phillip Webb b38231021d Provide web client Auto-configuration
Add auto-configuration for use with typical web clients. Currently
client auto-configuration consists of a RestTemplateBuilder
pre-configured with HttpMessageConverters.

Closes gh-5507
9 years ago
Phillip Webb bc6f1cfdf3 Polish 9 years ago
Andy Wilkinson 73b01cff4f Use spring.factories to declare each test slice's auto-config imports
Closes gh-6001
9 years ago
Andy Wilkinson 8c9c649805 Fix MongoPropertiesTests following upgrade to Mongo 3.2 (6f5bd2e)
See gh-3011
9 years ago
Johnny Lim 70adefc87b Polish
Closes gh-6046
9 years ago
Andy Wilkinson 6f5bd2e13a Upgrade to MongoDB 3
This commit upgrades to MongoDB 3. Dependency management has been added
for the new and preferred mongodb-driver artifact. The starter has
been updated to use this new artifact rather than monogo-java-driver.
Dependency management for mongo-java-driver has been retained to avoid
causing problems for people who have declared the dependency explicitly.
The auto-configuration for Embedded Mongo has also been updated to
use 3.2.2 by default.

Closes gh-3011
9 years ago
Phillip Webb ccdcad757a Allow template lookup caching to be disabled
Extract TemplateAvailabilityProvider caching logic to a new
TemplateAvailabilityProviders class and provide property support to
disable it. Also update DevToolsPropertyDefaultsPostProcessor to
automatically set the property.

Fixes gh-5989
9 years ago
Stephane Nicoll c3201a1e91 Revert "Cache resolved error template view names"
See gh-5989
9 years ago
Stephane Nicoll dcf3a56bd5 Polish 9 years ago
Stephane Nicoll 3805fc7455 Polish 9 years ago
Phillip Webb f3e630933a Add OAuth PrincipalExtractor strategy interface
Update `UserInfoTokenServices` to use a PrincipalExtractor interface
to extract the principal.

Fixes gh-5186
9 years ago
Phillip Webb 7f45485e61 Provide explicit force request/response properties
Update HttpEncodingProperties to offer explicit `force-request` and
`force-reponse` properties in additional to the existing `force`
property.

Closes gh-5459
9 years ago
Phillip Webb bcfa2e6676 Make TestRestTemplate not extend RestTemplate
Update TestRestTemplate so that it no longer directly extends
RestTemplate. Prior to this commit it was possible that TestRestTemplate
could interfere with user defined RestTemplate beans.

TestRestTemplate offers the same methods as RestTemplate so should be
a drop-in replacement. If access is needed to the actual underlying
template the `getRestTemplate()` method should be used.

Fixes gh-5915
9 years ago
Phillip Webb 00fbb5c3d9 Polish 9 years ago
Dave Syer 46134b58b8 Fix stupid checkstyle violations 9 years ago
Dave Syer 684c8c81a3 Extract user info rest template into a factory
Instead of using a @Bean, it is better to use an opaque factory
for an internal dependency that users are not going to want in
the context. OAuth2RestTemplate is a common enough bean type that
creating on in autoconfig makes it hard for users to add their own
for business use.

See gh-5967
9 years ago
Phillip Webb c15c146021 Cache resolved error template view names
Fixes gh-5933
9 years ago
Phillip Webb 6cdbdf9ad3 Polish 9 years ago
Stephane Nicoll 00f9adafd7 Stop creating a primary `Oauth2RestTemplate`
This commit removes the creation of a `@Primary` `OAuth2RestTemplate`
and updates the documentation accordingly.

Once #5507 is implemented we could revisit this area to provide a way for
users to easily create such a bean.

Closes gh-5202
9 years ago
Andy Wilkinson c11b28c3c7 Align default for OPTIONS request dispatching with Spring Framework 4.3
Closes gh-5965
9 years ago
Stephane Nicoll 2b006aacb3 Validate Spring Session has been configured
This commit validates that a `SessionRepository` has been configured if
Spring Boot is meant to auto-configure one.

Closes gh-5943
9 years ago
Stephane Nicoll 5deca28a9d Improve upgrade path for Spring Session
Commit b7e7bcf made `spring.session.store-type` explicit which means that
users of Spring Session in 1.3 have to set that property to restore the
auto-configuration support in 1.4.

This commit implicitly set the store type to redis if redis is present
and log a warning inviting the user to actually specify that in
configuration.

The entry in the auto-configuration report also mentions that such
arrangement is deprecated.

Closes gh-5838
9 years ago
Johnny Lim 7a62b7d066 Polish
Closes gh-5936
9 years ago
Kazuki Shimizu a4d9ba165f Set default paths for fixed static version
Closes gh-5878
9 years ago
Andy Wilkinson 500edeacc4 Ensure that static error pages have a Content-Type header
The getContentType() accessor method on View appears to only be used
for content negotiation. For the Content-Type header to be included in
the response the view needs to set it explicitly when render is called.

Closes gh-5918
9 years ago
Andy Wilkinson 5c0d400c23 Align Hibernate 5 join table names with those from SpringNamingStrategy
Previously, the name of a join table when using Hibernate 5 would
differ from those when using Hibernate 4 with the default
SpringNamingStrategy.

This commit introduces SpringImplicitNamingStrategy which customises the
name of join tables to match those produced by SpringNamingStrategy.

Closes gh-5880
9 years ago
Phillip Webb cf6212b955 Polish 9 years ago
Phillip Webb 6575ca6ff8 Merge branch 1.3.x 9 years ago
Phillip Webb 7fb545d26c Polish 9 years ago
Andy Wilkinson 0c2ecb7ba0 Apply standard Jackson2ObjectMapperBuilder config via a customizer
This commit builds on the new abstraction introduced in 2a0b8a7 by
applying the standard JacksonProperties-based
Jackson2ObjectMapperBuilder configuration via a customizer.

It also applies some polishing to the original contribution:

 - Code has been formatted
 - Logic that applies the customizers has moved to be alongside the code
   that creates the builder
 - Logic that explicitly sorted the customisers has been removed as
   they will be sorted automatically prior to injection
9 years ago
dziesio deb7529a36 Make it easier to customize auto-configured Jackson2ObjectMapperBuilder
Previously, it was difficult to customize the auto-configured
Jackson2ObjectMapperBuilder. Typically, use of a bean post processor
was required.

This commit introduces Jackson2ObjectMapperBuilderCustomizer. Beans
that implement this interfaces are called during creation of the
auto-configured Jackson2ObjectMapperBuilder, providing an opportunity
to customize its configuration.

Closes gh-5803
9 years ago
Andy Wilkinson 64e668d584 Use AssertJ in JooqExceptionTranslatorTests 9 years ago
Andy Wilkinson 12215533a5 Merge branch '1.3.x' 9 years ago
Andy Wilkinson 1ab835a0f7 Add tests for JooqExceptionTranslator
See gh-5884
9 years ago
tfeiner 61cb18a69c Use JOOQ's Spring DB name during exception translation
The name of a JOOQ SQLDialect does not always match the name defined
in sql-error-codes.xml. For example, the Postgres translator was not
initialized correctly because in JOOQ the dialect is named
SQLDialect.POSTGRES, but in sql-error-codes.xml the bean is named
"PostgreSQL".

This commit updates the translator to use the dialects third-party
springDbName which ensures that it maps correctly to the entries in
sql-error-codes.xml.

Closes gh-5884
9 years ago
Andy Wilkinson 0a765e36f1 Protect against stack overflow when searching meta annotations
It is legal for an annotation to be annotated with itself. Previously,
when searching for meta annotations this could lead to a stack overflow.
This was likely to occur when using Kotlin as, like Java, its Target
annotation is annotated with itself. A stack overflow doesn’t occur
with Java’s Target annotation due to some short-circuiting logic for
annotations in java.lang.

This commit updates the logic for finding meta-annotations to
short-circuit when an annotation that has already been seen is
encountered.

Closes gh-5902
9 years ago
Stephane Nicoll 699d083cec Add load-on-startup property to DispatcherServlet
Closes gh-2481
9 years ago
Spring Buildmaster 819a9574a6 Next Development Version 9 years ago
Andy Wilkinson 3348ed5bb3 Make use of new GetMapping and PostMapping annotations
Closes gh-5277
9 years ago
Stephane Nicoll 2cacc19c91 Polish
See gh-5901
9 years ago
Stephane Nicoll a4ba8f61c9 Backport 6dd8415
While working on gh-5309, a regression was introduced and fixed right the
way on master. Unfortunately, the fix wasn't applied to `1.3.x` as it
should have been.

This commit applies 6dd8415 to `1.3.x`

Closes gh-5901
9 years ago
Stephane Nicoll b7e7bcf717 Make `spring.session.store-type` mandatory
Previously, Spring Session would be auto-configured by the mere presence
of Spring Session in the classpath. This was fragile as determining a
store type according to the environment could easily change when the
classpath of the project changes.

This commit makes the store-type property mandatory. If it is not set,
Spring Session is no longer auto-configured.

Closes gh-5838
9 years ago
Spring Buildmaster 376bbe68d8 Next Development Version 9 years ago
Stephane Nicoll 21536f64e1 Polish info contributor feature
This commit improves the `InfoContributor` infrastructure as follows:

* `InfoEndpoint` no longer breaks its public API and returns a Map as
before
* `Info` is now immutable
* All properties of the build are now displayed. Since we control the
generation of that file, there is no longer a mode to restrict what's
shown
* Build info is now generated in `META-INF/build-info.properties` by
default

Closes gh-5734
9 years ago
Andy Wilkinson a245845521 Correct assertion that were inverted when converting to AssertJ
See gh-5819
9 years ago
Andy Wilkinson c76621b34d Merge branch '1.3.x' 9 years ago
Andy Wilkinson 34420a8768 Allow @ConditionalOnProperty to be used as a meta-annotation
Closes gh-5819
9 years ago
Andy Wilkinson 5b544c918d Merge branch '1.3.x' 9 years ago
Andy Wilkinson 147956a7b2 Avoid creating multiple BeanNameViewResolver beans
ErrorMvcAutoConfiguration creates a BeanNameViewResolver bean in case
the user has used @EnabledWebMvc and disabled WebMvcAutoConfiguration.
If the user hasn’t used @EnabledWebMvc, WebMvcAutoConfiguration will
creates its BeanNameViewResolver and override the one that’s already
been defined by ErrorMvcAutoConfiguration.

This commit makes WebMvcAutoConfiguration’s BeanNameViewResolver
definition conditional on there being no existing BeanNameViewResolver
bean definition.

Closes gh-5354
9 years ago
Dave Syer de6c582c9e Merge remote-tracking branch 'origin/1.3.x' 9 years ago
Dave Syer 905451f92e That BaseConfiguration thing didn't work out after all
It seems like a base class that defines `@Beans` just doesn't
define any beans. Oh well, time to copy-paste.
9 years ago
Dave Syer e58bef5f2b Merge remote-tracking branch 'origin/1.3.x' 9 years ago
Dave Syer 1babdd5c2e Remove log config for non boot things 9 years ago
Dave Syer a86796f126 Merge remote-tracking branch 'origin/1.3.x'
Conflicts:
	spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/OAuth2AutoConfigurationTests.java
9 years ago
Dave Syer e98264debf Move base configuration class to a separate file
to stop it from being included in the enclosing @Configuration.

That way, if the app is not a web app, then there really is a
client_credentials OAuth2 resource (as claimed in the user guide).

Fixes gh-5735
9 years ago
Stephane Nicoll e71cea55ba Remove useless import 9 years ago
Stephane Nicoll 428a10a7d7 Only force request encoding
A recent Spring Framework change in `CharacterEncodingFilter` allows to
configure the force flag separately for requests and responses. This
commit enables the flag only for requests which should provide a better
default with binary content.

Closes gh-5459
9 years ago
Stephane Nicoll 6f4ec4e741 Inject ApplicationEventPublisher
Previously, the auto-configured
`OAuth2ClientAuthenticationProcessingFilter` instance had no
`ApplicationEventPublisher`. As a result, no event was fired. This commit
makes sure to associate the event publisher instance.

Closes gh-5853
9 years ago
Johnny Lim 7763c2ae4c Polish
Closes gh-5843
9 years ago
Phillip Webb 2d243f0668 Don't apply multiple session configurations
Add additional @ConditionalOnMissingBean guards to session
configurations to ensure that the first wins. Also reorder imports
to prefer Redis over JDBC.

See gh-5158
9 years ago
Phillip Webb 6466c0afa5 Polish 9 years ago
Stephane Nicoll bf89c8ee46 Polish spring session auto-configuration
This commit improves the initial submission by adding more tests and
more configuration options.

Closes gh-5158
9 years ago
Eddú Meléndez 0be00e2a6d Polish session auto-configuration
See gh-5158
9 years ago
Tommy Ludwig de007840a8 Spring Session auto-configuration expansion
This implementation was inspired in large part by the cache
auto-configuration. In addition to the originally supported Redis, now
Hazelcast, an in-memory map, as well as a no-op option are supported. It
should be easy to extend this to include additional data stores in the
future.

Closes gh-3811
9 years ago
Stephane Nicoll 9059184a6a Clarify commons-pool2 requirement for redis
`JedisConnectionFactory` needs `commons-pool2` for quite some time now
and our auto-configuration had a special case to handle redis if
`commons-pool2` isn't available.

This commit removes that code as using it would lead to a failure anyway.

Closes gh-5718
9 years ago
Johnny Lim 0efa0038c3 Polish
Closes gh-5815
9 years ago
Phillip Webb 0bf025af7b Add out-of-the-box support for status error pages
Allow convention based status error pages. Static HTML or templates
can be used by placing the appropriately named file under a `/error`
folder. For example:

	/src/main/resource/templates/error/404.ftl
or	/src/main/resource/public/error/404.html

Pages can also be named after the status series (5xx or 4xx).

Fixes gh-2691
9 years ago
Phillip Webb 590bd5c084 Fixup warnings 9 years ago
Phillip Webb 08ef5f4b1f Make ErrorPageRegistry first class concern
Create ErrorPageRegistry and ErrorPageRegistrar interfaces that allow
error page registration to be a first class concern.

Prior to this commit ErrorPageFilter needed to implement
ConfigurableEmbeddedServletContainer in order to receive ErrorPage
registrations.

Closes gh-5789
9 years ago
Phillip Webb 609cb52cd4 Move to relocated web classes
Refactor code to move from recently deprecated classes.

Closes gh-5822
9 years ago
Phillip Webb aea18671c1 Restructure web related classes
Reorganize web related classes for better separation of concerns.
Mainly this involves moving classes from `o.s.b.context.embedded`
that aren't directly tied to embedded servlet containers to
`o.s.b.web` and relocating everything from `o.s.b.context.web`.

See gh-5822
9 years ago
Phillip Webb a7cb689f95 Move @LocalServerPort annotation
Move the @LocalServerPort to org.springframework.boot.context.embedded
since it's only really useful when working with embedded servlet
containers.

See gh-5822
9 years ago
Phillip Webb f468aff47f Merge remote-tracking branch '1.3.x' 9 years ago
Phillip Webb ef7b511b0e Polish 9 years ago
Dave Syer ebb0ff8638 Merge remote-tracking branch 'origin/1.3.x' 9 years ago
Dave Syer 9c0679b1f4 Add support for spring.rabbitmq.ssl.algorithm
Rabbit client 3.6.* uses TLSv1.1 as the default algorithm which
many brokers are deisabling these days. Spring AMQP supports
changing the algorithm by name, so this is just a pass thru for
that.
9 years ago
Phillip Webb 2679a6f0c6 Polish 9 years ago
Stephane Nicoll ad5674cbb0 Merge branch '1.3.x' 9 years ago
Stephane Nicoll ac8e87d79f Polish contribution
Closes gh-5782
9 years ago
Venil Noronha d5554e0aa1 Use static-locations properties to locate favicon
Closes gh-5751
9 years ago
Stephane Nicoll 1ef3327441 Move multipart.* properties to spring.http.multipart.*
Closes gh-3044
9 years ago
Stephane Nicoll 5f41e82a89 Merge branch '1.3.x' 9 years ago
Stephane Nicoll 247685e992 Add missing `@Documented`
Closes gh-5786
9 years ago
Johnny Lim db2092e27d Polish
Closes gh-5798
9 years ago
Stephane Nicoll 23f669f8f5 Polish
See gh-5791
9 years ago
Fabrizio Cucci 7859438538 Fix typo in Servlet auto-configuration Javadoc
Removed misplaced "for" in javadoc for Tomcat nested configuration.

Closes gh-5779
9 years ago
Eddú Meléndez 99b830ebe7 Support different schema/data DB script users
Allow data and/or schema scripts to be run by different database users.

Fixes gh-5402
Closes gh-5788
9 years ago
Gary Russell 12b9f0262b Add RabbitMQ Connection Timeout Property
Fixes gh-685
Closes gh-5791
9 years ago
Dave Syer 568d716c99 Move OAuth2ClientContextFilter back before the main security filter
It sometimes has to catch an exception from the security filter so
it needs to be before, and somehow this hasn't been a problem up to
now, but probably only by some fluke.

Fixes gh-5792
9 years ago
Phillip Webb 93382648ab Formatting 9 years ago
Phillip Webb 79922360e1 Polish 9 years ago