Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Aplicação não retorna nada - HttpMediaTypeNotAcceptableException: Could not find acceptable representation

Pessoal por favor me ajudem, já tentei de tudo que falaram aqui no tutorial e na net e nada funciona, nem mesmo baixando o projeto do instrutor!!!

There was an unexpected error (type=Not Acceptable, status=406).
Could not find acceptable representation
org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation
    at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:315)

No console:

Hibernate: select pedido0_.id as id1_0_, pedido0_.data_entrega as data_ent2_0_, pedido0_.descricao as descrica3_0_, pedido0_.nome_produto as nome_pro4_0_, pedido0_.status as status5_0_, pedido0_.url_imagem as url_imag6_0_, pedido0_.url_produto as url_prod7_0_, pedido0_.user_username as user_use9_0_, pedido0_.valor_negociado as valor_ne8_0_ from pedido pedido0_ where pedido0_.status=? order by pedido0_.data_entrega desc limit ?
2022-05-05 22:12:31.546  WARN 17060 --- [nio-8092-exec-6] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation]
@RestController
@RequestMapping("/api/pedidos")
public class PedidosRest {

  @Autowired
  private PedidoRepository pedidoRepository;

  @GetMapping("aguardando")
  public List<Pedido> getPedidosAguardandoOfertas(){
    Sort sort = Sort.by("id").descending();
    PageRequest page = PageRequest.of(0, 5, sort);

    return pedidoRepository.findByStatus(StatusPedido.AGUARDANDO, page);
  }

}
@SpringBootApplication
@EnableCaching
public class MudiApplication {

    public static void main(String[] args) {
        SpringApplication.run(MudiApplication.class, args);
    }
server.port = 8091
spring.datasource.url=jdbc:mysql://localhost:3306/loja_mudi?useTimezone=true&serverTimezone=UTC

spring.datasource.username=root
spring.datasource.password=local

spring.datasource.testWhileIdle=true
spring.datasource.validationQuery=SELECT 1

spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

spring.jpa.properties.hibernate.show_sql=true
spring.jpa.properties.hibernate.format-sql=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImproveNamingStrategy
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.13</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>

    <groupId>br.com.loja.mvc</groupId>
    <artifactId>mudi</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>mudi</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>

        <dependency>
            <groupId>org.thymeleaf.extras</groupId>
            <artifactId>thymeleaf-extras-springsecurity5</artifactId>
        </dependency>


        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>
1 resposta
solução!

Creio que era alguma biblioteca, tive que apagar a pasta .m2 e depois instalar novamente o projeto do instrutor, o meu realmente não resolveu.