-
Notifications
You must be signed in to change notification settings - Fork 827
JAV-99 Multi microservice configuration #33
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
Conversation
2.spring boot springmvc can not run
1.can read multiple microservice.yaml from classpath 2.collection microservice definition data 3.do not make change to dynamic data.
convert config to micoservice definition
1. avoid start spring context 2. delete file after UT.
1. avoid start spring context 2. delete file after UT.
…/java-chassis into multi-microservice-configuration
|
||
sort(); | ||
} catch (IOException e) { | ||
throw new RuntimeException("Failed to load microservice config.", e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we shall use custom exception instead of runtime exception
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only happened when startup
just stop the start process, it's no problem.
if (configModelList.isEmpty()) { | ||
LOGGER.warn("No URLs will be polled as dynamic configuration sources."); | ||
LOGGER.info("To enable URLs as dynamic configuration sources, define System property " | ||
+ ADDITIONAL_CONFIG_URL + " or make " + configFileFromClasspath |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string concat in logger message is not preferred, please use LOGGER.info("some message from {}", someOne);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only happened when startup.
someone copy from com.netflix.config.sources.URLConfigurationSource.URLConfigurationSource() months ago.
change to {} or not, both no problem.
} | ||
|
||
// only for unittest | ||
public class YAMLConfigurationSource extends MicroserviceConfigurationSource { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if only for unit test, why not move to src/test/ ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
io.servicecomb.foundation.ssl.SSLOptionTest
used this class too.
i don't want to copy this to another project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can build test-jar to other modules...
for (ConfigModel configModel : loader.getConfigModelList()) { | ||
sb.append(configModel.getUrl()).append(","); | ||
} | ||
Assert.assertEquals("jar:j2,jar:j3,jar:j4,jar:j1,file:f2,file:f3,file:f4,file:f1,", sb.toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
collect models into a list and assertThat(list, contains("jar:j2", "jar:j3")
is more readable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is for sort result, it's must equal, not contains
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contains checks for exact match of elements...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contains is indexOf
public boolean matches(Object actual) {
return actual != null && ((String) actual).contains(substring);
}
public boolean contains(CharSequence s) {
return indexOf(s.toString()) > -1;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not this one, what i talked about is contains or containsInAnyOrder from hamcrest lib
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe.
but i feel that, my code is clear more.
The PR was merged into master, so we can close it. |
No description provided.