Fixed whitespace and added private modifiers to @Value-annotated fields in the @Configuration example

This commit is contained in:
Chris Beams 2009-04-18 00:22:03 +00:00
parent 8aface8e5d
commit c78f9d14fa
1 changed files with 23 additions and 24 deletions

View File

@ -314,9 +314,9 @@ public class RewardsTestDatabase {
<para>Here is an example of a Java class providing basic configuration
using the new JavaConfig features: <programlisting language="java">@Configuration
public class AppConfig{
@Value("#{jdbcProperties.url}") String jdbcUrl;
@Value("#{jdbcProperties.username}") String username;
@Value("#{jdbcProperties.password}") String password;
private @Value("#{jdbcProperties.url}") String jdbcUrl;
private @Value("#{jdbcProperties.username}") String username;
private @Value("#{jdbcProperties.password}") String password;
@Bean
public FooService fooService() {
@ -338,8 +338,7 @@ public class AppConfig{
@Bean
public DataSource dataSource() {
return new DriverManagerDataSource(jdbcUrl,
username, password);
return new DriverManagerDataSource(jdbcUrl, username, password);
}
}
</programlisting> To get this to work you need to add the following component