e-Spirit / firstspirit-module-gradle-plugin

Apache License 2.0
0 stars 0 forks source link

Question: UrlCreator #3

Closed frequiheiko closed 2 months ago

frequiheiko commented 2 months ago

Hi,

how would I annotate a custom UrlCreator? To get something like:

        <public>
            <name>MyUrlCreator</name>
            <class>de.espirit.firstspirit.generate.UrlCreatorSpecification</class>
            <configuration>
                <LegacyClass>de.my.urlservice.creator.MyUrlCreator</LegacyClass>
                <UseRegistry>no</UseRegistry>
            </configuration>
        </public>

Is it possible?

Thanks, Heiko

frequiheiko commented 2 months ago

Played around a bit:

@UrlFactoryComponent(name = "MyUrlCreator", useRegistry = false, parameters = {
        @Parameter(name = "LegacyClass", value = "de.my.urlservice.creator.MyUrlCreator") })

I end up with:

        <public>
            <name>MyUrlCreator</name>
            <displayname/>
            <description/>
            <class>de.espirit.firstspirit.generate.UrlCreatorSpecification</class>
            <configuration>
                <UrlFactory>de.my.urlservice.creator.MyUrlCreator</UrlFactory>
                <UseRegistry>false</UseRegistry>
                <LegacyClass>de.my.urlservice.creator.MyUrlCreator</LegacyClass>
            </configuration>
        </public>

I guess "UrlFactory" breaks it?

windmueller commented 2 months ago

I guess "UrlFactory" breaks it?

What do you mean by that? Is the generated configuration not working?

frequiheiko commented 2 months ago

Without testing it I was confused by:

<UrlFactory>de.my.urlservice.creator.MyUrlCreator</UrlFactory>
<LegacyClass>de.my.urlservice.creator.MyUrlCreator</LegacyClass>

Now I tested and the old UrlCreator seems to work. Unfortunately we cannot use the newer approach UrlFactory because we want to access the generation task variables.

frequiheiko commented 2 months ago

I tested it now in the correct environment and it works even with both set: UrlFactory and LegacyClass.