-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathOracleConfiguration.java
More file actions
48 lines (38 loc) · 1.12 KB
/
OracleConfiguration.java
File metadata and controls
48 lines (38 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package guru.springframework.configuration;
import oracle.jdbc.pool.OracleDataSource;
import org.springframework.context.annotation.Bean;
import javax.sql.DataSource;
import javax.validation.constraints.NotNull;
import java.sql.SQLException;
/**
* Un-comment the annoations to use the Oracle Java config
*/
//@Configuration
//@ConfigurationProperties("oracle")
public class OracleConfiguration {
@NotNull
private String username;
@NotNull
private String password;
@NotNull
private String url;
public void setUsername(String username) {
this.username = username;
}
public void setPassword(String password) {
this.password = password;
}
public void setUrl(String url) {
this.url = url;
}
@Bean
DataSource dataSource() throws SQLException {
OracleDataSource dataSource = new OracleDataSource();
dataSource.setUser(username);
dataSource.setPassword(password);
dataSource.setURL(url);
dataSource.setImplicitCachingEnabled(true);
dataSource.setFastConnectionFailoverEnabled(true);
return dataSource;
}
}