Ankit
Ankit

Reputation: 4644

How to define multiple packages as trusted package in yaml

I have a Spring boot application where I am consuming data from Kafka topics. For the Objects which I consume, I need to provide their package names as trusted packages.

eg.

spring:
   kafka:
     consumer:
        bootstrap-servers: localhost:9092
        group-id: group_id
        auto-offset-reset: earliest
        key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
        value-deserializer: org.springframework.kafka.support.serializer.JsonDeserializer
        properties:
          spring:
            json:
              trusted:
                packages: com.sample.cassandra

Now I have multiple packages which I need to define as trusted package.

For example I have com.sample.demo, but when I try something like this:

spring:
                json:
                  trusted:
                    packages: com.sample.cassandra, com.sample.demo

It doesn't work.

What would be the correct syntax to define multiple packages in the yaml file?

Upvotes: 1

Views: 1015

Answers (2)

Serdar
Serdar

Reputation: 412

In my case, I solved the problem as below

packages: "com.sample.cassandra, com.sample.demo"

Upvotes: 3

flyx
flyx

Reputation: 39738

The YAML syntax for sequences is

packages: [com.sample.cassandra, com.sample.demo]

You can alternatively use the block syntax:

packages:
  - com.sample.cassandra
  - com.sample.demo

Upvotes: 2

Related Questions