Make it easy to use
Convention over configuration
Package common shared configuration in library
When we are using spring to build (common enterprise) library that will be used by other teams, it's better that we include common shared configuration- using @Configuration class or XML and all other needed stuff in the library.
The client just need import the configuration class and add needed properties file.
It would be great if we also include basic property files such as thelib_common.properties, and client can provide custom property file such as thelib_overwrite.properties to overwrite it.
So all client need to do is just import the configuration class and add properties file if needed.
@Import({TheLibAppConfig.class})
Build client library - so client can only import necessary libs
When build a service that is going to be called by other teams, provide a client library that only includes classes, libs that are going to be used by client.
Usually client only need some model classes to build request and parse response,
Some times, we found that we have to use xxService-common library, which includes too many classes, 3-rd libs that client is not used at all.
Check what libs imported
Build Sample Client Application to demo how to use it
Build sample application to demonstrate how client should call the service, check the built application whether it includes unneeded dependencies.
Split functions into multiple small libraries instead of Big Library
Evolve the Library
Convention over configuration
Package common shared configuration in library
When we are using spring to build (common enterprise) library that will be used by other teams, it's better that we include common shared configuration- using @Configuration class or XML and all other needed stuff in the library.
The client just need import the configuration class and add needed properties file.
It would be great if we also include basic property files such as thelib_common.properties, and client can provide custom property file such as thelib_overwrite.properties to overwrite it.
So all client need to do is just import the configuration class and add properties file if needed.
@Import({TheLibAppConfig.class})
Build client library - so client can only import necessary libs
When build a service that is going to be called by other teams, provide a client library that only includes classes, libs that are going to be used by client.
Usually client only need some model classes to build request and parse response,
Some times, we found that we have to use xxService-common library, which includes too many classes, 3-rd libs that client is not used at all.
Check what libs imported
Remove unneeded dependencies
Build Sample Client Application to demo how to use it
Build sample application to demonstrate how client should call the service, check the built application whether it includes unneeded dependencies.
Split functions into multiple small libraries instead of Big Library
Don't declare same dependencies multiple times
For example: if the commons module import XX lib, the service module imports common, then don't import XX-lib again in service module.
-- To use newer framework: from codehaus.jackson to fastxml.jackson, jersey 1 to jersey 2, old spring to newer spring.
Don't constrain client teams choices because they use your library.