Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

Uso de Cache

Não consigo ter o retorno dos selects, quando implemento o uso de cachê, oque retorna no meu console é: 2020-09-10 13:17:15.556 INFO 11008 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' 2020-09-10 13:17:15.556 INFO 11008 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' 2020-09-10 13:17:15.574 INFO 11008 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 18 ms

ForumApplication

@SpringBootApplication
@EnableSpringDataWebSupport
@EnableCaching
public class ForumApplication {

    public static void main(String[] args) {
        SpringApplication.run(ForumApplication.class, args);
    }

Get do topicosController

@GetMapping
    @Cacheable(value ="listaDeTopicos")
    public Page<TopicoDto> lista(@RequestParam(required = false) String nomeCurso, 
            @PageableDefault(sort = "id", direction = Direction.DESC)Pageable paginacao) { //PageableDefault indica que se eu não colocar o parâmetro, o que está em () será o parametro padrão

        if (nomeCurso == null) {
            Page<Topico> topicos = topicoRepository.findAll(paginacao);
            return TopicoDto.converter(topicos);
        } else {
            Page<Topico> topicos = topicoRepository.findByCursoNome(nomeCurso, paginacao);
            return TopicoDto.converter(topicos);
        }
2 respostas

Properties:

# jpa
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.jpa.hibernate.ddl-auto=update
spring.jp.properties.hibernate.show_sql=true
spring.jp.properties.hibernate.format_sql=true
solução!

Oi Priscila,

O problema está nessas duas propriedades do arquivo application.properties:

spring.jp.properties.hibernate.show_sql=true
spring.jp.properties.hibernate.format_sql=true

Faltou a letra a no .jpa

Bons estudos!