Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

discussion of name and location of default property file #31

Open
hendrikebbers opened this issue Dec 1, 2017 · 26 comments
Open

discussion of name and location of default property file #31

hendrikebbers opened this issue Dec 1, 2017 · 26 comments

Comments

@hendrikebbers
Copy link
Contributor

Based on #26 I had a look at the spec and saw that we currently define the default config properties file as META-INF/javaconfig.properties. Actually I'm not really happy with the name and the place. I think that the META-INF folder is a valid option but would prefer to add support for a properties file in the root folder (conflicts can be handled by ordinal). Next to this I ask myself if javaconfig.properties as a name really makes sense? Why not using something like application.properties (as spring does)?

@struberg
Copy link
Contributor

struberg commented Dec 1, 2017

I'm rather -1 as this would mean we would accidentally pick up spring config files which have different semantics than we do.
META-INF is also perfectly fine imo.

If one wants to pick them up he can simply define an own ConfigSource for it anyway

@hendrikebbers
Copy link
Contributor Author

hendrikebbers commented Dec 1, 2017 via email

@sdaschner
Copy link
Contributor

I also prefer application.properties over javaconfig.properties TBH. I would argue you are configuring the application, not the JavaConfig functionality :-) I also don't think that it is a problem to put in into the root classpath folder. I mean it's the goal of this JSR to become the single point of configuration that accesses properties files.

@lilian-benoit
Copy link

I prefer using META-INF. Here is a extract from guide jar :

The following files/directories in the META-INF directory are recognized and interpreted by the Java 2 Platform to configure applications, extensions, class loaders and services

For application.properties, i am fear that confusion with spring config
We can use a generic term from javaconfig.properties to configuration.properties.

@jeyvison
Copy link

jeyvison commented Dec 4, 2017

+1 to load files from root. META-INF is a valid location but we can consider these two locations as a hierarchy structure for properties

+1 to application.properties or configuration properties although i would prefer application.properties. Is there any problem if we load the Spring properties?

@Emily-Jiang
Copy link
Member

-1 to pick up from root. You can write your own config source to parse this file. The default one on the classpath which means META-INF for jar, WEB-INF\classes\META-INF for war. It is nice and clean. Also it is very similar to CDI's beans.xml location.

@struberg
Copy link
Contributor

struberg commented Dec 5, 2017

ack to what Emily writes. Also -1 to pick up from root. Basically all EE config files are located in META-INF/ or WEB-INF/

Btw, we explicitly left out WEB-INF/javaconfig.properties btw. Don't want to repeat the merge nonsense we had to do in CDI.

Also ack to not using application.properties as this would create a big mess with Spring.

@Emily-Jiang
Copy link
Member

@sdaschner suggests to change the file name javaConfig.propertie to application.properties. The properties can be loaded by either Spring or JavaEE config impl. I think it is a good idea.

@keilw
Copy link
Contributor

keilw commented Dec 7, 2017

If the Spring folks are not offended, why not, but doing a bit with Spring Boot and different types of clouds myself, the concept of profiles would probably exceed this JSR, so a multi-profile Spring configuration or overrides just won't be picked up correctly?

@lilian-benoit
Copy link

Sorry @sdaschner @Emily-Jiang , but name change is not sufficient. Spring loads property file in root folder (doc)
Personnaly, i prefer META-INF location. It's common on Java EE config file.

We must decide if we support spring model or not.
In ConfigJSR, we are concept of priority. It's very interessing. I agree with @struberg if we mix our approach and spring model, its big mess.

A implementation can define an specific PropertySource that he use Spring model

@keilw concept of profile an another issue #26

@sdaschner
Copy link
Contributor

sdaschner commented Dec 8, 2017

I'm not passionate about the location, the META-INF / WEB-INF combination sounds reasonable to me. However I just argue that application.properties is a very good choice for what this file is supposed to do.

I also don't see the collision with Spring -- even if that file were in the root folder. These are just two different technologies loading the same properties file -- if developers for some reason would like to choose between technology A loading configuration or technology B, that doesn't collide. They could even use both at the same time...

Having that said, the discussion whether we use the properties location together with a ProjectStage / profile is also another discussion. This one is just a name :-)

@Ravisankar-Challa
Copy link

+1 to pick up from root

@keilw
Copy link
Contributor

keilw commented Dec 8, 2017

If it was WEB-INF, too then for an EAR it had to be APP-INF as well.
I know we spoke about possible stages or other variations (including the "tennant ID" Oracle and Java EE had in mind earlier) in at least one call.

@struberg
Copy link
Contributor

yes, good point about APP-INF.

But as written above I tried to avoid all that by explicitly only targeting classpath entries. So no WEB-INF or APP-INF at all. Just add your config into a jar or WEB-INF/classes/META-INF/javaconfig.properties

PS: yes I basically like the name application.properties, but I really fear it will become a mess because Spring uses it already. So I prefer to stick with META-INF/javaconfig.properties.

One can add custom ConfigSources for any other name anyway!

@lilian-benoit
Copy link

APP-INF is bad because that's do reference at EAR. Several container don't support this type of module. (ex: tomcat)

META-INF is more neutral. It's valid for classic JAR (META-INF), WAR (WEB-INF/classes/META-INF) and EAR (_META-INF)

@struberg
Copy link
Contributor

Tallying this now:
So far we seem to have a clear preference for sticking the information to META-INF/xxxx and not into the root of each jar.

There is still a discussion about the actual file name.
We now have the following candidates

  • javaconfig.properties
  • javaxconfig.properties
  • application.properties
  • configuration.properties
  • config.properties

@struberg
Copy link
Contributor

The name we decide on will also impact #7

@keilw
Copy link
Contributor

keilw commented Jan 25, 2018

application.properties would be compatible with Spring Boot, so I would use that at least as one of the options. Should we just pick one or multiple we prefer?

@jeyvison
Copy link

jeyvison commented Jan 29, 2018

Agree with @keilw about application.properties. It's clear and direct. About pick multiple files, i think we should focus in only one and if the developer wants others he/she can create a configSource.

@struberg
Copy link
Contributor

@jeyvison @keilw While application.properties is the same file name as spring, it's content is totally different. Spring has some nested syntax while we basically have old-style property files.
That means we would accidentally pick up files which are not intended for us. And then we would likely crash...
And the same is true for the other way around.
That's why I recommend against using application.properties.

@jeyvison
Copy link

jeyvison commented Feb 15, 2018

@struberg

Spring has some nested syntax while we basically have old-style property files

That's true about YAML files(What spring can read by default) but i don't know if it happens for plain property files. Would you have an example ?

When you say nested, you say something like this?

spring.datasource.driverClassName=com.mysql.jdbc.Driver

@jmesnil
Copy link
Contributor

jmesnil commented Feb 15, 2018

I vote for javaxconfig.properties.

It unambiguously specifies that this properties file is about javax.config.

application.properties, configuration.properties or config.properties are generic, non-descriptive names that could conflict with other libraries or implementations.

@TFaga
Copy link

TFaga commented Feb 22, 2018

I'm more leaning towards configuration.properties or config,properties.

In my mind when looking from afar, javaxconfig.properties or javaconfig.properties look like something that is used to configure Java itself and not the application/service/tool.

jeanouii pushed a commit to jeanouii/ConfigJSR that referenced this issue Mar 8, 2018
@Emily-Jiang
Copy link
Member

Let's discuss more and vote. @sdaschner will set up a vote.

@keilw
Copy link
Contributor

keilw commented Apr 24, 2019

+1 for configuration.properties or config.properties.

The whole ticket are a thing from the past, by the time this spec might be finished it won't be allowed to use javax.config any more. I'm not sure what is available outside the Spec Committee before we finish the resolution for the namespace, but I can share as much as "javax" will only be allowed for Jakarta EE 8 and after that for a "legacy" mode or profile with unchanged Java EE 8/Jakarta EE 8 specs. Neither of them is applicable for JSR 382, so "javax.config" is out of the question. Unless we're discussing the "SE only" option @aalmiray proposed?

javaconfig.properties is equally wrong, because neither "java" nor "javax" should be used from now on in active (Jakarta EE) specs.
Besides application.properties would also work, in fact that could even be of use for a Java SE only variant of this JSR should that be the way everyone wants to go and forget about Jakarta EE, which would of course be a shame, but minus CDI support JSR 382 could in theory continue in the JCP while something else maybe based on MicroProfile Config might graduate to Jakarta EE at some point.

@keilw
Copy link
Contributor

keilw commented Apr 25, 2019

If the meetings change is it possible to update Google Calendar next time?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants