Commit Graph

5742 Commits

Author SHA1 Message Date
Dave Syer
7a285cf65d Convert all sample tests to @IntegrationTest where appropriate
Makes them a lot more readable IMO, and also enables @Autowiring
from the context into the test case (sweeet). I added @DirtiesContext
to all of them as well to be on the safe side, but possbly that can be
optimized in some way as well.
2014-03-11 13:54:30 +00:00
Dave Syer
123457a588 Add @IntegrationTest annotation for test classes
Allowing use of embededded container in @SpringApplicationConfiguration
tests, e.g.

```
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = Config.class)
@WebAppConfiguration
@IntegrationTest
public class SpringApplicationIntegrationTestTests {

	@Test
	public void nestedConfigClasses() {
		String body = new RestTemplate().getForObject("http://localhost:8080/",
				String.class);
		assertEquals("Hello World", body);
	}

	@Configuration
	@EnableWebMvc
	@RestController
	protected static class Config {

		@Bean
		public DispatcherServlet dispatcherServlet() {
			return new DispatcherServlet();
		}

		@Bean
		public EmbeddedServletContainerFactory embeddedServletContainer() {
			return new TomcatEmbeddedServletContainerFactory();
		}

		@RequestMapping("/")
		public String home() {
			return "Hello World";
		}

	}

}
```

Fixes gh-473
2014-03-11 12:36:03 +00:00
Chris Beams
4f62a7c6c2 Fix typo in ConfigFileAppListener#addProper(=>t)ySources 2014-03-11 11:11:35 +00:00
Chris Beams
e10856fd9b Refactor SpringApplication Environment config hooks
Per discussion: fixes gh-467
2014-03-11 11:09:31 +00:00
Dave Syer
d4083e46fe Add exlcusion to httpcomponents dependency 2014-03-11 11:07:52 +00:00
Piotr Maj
1b167f630c Support for maxWait, jdbcInterceptors and validationInterval
Fixes gh-470
2014-03-10 17:08:04 +00:00
Dave Syer
4d172ca742 Remove duplicate resources from classpath
We had been making a special case for logback.xml anyway, so
extending that to simply deleting recursively all of
src/main/resources (or equivalent) from target/classes (or
equivalent) seems like it's perfectly justifiable.

Fixes gh-451
2014-03-10 17:04:44 +00:00
Dave Syer
6657e3ef84 More care taken with management.contextPath
The management.contextPath property should now be respected in a
secure application, whether or not the management.port is different.

Added some test cases in the sample to verify.

Fixes gh-469
2014-03-10 16:28:13 +00:00
Andy Wilkinson
44826812db Add templates/** to list of default includes for CLI jars
Boot promotes the use of a templates directory for housing view
templates. Include this directory by default when building a jar file
from a CLI app.

Fixes #455
2014-03-10 10:28:50 +00:00
Piotr Maj
cb6739b4a5 Added testWhileIdle etc.
Fixes gh-463
2014-03-09 21:22:14 +00:00
Andy Piper
695b3917b2 fix link to install.txt
Explicitly link to install.txt in source repo to avoid issues on projects.spring.io with a broken relative link
... also fix this for rendered markdown on GH itself :-)
2014-03-09 21:19:58 +00:00
Dave Syer
c9efa5ac13 Allow non-string return from health query 2014-03-08 16:04:30 +00:00
Andy Piper
9d4e940f56 fixup yaml codeblock 2014-03-08 15:56:14 +00:00
Andy Piper
7b4fa22b40 Fix typo 2014-03-08 15:53:21 +00:00
Sebastien Deleuze
ab6c8dfee3 Use org.springframework.boot groupId in spring-boot-samples
Use org.springframework.boot instead of ${project.groupId}
groupId in order to make it easier to use spring-boot-samples
modules as a starting point for new projects.
2014-03-07 17:02:20 +00:00
Dave Syer
c68902260e Change explicit bean type to concrete NamedParameterJdbcTemplate
Fixes gh-447
2014-03-07 11:06:58 +00:00
Josh Long
9453a6324a polishing documentation 2014-03-07 11:04:41 +00:00
Dave Syer
da7d543305 Remove assumption in test about /tmp location 2014-03-07 09:51:23 +00:00
Dave Syer
8168e8a327 Special case for root of classpath resource in archive
This turns out to affect JPA, but only because it looks for a URL for the
root of the classpath using ClassLoader.getResource("") which barfs in
an app launched from an executable JAR. It's easy to make a special case
for "" in the class loader, so I went ahead and did that. Possibly need
to think what the implication of getResources("") is as well (not
tested in an app yet).

Fixes gh-420
2014-03-06 11:36:47 +00:00
Dave Syer
afac085318 Use java.io.tmpdir instead of /tmp
Fixes gh-441
2014-03-06 09:26:32 +00:00
Dave Syer
77fd127e09 Use redis starter in sample 2014-03-05 17:25:36 +00:00
Dave Syer
aebf3c2bef Tweak external config file loading to support additional profiles
Profiles set with Environment.setActiveProfiles() (rather than
spring.profiles.active) *before* any config files are processed, are
treated as "additional" (to the ones supplied in spring.profiles.active
from all sources, files and System properties included).

Fixes gh-429
2014-03-05 15:56:24 +00:00
Dave Syer
de9b6a6a22 Switch off debug in secure sample
Fixes gh-438
2014-03-05 14:46:31 +00:00
Dave Syer
c53a36717d Consider subtypes in exception error page mapping
Fixes gh-417
2014-03-05 09:45:13 +00:00
Dave Syer
a0ba8c90a6 Add MultipartConfig to DispatcherServlet by default
RC4 added a ServletRegistrationBaen for teh DispatcherServlet and we
didn't register a MultipartConfigElement if one was present.

Fixes gh-427
2014-03-05 09:30:18 +00:00
Dave Syer
ffe91ca6bf Change exception message for missing Thymeleaf templates
Fixes gh-424
2014-03-05 09:07:15 +00:00
Dave Syer
6b83e0ad5d Change bean name of ContentNegotiatingViewResolver
Fixed gh-428
2014-03-05 08:56:53 +00:00
Dave Syer
15372cb737 Add Maven example for Tomcat 8
Fixes gh-430
2014-03-04 22:28:05 +00:00
Dave Syer
f9094143d7 Remove undefined FILE appender from basic log4j config
Fixes gh-433
2014-03-04 22:23:44 +00:00
Dave Syer
b56bd0a10c Add ViewResolver docs 2014-03-04 22:17:50 +00:00
Dave Syer
3bc37ddde0 Strip out most of websocket autoconfig
... leaving only the embedded Tomcat enabling feature (registering
the WsSci).

Fixes part of gh-65
2014-03-04 16:25:10 +00:00
Andy Wilkinson
326c12d1f5 Update Spring repository url in Gradle samples 2014-03-04 13:15:41 +00:00
Phillip Webb
7e60b1996b Fixup starter-parent POM 2014-03-04 00:06:27 -08:00
Phillip Webb
6934b340ce Update README to RC4 2014-03-03 23:50:56 -08:00
Phillip Webb
1995b62530 Fixup starter-parent POM 2014-03-03 23:43:58 -08:00
Spring Buildmaster
b0d4e8ae69 Next development version 2014-03-03 22:46:12 -08:00
Spring Buildmaster
cb8668a151 Release version 1.0.0.RC4 2014-03-03 22:46:05 -08:00
Phillip Webb
02faa0af0d Merge pull request #415 from adambro/patch-2
* patch-2:
  Correct link to samples.
2014-03-03 21:34:54 -08:00
Adam Brodziak
45cd52586b Correct link to samples.
Fixes gh-415
2014-03-03 21:34:42 -08:00
Phillip Webb
6c8e81f870 Rework ErrorWrapperEmbeddedServletContainerFactory
Rename ErrorWrapperEmbeddedServletContainerFactory to ErrorPageFilter
and extend AbstractConfigurableEmbeddedServletContainer rather
than AbstractEmbeddedServletContainerFactory.

Fixes gh-416
2014-03-03 21:24:13 -08:00
Phillip Webb
99350a2216 Tidy ConfigurableEmbeddedServletContainerFactory
Rename ConfigurableEmbeddedServletContainerFactory to
ConfigurableEmbeddedServletContainer and extract
AbstractConfigurableEmbeddedServletContainer from
AbstractEmbeddedServletContainerFactory.
2014-03-03 21:10:56 -08:00
Phillip Webb
3f9ca68812 Tweak ConfigurableEmbeddedServletContainerFactory
Update ConfigurableEmbeddedServletContainerFactory to no longer directly
extend EmbeddedServletContainerFactory.
2014-03-03 18:39:18 -08:00
Phillip Webb
9c4dc0c68f Drop getPort from ConfEmbServletContainerFactory
Remove getPort() from ConfigurableEmbeddedServletContainerFactory to
keep the interface primarily setters.
2014-03-03 18:10:08 -08:00
Phillip Webb
468728a2c0 Polish 2014-03-03 17:50:19 -08:00
Dave Syer
07b88630f4 Be defensive with auto-config of Servlet 3.0 features
There's no explicit support for older Servlet specs in Spring Boot,
but we can at least make it easy for others to provide such
support by not adding stuff to the context when in an older container.
2014-03-03 18:08:38 +00:00
Dave Syer
8ff9e67714 Add actuator to method security sample 2014-03-03 15:03:08 +00:00
Dave Syer
9504f6e5a9 Add method security web sample
Useful sample for common use case where user adds custom Authentication,
a form login, *and* global method security all the the same application.
2014-03-03 14:24:08 +00:00
Dave Syer
b0b7bc0e7f Fix tests
Some assumptions were being made in tests, e.g. about
there being an AuthenticationManager @Bean, which were
false with the new Security 3.2.1 updates from Rob.

Also parent-child contexts with the actuator were
problematic because they didn't exclude the web configuration
for the management security in the parent context.

Fixes gh-244
2014-03-03 12:22:36 +00:00
Rob Winch
6b0eba3759 Update to Spring Security 3.2.1
Also change strategy for defaulting of Authentication. Spring
Boot authentication defaults are now encapsulated and can easily
be overridden by a user defined AuthenticationManager.
2014-03-03 12:21:37 +00:00
Dave Syer
13e040c06e Add ErrorWrapperEmbeddedServletContainerFactory for error pages in WARs
Error pages are a feature of the servlet spec but there is no Java API for
registering them in the spec. This filter works around that by accepting error page
registrations from Spring Boot's EmbeddedServletContainerCustomizer (any beans
of that type in the context will be applied to this container).

In addition the ErrorController interface was enhanced to provide callers
the option to suppress logging.

Fixes gh-410
2014-03-03 09:52:40 +00:00