SPR-7416
Typo on the name of the @Autowired annotation: @Autowire -> @Autowired
Usage of the @Value annotation: ${jdbcProperties.url} -> ${jdbc.url} (inside section "Declaring @Configuration classes as plain Spring <bean/> elements").
This commit is contained in:
parent
8e77701358
commit
6adf8d18df
|
|
@ -4654,7 +4654,7 @@ dataSource.url=jdbc:mysql:mydb</programlisting>
|
||||||
<para>JSR 330's @Inject annotation can be used in place of Spring's
|
<para>JSR 330's @Inject annotation can be used in place of Spring's
|
||||||
<interfacename>@Autowired</interfacename> in the examples below.
|
<interfacename>@Autowired</interfacename> in the examples below.
|
||||||
<interfacename>@Inject</interfacename> does not have a required
|
<interfacename>@Inject</interfacename> does not have a required
|
||||||
property unlike Spring's <interfacename>@Autowire</interfacename>
|
property unlike Spring's <interfacename>@Autowired</interfacename>
|
||||||
annotation which has a <literal>required</literal> property to
|
annotation which has a <literal>required</literal> property to
|
||||||
indicate if the value being injected is optional. This behavior is
|
indicate if the value being injected is optional. This behavior is
|
||||||
enabled automatically if you have the JSR 330 JAR on the
|
enabled automatically if you have the JSR 330 JAR on the
|
||||||
|
|
@ -6352,9 +6352,9 @@ jdbc.password=</programlisting> <programlisting language="java">public static vo
|
||||||
minimum. <programlisting language="java">@Configuration
|
minimum. <programlisting language="java">@Configuration
|
||||||
@ImportResource("classpath:/com/acme/properties-config.xml")
|
@ImportResource("classpath:/com/acme/properties-config.xml")
|
||||||
public class AppConfig {
|
public class AppConfig {
|
||||||
private @Value("${jdbcProperties.url}") String url;
|
private @Value("${jdbc.url}") String url;
|
||||||
private @Value("${jdbcProperties.username}") String username;
|
private @Value("${jdbc.username}") String username;
|
||||||
private @Value("${jdbcProperties.password}") String password;
|
private @Value("${jdbc.password}") String password;
|
||||||
|
|
||||||
public @Bean DataSource dataSource() {
|
public @Bean DataSource dataSource() {
|
||||||
return new DriverManagerDataSource(url, username, password);
|
return new DriverManagerDataSource(url, username, password);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue