A small project using Spring Boot which provides operations on User.
- Internalization(Supports US and French- Created 2 properties file{messages_fr.properties, messages.properties})
- Basic Spring Authentication (Dependency commented in POM).
- Rest API versioning using v1(custom), headers versioning, params versioning.
- It uses H2 (In-memory database,which uses data.sql file to create new users), to open H2 UI console http://localhost:9001/h2-console : Use this URL Make sure: jdbc:url in UI is referring to : jdbc:h2:mem:testdb
- It uses HATEOAS to create links of other URI.
- It uses Spring ResponseEntityExceptionHandler class to provide custom Exception Handling.
- It uses javax.validation.Valid annotations to validate the RequestBody coming in POST method.
- It uses Swagger to document Rest API (http://localhost:9000/swagger-ui.html) Port can be change, please check application.properties: Change the port where your tomcat is listening.
- It Provides response in Json/xml format and accepts the requestBody in both format, to accept/showing responses in XML we have used com.fasterxml.jackson.dataformat dependency.
- It uses filtering feature using jackson annotations(It means which fields does user wants to see).
- It creates executable jar with the help of dependency in pom(Project Object Model) spring-boot-maven-plugin.
- It uses externalizable configuration by using "custom_configuration.properties". Currently supports ".properties file" but the same functinality can be done for yaml or yml(yet another markup language) files.
- This app is using Spring Rest WebServices.
- Using DevTools to reload the changes without manually restarting the application.
- Spring Security Basic In-Memory authentication.
- Included dependency for HAL Browser(JSON Hypertext Application Language, or HAL) URL: To open HAL browser with actuator: http://localhost:9008/browser/index.html#/actuator
To open only HAL Browser http://localhost:9008/browser/index.html#
To open any rest url with HAL Browser http://localhost:9008/browser/index.html#/users
- Added: How to do external configuration for yml/yaml file (not application.yml) and injecting values using Spring Environment and @Value annotation.
- Removed: External configuration for other properties file as it was very easy and there example are available on internet.
- To run the above app, use below command from cmd prompt. mvn run spring-boot:run
- To run the executable jar, open the directory where the jar is created. java -jar spring-microservices-0.0.1-SNAPSHOT.jar
-
The Tomcat connector configured to listen on port 9000 failed to start. The port may already be in use or the connector may be misconfigured. Solution: If application fail to start, either change the server port in application.properties or java -jar spring-microservices-0.0.1-SNAPSHOT.jar --server.port=8083 or java -jar -Dserver.port=8083 spring-microservices-0.0.1-SNAPSHOT.jar
-
If Spring Security is uncommented in POM. User username: user and password: It will be displayed in Console. Use these username and password and set these into Authorization column by selecting Authorization as "Basic"
-
Implemented Spring Security In-memory basic authentication, please see: BasicAuthenticationHandler.java If sending request from PostMan, use Basic-Auth under Authorization tab and then set the user and password as given in above file