Boa tarde, estou com um problema que acho que é pq não implementei algo ainda, só não sei o que é. Sei que pode ser algo simples mas agradeço se alguem puder me ajudar a aprender sobre.
Aparece o seguinte erro para mim:
>
> . ____ _ __ _ _
> /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
> ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
> \\/ ___)| |_)| | | | | || (_| | ) ) ) )
> ' |____| .__|_| |_|_| |_\__, | / / / /
> =========|_|==============|___/=/_/_/_/
> :: Spring Boot :: (v2.2.2.RELEASE)
>
> 2020-03-08 13:33:16.063 INFO 5204 --- [ restartedMain] br.com.basis.prova.ProvaApplication : Starting ProvaApplication on Avell with PID 5204 (C:\Users\Avell\Desktop\DesafioBasis\avaliacao-basis\target\classes started by Avell in C:\Users\Avell\Desktop\DesafioBasis\avaliacao-basis)
> 2020-03-08 13:33:16.065 INFO 5204 --- [ restartedMain] br.com.basis.prova.ProvaApplication : No active profile set, falling back to default profiles: default
> 2020-03-08 13:33:16.102 INFO 5204 --- [ restartedMain] o.s.b.devtools.restart.ChangeableUrls : The Class-Path manifest attribute in C:\Users\Avell\.m2\repository\org\glassfish\jaxb\jaxb-runtime\2.3.2\jaxb-runtime-2.3.2.jar referenced one or more files that do not exist: file:/C:/Users/Avell/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.2/jakarta.xml.bind-api-2.3.2.jar,file:/C:/Users/Avell/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.2/txw2-2.3.2.jar,file:/C:/Users/Avell/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.2/istack-commons-runtime-3.0.8.jar,file:/C:/Users/Avell/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.2/stax-ex-1.8.1.jar,file:/C:/Users/Avell/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.2/FastInfoset-1.2.16.jar,file:/C:/Users/Avell/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.2/jakarta.activation-api-1.2.1.jar
> 2020-03-08 13:33:16.102 INFO 5204 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
> 2020-03-08 13:33:16.102 INFO 5204 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
> 2020-03-08 13:33:16.602 INFO 5204 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
> 2020-03-08 13:33:16.667 INFO 5204 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 58ms. Found 3 JPA repository interfaces.
> 2020-03-08 13:33:16.954 INFO 5204 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
> 2020-03-08 13:33:17.561 INFO 5204 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
> 2020-03-08 13:33:17.569 INFO 5204 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
> 2020-03-08 13:33:17.569 INFO 5204 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.29]
> 2020-03-08 13:33:17.653 INFO 5204 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
> 2020-03-08 13:33:17.653 INFO 5204 --- [ restartedMain] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1550 ms
> 2020-03-08 13:33:17.749 INFO 5204 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
> 2020-03-08 13:33:17.902 INFO 5204 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
> 2020-03-08 13:33:18.634 INFO 5204 --- [ restartedMain] liquibase.executor.jvm.JdbcExecutor : SELECT COUNT(*) FROM provabasis.DATABASECHANGELOGLOCK
> 2020-03-08 13:33:18.639 INFO 5204 --- [ restartedMain] liquibase.executor.jvm.JdbcExecutor : SELECT COUNT(*) FROM provabasis.DATABASECHANGELOGLOCK
> 2020-03-08 13:33:18.641 INFO 5204 --- [ restartedMain] liquibase.executor.jvm.JdbcExecutor : SELECT `LOCKED` FROM provabasis.DATABASECHANGELOGLOCK WHERE ID=1
> 2020-03-08 13:33:18.650 INFO 5204 --- [ restartedMain] l.lockservice.StandardLockService : Successfully acquired change log lock
> 2020-03-08 13:33:19.413 INFO 5204 --- [ restartedMain] liquibase.executor.jvm.JdbcExecutor : SELECT MD5SUM FROM provabasis.DATABASECHANGELOG WHERE MD5SUM IS NOT NULL LIMIT 1
> 2020-03-08 13:33:19.414 INFO 5204 --- [ restartedMain] liquibase.executor.jvm.JdbcExecutor : SELECT COUNT(*) FROM provabasis.DATABASECHANGELOG
> 2020-03-08 13:33:19.414 INFO 5204 --- [ restartedMain] l.c.StandardChangeLogHistoryService : Reading from provabasis.DATABASECHANGELOG
> 2020-03-08 13:33:19.415 INFO 5204 --- [ restartedMain] liquibase.executor.jvm.JdbcExecutor : SELECT * FROM provabasis.DATABASECHANGELOG ORDER BY DATEEXECUTED ASC, ORDEREXECUTED ASC
> 2020-03-08 13:33:19.430 INFO 5204 --- [ restartedMain] l.lockservice.StandardLockService : Successfully released change log lock
> 2020-03-08 13:33:19.508 INFO 5204 --- [ restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
> 2020-03-08 13:33:19.568 INFO 5204 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate Core {5.4.9.Final}
> 2020-03-08 13:33:19.680 INFO 5204 --- [ restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
> 2020-03-08 13:33:19.775 INFO 5204 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
> 2020-03-08 13:33:20.430 INFO 5204 --- [ restartedMain] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
> 2020-03-08 13:33:20.436 INFO 5204 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
> 2020-03-08 13:33:20.444 WARN 5204 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'alunoRecurso' defined in file [C:\Users\Avell\Desktop\DesafioBasis\avaliacao-basis\target\classes\br\com\basis\prova\recurso\AlunoRecurso.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'alunoServico' defined in file [C:\Users\Avell\Desktop\DesafioBasis\avaliacao-basis\target\classes\br\com\basis\prova\servico\AlunoServico.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'br.com.basis.prova.servico.mapper.AlunoMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
> 2020-03-08 13:33:20.444 INFO 5204 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
> 2020-03-08 13:33:20.447 INFO 5204 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
> 2020-03-08 13:33:20.453 INFO 5204 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
> 2020-03-08 13:33:20.454 INFO 5204 --- [ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
> 2020-03-08 13:33:20.461 INFO 5204 --- [ restartedMain] ConditionEvaluationReportLoggingListener :
>
> Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
> 2020-03-08 13:33:20.528 ERROR 5204 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :
>
> ***************************
> APPLICATION FAILED TO START
> ***************************
>
> Description:
>
> Parameter 0 of constructor in br.com.basis.prova.servico.AlunoServico required a bean of type 'br.com.basis.prova.servico.mapper.AlunoMapper' that could not be found.
>
>
> Action:
>
> Consider defining a bean of type 'br.com.basis.prova.servico.mapper.AlunoMapper' in your configuration.
AlunoMapper.java:
> package br.com.basis.prova.servico.mapper;
>
> import br.com.basis.prova.dominio.Aluno;
> import br.com.basis.prova.dominio.dto.AlunoDTO;
> import org.mapstruct.Mapper;
>
> @Mapper(componentModel = "spring", uses = { DisciplinaMapper.class })
> public interface AlunoMapper extends EntityMapper<AlunoDTO, Aluno> {
> }
AlunoServico.java:
> package br.com.basis.prova.servico;
>
> import java.util.ArrayList;
> import java.util.List;
>
> import org.springframework.stereotype.Service;
> import org.springframework.transaction.annotation.Transactional;
>
> import br.com.basis.prova.dominio.Aluno;
> import br.com.basis.prova.dominio.dto.AlunoDTO;
> import br.com.basis.prova.dominio.dto.AlunoDetalhadoDTO;
> import br.com.basis.prova.repositorio.AlunoRepositorio;
> import br.com.basis.prova.servico.exception.RegraNegocioException;
> import br.com.basis.prova.servico.mapper.AlunoMapper;
>
> @Service
> @Transactional
> public class AlunoServico {
>
> private AlunoMapper alunoMapper;
> private AlunoRepositorio alunoRepositorio;
>
> public AlunoServico(AlunoMapper alunoMapper, AlunoRepositorio alunoRepositorio) {
> this.alunoMapper = alunoMapper;
> this.alunoRepositorio = alunoRepositorio;
> }
>
> public AlunoDTO salvar(AlunoDTO alunoDTO) {
> Aluno aluno = alunoMapper.toEntity(alunoDTO);
>
> if (verificarCPF(aluno)) {
> throw new RegraNegocioException("CPF já existe");
> }
>
> return alunoMapper.toDto(aluno);
> }
>
> private boolean verificarCPF(Aluno aluno) {
> Aluno alunoCpf = alunoRepositorio.findByCpf(aluno.getCpf());
> return !(alunoCpf == null || alunoCpf.getId().equals(aluno.getId()));
> }
>
> public void excluir(String matricula) {
> }
>
> public List<AlunoDTO> consultar() {
> return new ArrayList<>();
> }
>
> public AlunoDetalhadoDTO detalhar(Integer id) {
> alunoRepositorio.findById(id).orElseThrow(() -> new RegraNegocioException("Registro não encontrado"));
> return new AlunoDetalhadoDTO();
> }
>
> }
AlunoRecurso.java:
> package br.com.basis.prova.recurso;
>
> import br.com.basis.prova.dominio.dto.AlunoDTO;
> import br.com.basis.prova.dominio.dto.AlunoDetalhadoDTO;
> import br.com.basis.prova.servico.AlunoServico;
> import org.springframework.http.ResponseEntity;
> import org.springframework.web.bind.annotation.DeleteMapping;
> import org.springframework.web.bind.annotation.GetMapping;
> import org.springframework.web.bind.annotation.PathVariable;
> import org.springframework.web.bind.annotation.PostMapping;
> import org.springframework.web.bind.annotation.PutMapping;
> import org.springframework.web.bind.annotation.RequestBody;
> import org.springframework.web.bind.annotation.RequestMapping;
> import org.springframework.web.bind.annotation.RestController;
>
> import java.net.URI;
> import java.net.URISyntaxException;
> import java.util.List;
>
> @RestController
> @RequestMapping("/api/alunos")
> public class AlunoRecurso {
>
> private static final String API_ALUNOS = "/alunos";
>
> private final AlunoServico alunoServico;
>
> public AlunoRecurso(AlunoServico alunoServico) {
> this.alunoServico = alunoServico;
> }
>
> @PostMapping
> public ResponseEntity<AlunoDTO> salvar(@RequestBody AlunoDTO alunoDTO) throws URISyntaxException {
> AlunoDTO result = alunoServico.salvar(alunoDTO);
> return ResponseEntity.created(new URI(API_ALUNOS + result.getId())).body(result);
> }
>
> @PutMapping
> public ResponseEntity<AlunoDTO> editar(@RequestBody AlunoDTO alunoDTO) throws URISyntaxException {
> AlunoDTO result = alunoServico.salvar(alunoDTO);
> return ResponseEntity.ok(result);
> }
>
> @DeleteMapping("/{matricula}")
> public ResponseEntity<Void> excluir(@PathVariable("matricula") String matricula) {
> alunoServico.excluir(matricula);
> return ResponseEntity.status(200).build();
> }
>
> @GetMapping
> public ResponseEntity<List<AlunoDTO>> consultar() {
> return ResponseEntity.ok(alunoServico.consultar());
> }
>
> @GetMapping("/detalhes/{id}")
> public ResponseEntity<AlunoDetalhadoDTO> detalhar(@PathVariable("id") Integer id) {
> return ResponseEntity.ok(alunoServico.detalhar(id));
> }
>
> }
Coloquei os arquivos que eu acho que tem relação com o problema, se for nescessario mais eu posto. Desde já agradeço.