-
Notifications
You must be signed in to change notification settings - Fork 41k
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
Provide a mechanism to hide properties in the metadata #2421
Comments
We need a way to also disable keys that are set in code that we don't own. Some thoughts:
We could also add an "ignore" attribute to a property to make explicit that it should be ignored (in case of IDEs are trying to do smart things behind our back). In this case, we could ignore any property by simply registering with the ignore flag enabled; when we merge the additional meta-data with the current result, we override the flag. |
Since this is quite an edge-case I think a new annotation might be better. I'm worried that more attributes on Another option might be to try and extend the |
This has come up again in 3.4 when some changes in Oracle UCP have resulted in some new properties appearing in the metadata:
We don't need both 1 and 2. 3 doesn't make sense at all as it requires an instance of |
We discussed this today and we'd like to configure this in an external file (similar to |
I have the problem that a 'property' is shown, where I only have a getter method. My first thought was a field annotation like @ Transient for JPA. |
@brabenetz I was under the impression that with filter out properties that only have a setter unless they are collections or nested properties. This line of code should do that. Feel free to raise a new issue with a sample project that replicates the problem if you like and we can take a look. |
In https://github.com/mhalbritter/spring-boot/tree/mh/2421-provide-a-mechanism-to-hide-properties-in-the-metadata I've implemented the idea of using a separate file to specify the properties which should be ignored. This file is read by the The ignore file is called {
"properties": [
{
"name": "my.age"
}
]
} WDYT? |
I like it although I'm not totally sure about the use of a separate file. I wonder if it would be better to use the existing |
+1 for reusing the existing file. We can declare the additional field event if they don’t end up in the generated file. I wonder if that’s an extension of the deprecation support. If we ignore a property that’s because it’d have been picked up otherwise and we don’t want that. So having the IDE to know that it looks like a property but we don’t want to offer it is useful IMO. |
Thanks both. Let's talk in a meeting about this (maybe we recall the reason why we proposed a separate file in the first place), and if we decide to drop the additional file, i'll implement the solution with |
We discussed this again today and given #2421 (comment) we want to put the filter data inside the existing This should give us a situation where the metadata works well with existing IDEs, but there's no loss of information if they work directly with the class files and also need to know what to filter. |
I've updated the branch and it now looks like this: Given this class @ConfigurationProperties(prefix = "my")
public class MyProperties {
private String name;
private int age;
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return this.age;
}
public void setAge(int age) {
this.age = age;
}
} and this {
"properties": [
],
"ignored": {
"properties": [
{
"name": "my.age"
}
]
}
} the generated {
"groups": [
{
"name": "my",
"type": "org.example.sb2421.MyProperties",
"sourceType": "org.example.sb2421.MyProperties"
}
],
"properties": [
{
"name": "my.name",
"type": "java.lang.String",
"sourceType": "org.example.sb2421.MyProperties"
}
],
"hints": [],
"ignored": {
"properties": [
{
"name": "my.age"
}
]
}
}
|
#2027 adds support for configuring Bitronix and Atomikos' connection pools via the environment. These pools expose some properties that it doesn't make sense to expose to the environment such as
PoolDataSourceBean.failed
. We also want to hidePoolDataSource.className
as we configure that automatically to use ourDirectXADataSource
The text was updated successfully, but these errors were encountered: