Meu código está exatamente igual a solução proposta pelo professor. Entretando ao tentar adicionar um funcionário, quando adiciono a unidade ele apresenta o seguinte erro:
Digite o cargoId
1
Digite o unidadeId (Para sair digite 0)
1
Digite o unidadeId (Para sair digite 0)
0
2021-07-03 19:50:21.297 INFO 1800 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-07-03 19:50:21.321 ERROR 1800 --- [ main] o.s.boot.SpringApplication : Application run failed
java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:794) ~[spring-boot-2.5.2.jar:2.5.2]
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:775) ~[spring-boot-2.5.2.jar:2.5.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:345) ~[spring-boot-2.5.2.jar:2.5.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[spring-boot-2.5.2.jar:2.5.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) ~[spring-boot-2.5.2.jar:2.5.2]
at br.com.alura.spring.data.SpringDataApplication.main(SpringDataApplication.java:35) ~[classes/:na]
Caused by: java.time.format.DateTimeParseException: Text '04031999' could not be parsed at index 2
at java.base/java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:2046) ~[na:na]
at java.base/java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1948) ~[na:na]
at java.base/java.time.LocalDate.parse(LocalDate.java:428) ~[na:na]
at br.com.alura.spring.data.service.CrudFuncionarioService.salvar(CrudFuncionarioService.java:92) ~[classes/:na]
at br.com.alura.spring.data.service.CrudFuncionarioService.inicial(CrudFuncionarioService.java:50) ~[classes/:na]
at br.com.alura.spring.data.SpringDataApplication.run(SpringDataApplication.java:53) ~[classes/:na]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:791) ~[spring-boot-2.5.2.jar:2.5.2]
... 5 common frames omitted
2021-07-03 19:50:22.098 INFO 1800 --- [ main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2021-07-03 19:50:22.100 INFO 1800 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2021-07-03 19:50:22.108 INFO 1800 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
Resolvido após passar a data no formado 21/10/2020, um id existente para o cargo e para a unidade.