Revize ba8b306a
Přidáno uživatelem Vojtěch Danišík před asi 4 roky(ů)
src/main/java/vldc/aswi/configuration/DbConfig.java | ||
---|---|---|
5 | 5 |
import com.sun.istack.NotNull; |
6 | 6 |
import oracle.jdbc.pool.OracleDataSource; |
7 | 7 |
import org.springframework.boot.context.properties.ConfigurationProperties; |
8 |
import org.springframework.boot.jdbc.DataSourceBuilder; |
|
9 | 8 |
import org.springframework.context.annotation.Bean; |
10 | 9 |
import org.springframework.context.annotation.Configuration; |
11 | 10 |
import org.springframework.transaction.annotation.EnableTransactionManagement; |
12 | 11 |
|
13 | 12 |
import java.sql.SQLException; |
14 | 13 |
|
14 |
/** |
|
15 |
* Connection configuration for database. |
|
16 |
*/ |
|
15 | 17 |
@Configuration |
16 | 18 |
@EnableTransactionManagement |
17 | 19 |
@ConfigurationProperties(prefix = "oracle") |
18 | 20 |
public class DbConfig { |
19 | 21 |
|
22 |
/** Username of logging user. */ |
|
20 | 23 |
@NotNull |
21 | 24 |
private String username; |
22 | 25 |
|
26 |
/** Password of logging user. */ |
|
23 | 27 |
@NotNull |
24 | 28 |
private String password; |
25 | 29 |
|
30 |
/** TNS url for connection into database. */ |
|
26 | 31 |
@NotNull |
27 | 32 |
private String url; |
28 | 33 |
|
34 |
/** |
|
35 |
* Set new username. |
|
36 |
* @param username - User's name. |
|
37 |
*/ |
|
29 | 38 |
public void setUsername(String username) { |
30 | 39 |
this.username = username; |
31 | 40 |
} |
32 | 41 |
|
42 |
/** |
|
43 |
* Set new password. |
|
44 |
* @param password - User's password. |
|
45 |
*/ |
|
33 | 46 |
public void setPassword(String password) { |
34 | 47 |
this.password = password; |
35 | 48 |
} |
36 | 49 |
|
50 |
/** |
|
51 |
* Set new url. |
|
52 |
* @param url - TNS url for connection into database. |
|
53 |
*/ |
|
37 | 54 |
public void setUrl(String url) { |
38 | 55 |
this.url = url; |
39 | 56 |
} |
40 | 57 |
|
58 |
/** |
|
59 |
* Create new datasource. |
|
60 |
* @return new Datasource of currently logged database. |
|
61 |
* @throws SQLException |
|
62 |
*/ |
|
41 | 63 |
@Bean |
42 | 64 |
DataSource dataSource() throws SQLException { |
43 | 65 |
OracleDataSource dataSource = new OracleDataSource(); |
Také k dispozici: Unified diff
re #7886 Assembly validator in progress (validating assembly SQLQuery + locations for existing assembly, not tested for new assembly).
Added comments.
Removing unused imports.