vaadin / vaadin/spring

Profile issues with Spring add-on

Open
#576 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Impact: Low Severity: Minor
Dominant language
Java
Stars
186
Forks
98
PR merge metrics
No merged PRs in 30d

Description

This PR allows to use Spring Profiles with Routes :https://github.com/vaadin/spring/pull/575

But it works ONLY with Spring boot: because we are using a special way to find all classes annotated with @Route via ClassPathScanningCandidateComponentProvider .
The ClassPathScanningCandidateComponentProvider instance filter out annotated classes annotated with Profile whose profiles are not active.

But in Spring MVC case e.g. ClassPathScanningCandidateComponentProvider is never used.
Also ClassPathScanningCandidateComponentProvider won't be used if the application works as a war.
It means that Profiles won't be respected at runtime : classes are scanned using standard Servlet 3.0 specification.

So in not Spring boot case ANY route will be enabled even if its profile is not enabled.
( so https://github.com/vaadin/spring/pull/575 just allows to use routes which are annotated with profile).
To be able to support profiles we need changes in SpringInstantiator class: it's method getOrCreate should take into account that classes may be disabled via profile.
At the moment SpringInstantiator will make an instance regardless of its profile.

Contributor guide

No contributing guide indexed for this repository

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

Start with SpringInstantiator.getOrCreate, then compare it with the ClassPathScanningCandidateComponentProvider path described in the issue. Verify how Spring MVC and WAR deployments discover route classes, and confirm that routes disabled by Spring profiles are not instantiated at runtime.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.