Updated Employee
This commit is contained in:
parent
98bc9c336b
commit
40013de660
|
@ -32,4 +32,4 @@ keytool -importcert -alias MySQLCACert.jks -file root-ca.pem \
|
|||
-keystore truststore.jks -storepass mypassword
|
||||
|
||||
openssl pkcs12 -export -in client-cert.pem -inkey client-key.pem -out certificate.p12 -name "certificate"
|
||||
keytool -importkeystore -srckeystore certificate.p12 -srcstoretype pkcs12 -destkeystore cert.jks
|
||||
keytool -importkeystore -srckeystore certificate.p12 -srcstoretype pkcs12 -destkeystore client-cert.jks
|
|
@ -2,6 +2,9 @@ package com.baeldung.boot.jpa;
|
|||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@RestController
|
||||
public class EmployeeController {
|
||||
|
@ -11,7 +14,8 @@ public class EmployeeController {
|
|||
|
||||
@GetMapping("/employee/{empId}")
|
||||
public Employee get(@PathVariable(name = "empId") Integer empId) {
|
||||
return empRepository.findById(empId).get();
|
||||
Optional<Employee> emp = empRepository.findById(empId);
|
||||
return emp.orElse(null);
|
||||
}
|
||||
|
||||
@PostMapping("/employee")
|
||||
|
|
|
@ -26,10 +26,10 @@ spring:
|
|||
profiles: "dev2"
|
||||
datasource:
|
||||
url: >-
|
||||
jdbc:mysql://localhost:3306/test_db?sslMode=VERIFY_IDENTITY&
|
||||
jdbc:mysql://localhost:3306/test_db?sslMode=VERIFY_CA&
|
||||
trustCertificateKeyStoreUrl=file:/Users/saikatchakraborty/tutorials/persistence-modules/spring-boot-mysql/mysql-server/certs/truststore.jks&
|
||||
trustCertificateKeyStorePassword=mypassword&
|
||||
clientCertificateKeyStoreUrl=file:/Users/saikatchakraborty/tutorials/persistence-modules/spring-boot-mysql/mysql-server/certs/cert.jks&
|
||||
clientCertificateKeyStoreUrl=file:/Users/saikatchakraborty/tutorials/persistence-modules/spring-boot-mysql/mysql-server/certs/client-cert.jks&
|
||||
clientCertificateKeyStorePassword=mypassword
|
||||
username: test_user
|
||||
password: Password2022
|
Loading…
Reference in New Issue