Skip to content

Generic Editor - Spring YAML Properties does not provide completion for config files in Spring Cloud Config Server #516

@marcgemis

Description

@marcgemis

This issue is created after a question on Twitter: https://twitter.com/MarcGemis/status/1289086371936776193

The goal is to create a Spring Cloud Config server with yml-property files for microservices. At this moment the files reside inside the Config server. At a later moment, we might move them to a more production-worthy place.
By default, the "Generic Editor -Spring YAML Properties" is not enabled for yaml-files that are not named "application.yml" or "bootstrap.yml". Since the files have to be named .yml, one has to manually open those files in the desired editor. This works.

However, the editor does not provide any completion at all in the demo project I describe below. I thought it worked partially on the proof of concept I was developing. "Partially" meaning: " The editor provides completion for those libraries mentioned in the pom.xml of the Spring Cloud Config server, but not for any library mentioned in the pom.xml of the microservice.

The completion in the demo project below does work for the application.yml file of the Spring Cloud Config Server.

The application.yml

spring:
  application:
    name: config-server

server:
  port: 8888

The pom.xml (Sorry, I don't know how to properly format this file here)

<?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.3.2.RELEASE</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>
	<groupId>com.example</groupId>
	<artifactId>config-server</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<name>config-server</name>
	<description>Config Server from Spring Boot</description>

	<properties>
		<java.version>14</java.version>
		<spring-cloud.version>Hoxton.SR6</spring-cloud.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-config-server</artifactId>
		</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>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-configuration-processor</artifactId>
		</dependency>
	</dependencies>

	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.springframework.cloud</groupId>
				<artifactId>spring-cloud-dependencies</artifactId>
				<version>${spring-cloud.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
		</dependencies>
	</dependencyManagement>

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

</project>

I have tried to place the config file for a microservice under
src/main/java/configs/microservice.yml
and under src/main/resources/microserviceconfigs/microservicebis-default.yml

In neither of there cases, the completion (auto-suggest) seems to work.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions