Skip to content

Profile issues with Spring add-on #576

Open
@denis-anisimov

Description

@denis-anisimov

This PR allows to use Spring Profiles with Routes :#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 #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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    🔖 Normal Priority (P2)

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions