Spring Boot Starter library
The Spring Boot Starter library is the newest addition to the Service SDK. It allows you to include Service SDK functionality, out-of-the-box, into your Spring Boot project. Refer to the documentation for more information.
Spring Boot service Maven archetype
The set of Maven archetypes now includes the Spring Boot archetype. The new archetype is based on the Spring Boot Starter library. You can find more information in the Archetypes topic.
Servlet Support library
The Service SDK contains a new library, called the Servlet Support library. It is part of the aggregating libraries, so if you already have a dependency on them, this library is automatically available for you. So far, it contains the ExcludableServletFilterWrapper
which allows you to exclude paths from getting mapped to an existing Servlet Filter. You can, for example, prevent the Basic Authentication Filter from securing certain endpoints. Use this functionality carefully and responsibly.
JSON Merge Patch support
The new patch version of the Service SDK adds support for the JSON Merge Patch RFC 7386.
Support for the JSON Merge Patch in the Service Generator
This feature allows you to use the recommended Merge Patch flavor for partial updates in your API as described in JSON Merge Patch RFC 7386, as shown in this example:
@PATCH
@Consumes({ PatchMediaType.APPLICATION_MERGE_PATCH_JSON, MediaType.APPLICATION_JSON }) // application/merge-patch+json
public MyType patch(MergeDto mergeDtoType);
This method accepts application/merge-patch+json and application/json content containing the partial update entity.
More flexible Service Generator
You can now enable specific template types only when generating a service with the Service Generator.
The available template types include:
DTO
: data transfer objectsRESOURCE
: Jersey resource interfacesRESOURCE_IMPL
: Jersey resource default implementationsTEST
: abstract test class for Jersey testsTEST_IMPL
: default test implementationsFILE
: static files, including applicationContext.xml and package-info.java files
For example, to just generate code for DTOs, resource interfaces, and default resource implementations, add these lines to the POM:
<configuration>
<outputTypes>
<outputType>DTO</outputType>
<outputType>RESOURCE</outputType>
<outputType>RESOURCE_IMPL</outputType>
</outputTypes>
</configuration>
By default, overwriting of generated sources by the Service Generator is disabled. To force overwriting of existing source files, add this configuration to your POM:
<configuration>
<forceOverwrite>true</forceOverwrite>
</configuration>
You can configure overwriting for specific output types only. For example, to only overwrite DTOs, add this configuration:
<configuration>
<forceOverwrite>true</forceOverwrite>
<outputTypes>
<outputType>DTO</outputType>
</outputTypes>
</configuration>
For details, see Service Generation.
Dockerfile added to artifacts created by Service SDK archetypes
Service SDK archetypes now create a customized Docker file at the same time as they generate artifacts. Use the Dockerfile to create a Docker build image which contains your service. Run it locally, or publish and deploy it.
To build an image with the Docker CLI-tool, execute the following command in the project root directory:
docker build -t ${artifactId} .
To run the Docker CLI-tool locally, execute the following command:
docker run -it --rm -p 8080:8080 ${artifactId}
Improved archetypes
Customize generated code with the provided Service Generator configuration in the archetypes. The default configuration now includes:
<configuration>
<outputFolderMainGenerated>src/main/java</outputFolderMainGenerated>
</configuration>
That value forces DTO and resource interface generation into the src/main/java folder instead of the default target folder.
The build no longer integrates service generation by default. To generate the Jersey code for the endpoints, run the following:
mvn servicegenerator:generate-service
Improved generated code quality
To disable field name prefixes, which do not follow Java naming conventions, add this configuration for Service Generator to pom.xml:
<configuration>
<outputFieldPrefixEnabled>false</outputFieldPrefixEnabled>
</configuration>
Generate code into different subpackages
To keep your code clean and organized, use Service Generator DTOs, and resource and test implementations, to generate into separate subpackages. Set the outputSubpackageNameDto, outputSubpackageNameImpl, and outputSubpackageNameParam configuration properties.
For details, see Service Generation.
Sample Cloud Foundry memory settings in archetypes
The manifest files created by the archetypes now contain sample memory configuration settings. These sample memory configuration settings are used by Cloud Foundry when you deploy your service. Developers can adjust the settings to match amount of memory that their application needs. Find more information about the available settings in OpenJDK JRE Memory. To help diagnose and resolve memory issues, see Troubleshoot Out of Memory.
Integrated API Console Redirect filter clickjacking protection
The API Console now has built-in protection to prevent clickjacking attacks using the X-Frame-Options
HTTP response header, which indicates whether a browser can render a page in a frame, iframe, or object.
For example, if you use the Spring Framework to define and map the API Console redirect filter, you can disallow rendering of the page in a frame by using the following property:
API_CONSOLE_X_FRAME_OPTIONS_DIRECTIVE=DENY
For details, see API Console Integrated clickjacking protection.
Maven dependency updated
The Spring dependency is now updated to the 4.3.5.RELEASE version, which corrects a reported vulnerability. Please check your Maven dependency tree and update the version to mitigate the issue.
Downgrade of the Hystrix version in the Super POM
Previously, the Hystrix dashboard did not work with the newer version of Hystrix. To resolve this issue, and to match the current version of the Jackson library, the version of Hystrix provided in the Service SDK Super POM is now downgraded from 1.5.8 to 1.5.3.
Resolved issues
An issue in the Service Generator might have caused invalid class names for DTOs generated for nested anonymous schemas. This issue is now resolved.
If you find any information that is unclear or incorrect, please let us know so that we can improve the Dev Portal content.
Use our private help channel. Receive updates over email and contact our specialists directly.
If you need more information about this topic, visit hybris Experts to post your own question and interact with our community and experts.