lundi 2 mars 2015

Configure DataSource programmatically in Spring Boot



With Spring Boot I can instantiate a JdbcTemplate with the following:


Code:



@Autowired
private JdbcTemplate jdbcTemplate;


Properties:



spring.datasource.url=jdbc:http://postgresqlmy_url:my_port/my_other_stuff
spring.datasource.username=my_user_name
spring.datasource.password=my_password
spring.datasource.driver-class-name=org.postgresql.Driver


This create a DataSource of class: org.apache.tomcat.jdbc.pool.DataSource


How do I set the DataSource username/password programmatically?


We have a policy not to store credentials in plain text and I have to use a specific credential provider where I work.




Aucun commentaire:

Enregistrer un commentaire