5

I am trying to create an embedded config server in spring boot 2.1.6 version. The start-up fails saying:


***************************
APPLICATION FAILED TO START
***************************

Description:

Invalid config server configuration.

Action:

If you are using the git profile, you need to set a Git URI in your configuration.  If you are using a native profile and have spring.cloud.config.server.bootstrap=true, you need to use a composite configuration.

I am not sure spring clearly documents what native profile is, whereas my bootstrap.yml looks like:

---
spring:
  application:
    name : <name>
  datasource:
    url: <url>
    driver-class-name: oracle.jdbc.OracleDriver
    username: <username>
    password: <password>
    hikari:
      maximum-pool-size: 1
      connection-timeout: 5000
  cloud:
    config:
      server:
        bootstrap: true
        default-label: latest
        jdbc:
          sql: <sql>
          order: 0
  jpa:
    database: Oracle
    show-sql: true
    properties:
      hibernate:
        dialect: org.hibernate.dialect.Oracle10gDialect
  profiles:
    active:
    - jdbc
    - sit

If I add 'native' in the list of active profile the error goes away.
But I am unable to find spring documentation which says,any config server other than git is by default 'native'.
Is this new addition in spring 2.x.x release because I simply upgraded from 1.5.10 version and the system broke.

So my question is:
Is this native profile mandatory from spring 2.x.x release thus making it backward in-compatible or there is a work around via which I can skip adding this native profile in my list of active profiles.
Reference :
https://cloud.spring.io/spring-cloud-config/2.1.x/multi/multi_spring-cloud-config.html

2 Answers2

1

I faced the same issue after using JDBC backed config server.

My issue was with the pom, I was using wrong jdbc dependency.

Instead of :

<dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</artifactId>
</dependency>

Use spring starter jdbc :

<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
Rex
  • 83
  • 8
0

Not sure if I remember is correctly but I think this question was aimed when database backed config server configuration is used.
Solution:
inside src/main/resources, create a folder meta-inf & add a file spring.factories. Inside this file add below code:

org.springframework.cloud.bootstrap.BootstrapConfiguration=\
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,\
org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration

Pls let me know if this works