spring-projects / spring-projects/spring-tools

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

Open
#516 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

theme: property-editing-support type: enhancement
Dominant language
Java
Stars
983
Forks
240
Avg merge
7d 1h
Merged PRs (30d)
7

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue using the cited microservice.yml and microservicebis-default.yml paths, then compare their completion behavior with application.yml in the Spring Cloud Config Server example. Trace how the Generic Editor - Spring YAML Properties identifies eligible files and how dependencies from each pom.xml are discovered; done means completion works for the microservice configuration files too.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.