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
|
-keystore truststore.jks -storepass mypassword
|
||||||
|
|
||||||
openssl pkcs12 -export -in client-cert.pem -inkey client-key.pem -out certificate.p12 -name "certificate"
|
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.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
public class EmployeeController {
|
public class EmployeeController {
|
||||||
@ -11,7 +14,8 @@ public class EmployeeController {
|
|||||||
|
|
||||||
@GetMapping("/employee/{empId}")
|
@GetMapping("/employee/{empId}")
|
||||||
public Employee get(@PathVariable(name = "empId") Integer 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")
|
@PostMapping("/employee")
|
||||||
|
@ -26,10 +26,10 @@ spring:
|
|||||||
profiles: "dev2"
|
profiles: "dev2"
|
||||||
datasource:
|
datasource:
|
||||||
url: >-
|
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&
|
trustCertificateKeyStoreUrl=file:/Users/saikatchakraborty/tutorials/persistence-modules/spring-boot-mysql/mysql-server/certs/truststore.jks&
|
||||||
trustCertificateKeyStorePassword=mypassword&
|
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
|
clientCertificateKeyStorePassword=mypassword
|
||||||
username: test_user
|
username: test_user
|
||||||
password: Password2022
|
password: Password2022
|
Loading…
x
Reference in New Issue
Block a user