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

Resource bundles defined in multiple modules are not merged #26712

Closed
LingCai2001 opened this issue May 30, 2021 · 9 comments
Closed

Resource bundles defined in multiple modules are not merged #26712

LingCai2001 opened this issue May 30, 2021 · 9 comments
Labels
status: declined A suggestion or change that we don't feel we should currently apply

Comments

@LingCai2001
Copy link

I found a problem loading the internationalized resource file. When I need to load international resource files in multiple jar packages, org.springframework.boot.autoconfiguration.context.MessageSourceAutoConfiguration, which is automatically assembled by springboot, can't be loaded for me. I think it's an error because of module reuse in development; What do you say?
Remarks:
SpringBootVersion: 2.5.0

@LingCai2001
Copy link
Author

I hope the government can fix the problem and release a new version of SpringBoot as soon as possible. Thank you.

@snicoll
Copy link
Member

snicoll commented May 30, 2021

@LingCai2001 sorry but I am not sure I understood the problem you're describing. Can you please share a small sample that we can run ourselves (no screenshot or code in text please)? You can do so by attaching a zip to this issue or sharing a link to a GitHub repo. Thank you!

@snicoll snicoll added status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged labels May 30, 2021
@LingCai2001

This comment has been minimized.

@LingCai2001
Copy link
Author

BugTest.zip
@snicoll For detailed bug recurrence, please refer to the description tag of Maven's parent pom.xml. Thank you!

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Jun 1, 2021
@snicoll
Copy link
Member

snicoll commented Jun 1, 2021

@LingCai2001 thanks for the feedback and the samples. I understand what you're trying to do now.

The reference documentation states that:

Spring Boot looks for the presence of a messages resource bundle at the root of the classpath.

There's no such thing as merging multiple resource bundle files in the classpath. If you remove the resource bundle in your a module and restart you'll notice that http://localhost:8080/b works now, but http://localhost:8080/a does not. We can't really offer that feature: in your case the keys in the files were disjoint but what happens if we have the same key in more than one file?

Having said all of that, I was a bit surprised that it wasn't more prominent in the documentation. @jhoeller, what do you think? Have I missed something?

@snicoll snicoll added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Jun 1, 2021
@snicoll snicoll changed the title I found a problem about loading internationalized resource files. Resource bundles defined in multiple modules are not merged Jun 1, 2021
@LingCai2001
Copy link
Author

@snicoll Thank you. I see what you mean; My suggestion is that you can extend one more class to merge resource packages in multiple projects.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Jun 1, 2021
@LingCai2001

This comment has been minimized.

@snicoll snicoll added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Jun 1, 2021
@spring-projects-issues
Copy link
Collaborator

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

@snicoll
Copy link
Member

snicoll commented Jun 8, 2021

@jhoeller and I discussed and we have no intention of supporting the use case you've described as we're delegating to ResourceBundle for this. We agree that making it a bit more explicit in the doc is a good idea so I've opened spring-projects/spring-framework#27038.

@snicoll snicoll closed this as completed Jun 8, 2021
@snicoll snicoll added status: declined A suggestion or change that we don't feel we should currently apply and removed status: feedback-reminder We've sent a reminder that we need additional information before we can continue status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged labels Jun 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

No branches or pull requests

3 participants