{"id":24649115,"url":"https://github.com/ow2-proactive/yamt","last_synced_at":"2025-08-02T11:06:12.870Z","repository":{"id":146325456,"uuid":"57893815","full_name":"ow2-proactive/yamt","owner":"ow2-proactive","description":"Simple skeleton to ease development of new microservices ","archived":false,"fork":false,"pushed_at":"2022-09-12T09:48:33.000Z","size":156,"stargazers_count":2,"open_issues_count":0,"forks_count":5,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-05-13T12:56:29.608Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ow2-proactive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-05-02T13:53:40.000Z","updated_at":"2023-02-13T09:23:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"e0abe2a4-5aa1-4fe3-b915-6dacc28101f9","html_url":"https://github.com/ow2-proactive/yamt","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/ow2-proactive/yamt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ow2-proactive%2Fyamt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ow2-proactive%2Fyamt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ow2-proactive%2Fyamt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ow2-proactive%2Fyamt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ow2-proactive","download_url":"https://codeload.github.com/ow2-proactive/yamt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ow2-proactive%2Fyamt/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268378623,"owners_count":24240895,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-25T17:15:48.610Z","updated_at":"2025-08-02T11:06:12.862Z","avatar_url":"https://github.com/ow2-proactive.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **yamt** (yet another microservice template)\nRestful microservice template from ProActive\n\n## Purpose\n\nThe purpose of the microservice template is to have common template for new microservice's implementation.\n\n## Build Badges\n\nTo insert a build-badge like this one:\n[![Build Status](http://jenkins.activeeon.com/buildStatus/icon?job=scheduling)](http://jenkins.activeeon.com/job/scheduling/)\n\nWe need to use the following code after creating the associated job on Jenkins:\n```\n[![Build Status](http://jenkins.activeeon.com/buildStatus/icon?job=\u003cinsert microservice job name\u003e)](http://jenkins.activeeon.com/job/\u003cinsert microservice job name\u003e/)\n```\n\nSame goes for the coveralls-badge:\n```\n[![Coverage Status](https://coveralls.io/repos/github/ow2-proactive/microservice-template/badge.svg?branch=origin%2Fmaster)](https://coveralls.io/github/ow2-proactive/microservice-template?branch=origin%2Fmaster)\n```\n\n## Specific modifications\nThe following modifications are needed before starting to work on the micro-service:\n* In the **gradle.properties** modify the version, projectName, packageLastPartName (the last part in package name).\u003cbr\u003e\n   The version should correspond to current release snaphot. This version will be used for downloading the specific version of libraries for dependency management.\n* In the **src/main/resources/log4j2.xml** change the log file name from 'micro-service.log'\n* In the **src/main/webapp/WEB-INF/applicationContext.xml** specify the correct package name in base-package (change the microservice_template name to the packageLastPartName already specified in properties)\n* In the main/java modify the **package name** to your need.\nThese changes will impact at the springBoot section in build.gradle file. By default the Application.java from this package will start on bootRun.\n\n## Prepare your IDE\nIn the project is used Lombok library. It is needed to install plugin to be able to use it.\nIn the IntelliJ IDEA to be able to see Lombok generated code, you should enable the annotation preprocessor. [See documentation here.](https://www.jetbrains.com/help/idea/2016.1/configuring-annotation-processing.html) (Settings-\u003eBuild-\u003eCompiler-\u003eAnnotation Processors: Enable annotation preprocessing)\n\n## Building and running the micro-service\n\nYou can start a microservice as a standalone application:\n```\n$ gradlew clean build bootRun\n```\n\nYou can build a WAR file as follows:\n\n```\n$ gradlew clean build war\n```\n\nThen, you can directly deploy the service with embedded Tomcat:\n\n```\n$ java -jar build/libs/microservice-template-X.Y.Z-SNAPSHOT.war\n```\n\nThe WAR file produced by Gradle can also be deployed in the embedded Jetty container started by an instance of [ProActive Server](https://github.com/ow2-proactive/scheduling).\n\nSometimes the gradle processes are not killing properly when you stop the running application. If you receive the message \"the port is already in use\" on starting microservice, then kill all suspending gradle processes for previous task. You can do it manually or use in IntelliJ IDEA Gradle killer plugin.\n\n## Example\nThe template is organized with a complete RESTful example. The example follows MVC packaging structure and covered by tests.\nThe purpose of example to make more easy developing of new service.\nTo try it out use Swagger or (http://localhost:8080/users).\u003cbr\u003e\n\n## Swagger\n\nAvailable resources can be listed and tested with Swagger. The associated code is in the **Application.java** file:\nModify the name of microservice-template in title, description, licenseUrl, groupName sections. Put right allowedPaths.\u003cbr\u003e\nTo access Swagger API:\n\n[http://localhost:8080/swagger-ui.html](http://localhost:8080/swagger-ui.html)\n\n## DB configuration\n\n#### Dependencies\nAdd next dependencies to **build.gradle** file\n```\ncompile 'org.springframework.boot:spring-boot-starter-data-jpa:1.3.3.RELEASE'\nprovidedRuntime 'org.hsqldb:hsqldb:2.3.3'\n```\n\nIn the **src/main/resources/application.properties** add configurations specific to your project:\n```\nlogging.level.org.hibernate.SQL=off\n# Hibernate ddl auto (create, create-drop, update)\nspring.jpa.hibernate.ddl-auto=update\n# Show or not log for each sql query\nspring.jpa.show-sql=false\n```\n#### Configuration class\nFor using DB configuration include next class to your project.\nOf course change 'microservice-template' name to proper one.\n\n```\n@Configuration\npublic class DBConfiguration {\n\n    @Value(\"${spring.datasource.driverClassName:org.hsqldb.jdbc.JDBCDriver}\")\n    private String dataSourceDriverClassName;\n\n    @Value(\"${spring.datasource.url:}\")\n    private String dataSourceUrl;\n\n    @Value(\"${spring.datasource.username:root}\")\n    private String dataSourceUsername;\n\n    @Value(\"${spring.datasource.password:}\")\n    private String dataSourcePassword;\n\n    @Bean\n    @Profile(\"default\")\n    public DataSource defaultDataSource() {\n        String jdbcUrl = dataSourceUrl;\n\n        if (jdbcUrl.isEmpty()) {\n            jdbcUrl = \"jdbc:hsqldb:file:\" + getDatabaseDirectory()\n                    + \";create=true;hsqldb.tx=mvcc;hsqldb.applog=1;hsqldb.sqllog=0;hsqldb.write_delay=false\";\n        }\n\n        return DataSourceBuilder\n                .create()\n                .username(dataSourceUsername)\n                .password(dataSourcePassword)\n                .url(jdbcUrl)\n                .driverClassName(dataSourceDriverClassName)\n                .build();\n    }\n\n    @Bean\n    @Profile(\"mem\")\n    public DataSource memDataSource() {\n        return createMemDataSource();\n    }\n\n    @Bean\n    @Profile(\"test\")\n    public DataSource testDataSource() {\n        return createMemDataSource();\n    }\n\n    private DataSource createMemDataSource() {\n        EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();\n        EmbeddedDatabase db = builder\n                .setType(EmbeddedDatabaseType.HSQL)\n                .build();\n        return db;\n    }\n\n    private String getDatabaseDirectory() {\n        String proactiveHome = System.getProperty(\"proactive.home\");\n\n        if (proactiveHome == null) {\n            return System.getProperty(\"java.io.tmpdir\") + File.separator\n                    + \"proactive\" + File.separator + \"microservice-template\";\n        }\n\n        return proactiveHome + File.separator + \"data\"\n                + File.separator + \"db\" + File.separator + \"microservice-template\";\n    }\n}\n```\n\nIn application.properties add next information with correct values for your project\n\n```\n# DataSource settings: set here your own configurations for the database connection.\nspring.datasource.driverClassName=org.hsqldb.jdbc.JDBCDriver\nspring.datasource.url=jdbc:hsqldb:file:/tmp/proactive/microservice-template;create=true;hsqldb.tx=mvcc;hsqldb.applog=1;hsqldb.sqllog=0;hsqldb.write_delay=false\nspring.datasource.username=root\nspring.datasource.password=\n```\n\n## Testing\n\nIn order to follow the best testing practises it is included testing part of Spring components with Mockito.\u003cbr\u003e\nFor integration test it is provided code in SpringUserRestTest class. For testing REST methods is used RestTemplate from spring framework.\u003cbr\u003e\nYou can also use Rest Assured library, that is already included in list of imported libraries in the gradle file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fow2-proactive%2Fyamt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fow2-proactive%2Fyamt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fow2-proactive%2Fyamt/lists"}