Неизвестное свойство для зависимостей Джексона и источника данных в конфигурации sprinboot - PullRequest
0 голосов
/ 31 марта 2020

В файле конфигурации application.yml есть ошибки, которые я не могу устранить. Мне нужна ваша помощь .. Я пытался изменить зависимости в pom. xml, но это не работает.

Вот код, в котором у меня есть ошибки:

spring:
  jackson:
    mapper:
      DEFAULT_VIEW_INCLUSION: true 
    serialization: 
      indent_output: true        # 'indent_output' is an unknown 'com.fasterxml.jackson.databind.SerializationFeature
      WRITE_DATES_AS_TIMESTAMPS: false
    deserialization:
      FAIL_ON_IGNORED_PROPERTIES: false
      FAIL_ON_UNKNOWN_PROPERTIES: false
      ACCEPT_SINGLE_VALUE_AS_ARRAY: true
    default-property-inclusion: non_empty  # 'non_empty' is an unknown 'com.fasterxml.jackson.annotation.JsonIncludes$Include


  datasource:
    url: jdbc:postgresql://localhost:5432/testdb
    username: postgres
    password: password
    cachePrepStmts: true             #Unknown property 'spring.datasource.cachePrepStmts'
    prepStmtCacheSize: 250           #Unknown property 'spring.datasource.prepStmtCacheSize'
    prepStmtCacheSqlLimit: 2048     #Unknown property 'spring.datasource.prepStmtCacheSqlLimit'
    useServerPrepStmts: true        #U nknown property 'spring.datasource.useServerPrepStmts

вот мой пом. xml:

<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>springboot-jwt-sample</name>
    <description>JWT authentication for REST APIs</description>

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

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>

    <dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    </dependency>


        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</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-aop</artifactId>
        </dependency>

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

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

<!--         <dependency> -->
<!--             <groupId>io.jsonwebtoken</groupId> -->
<!--             <artifactId>jjwt</artifactId> -->
<!--             <version>0.8.0</version> -->
<!--         </dependency> -->

            <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt</artifactId>
            <version>0.9.0</version>
        </dependency>



        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>json-path</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

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


</project>

и вот мой полный aplication.yml:

server:
  port: 8080

spring:
  jackson:
    mapper:
      DEFAULT_VIEW_INCLUSION: true 
    serialization: 
      indent_output: true        # 'indent_output' is an unknown 'com.fasterxml.jackson.databind.SerializationFeature
      WRITE_DATES_AS_TIMESTAMPS: false
    deserialization:
      FAIL_ON_IGNORED_PROPERTIES: false
      FAIL_ON_UNKNOWN_PROPERTIES: false
      ACCEPT_SINGLE_VALUE_AS_ARRAY: true
    default-property-inclusion: non_empty  # 'non_empty' is an unknown 'com.fasterxml.jackson.annotation.JsonIncludes$Include


  datasource:
    url: jdbc:postgresql://localhost:5432/testdb
    username: postgres
    password: password
    cachePrepStmts: true             #Unknown property 'spring.datasource.cachePrepStmts'
    prepStmtCacheSize: 250           #Unknown property 'spring.datasource.prepStmtCacheSize'
    prepStmtCacheSqlLimit: 2048     #Unknown property 'spring.datasource.prepStmtCacheSqlLimit'
    useServerPrepStmts: true        #U nknown property 'spring.datasource.useServerPrepStmts



  jpa:
    openInView: false
    show_sql: true
    generate-ddl: true
    hibernate:
      ddl-auto: create-drop
    properties:
      hibernate.jdbc.lob.non_contextual_creation: true

  data:
    jpa:
      repositories.enabled: true

logging:
  level:
    org.springframework.web: INFO
    org.springframework.security: DEBUG
    com.example: DEBUG
  file: app.log
...