java.lang.Object
io.jstach.opt.spring.SpringJStachioExtension
- All Implemented Interfaces:
JStachioExtension
,JStachioExtensionProvider
JStachio services based on Spring notably the
config
and
template finding
.- Author:
- agentgt
- API Note
- Although this is an extension it is not designed to be loaded by the
ServiceLoader
.
-
Constructor Summary
ConstructorDescriptionSpringJStachioExtension
(org.springframework.core.env.Environment environment, List<Template<?>> templates) Constructor for injection -
Method Summary
Modifier and TypeMethodDescriptionProvide a config or not.Provide a template finder or not.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.jstach.jstachio.spi.JStachioExtensionProvider
init, provideFilter
-
Constructor Details
-
SpringJStachioExtension
public SpringJStachioExtension(org.springframework.core.env.Environment environment, List<Template<?>> templates) Constructor for injection- Parameters:
environment
- springs environment to be used forJStachioConfig
templates
- templates found via spring
-
-
Method Details
-
provideConfig
Provide a config or not. The final config is a composite of all the found configs.Specifically if multiple instances of
JStachioExtension
are found that return a nonnull they will be combined by looping through all of them to find a nonnull value forJStachioConfig.getProperty(String)
. If no configs are provided or no services foundJStachioExtensions
instance will use the default config which usesSystem.getProperties()
. The config comes from SpringEnvironment
abstraction.- Specified by:
provideConfig
in interfaceJStachioExtensionProvider
- Returns:
- config if this service provides one or
null
-
provideTemplateFinder
Provide a template finder or not. The final template finder is a composite of all the other ones found. SeeJStachioTemplateFinder.order()
for ordering details.If no template finders are provided then the default template finder that uses reflection and the ServiceLoader is used. The provided template finder instead of using reflection delegates to the templates wired in via spring.
- Specified by:
provideTemplateFinder
in interfaceJStachioExtensionProvider
- Returns:
- template finder or not
-