{"id":599,"date":"2024-06-18T08:19:13","date_gmt":"2024-06-18T06:19:13","guid":{"rendered":"https:\/\/spgoo.org\/?page_id=599"},"modified":"2026-01-06T14:29:30","modified_gmt":"2026-01-06T13:29:30","slug":"web-service","status":"publish","type":"page","link":"https:\/\/spgoo.org\/?page_id=599","title":{"rendered":"Web Service Spring Boot"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Web Service sous Spring Boot  (08-2024)<\/h2>\n\n\n\n<link rel='stylesheet' id='4485-css'  href='https:\/\/spgoo.org\/wp-content\/uploads\/winp-css-js\/4485.css?ver=1747039442' type='text\/css' media='all' \/>\n\n\n\n<p>Langage : Java sous Spring Boot<\/p>\n\n\n\n<p>La partie Web service d\u00e9velopp\u00e9e dans les plateformes sert d&#8217;interm\u00e9diaire entre les frontaux et le ou les backends. Objectif est de mutualiser les fonctionnalit\u00e9s d\u00e9velopp\u00e9es, d&#8217;\u00e9viter d&#8217;avoir des liens trop importants antre les frontaux et le backend , de permettre des acc\u00e8s externes aux backends. <\/p>\n\n\n\n<p>Plusieurs vocations pour ces web services : <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>servir d&#8217;interm\u00e9diaire entre les frontaux et les backends de stockage de donn\u00e9es<\/li>\n\n\n\n<li>servir d&#8217;interm\u00e9diaire entre les frontaux et les moyens de calculs<\/li>\n\n\n\n<li>servir d&#8217;acc\u00e8s \u00e0 des plateformes ext\u00e9rieures avec Token.<\/li>\n<\/ul>\n\n\n\n<p class=\"has-vivid-cyan-blue-color has-text-color has-link-color has-medium-font-size wp-elements-c16ed59c37cdf1cf46e2107e89143622\">Illustrations par plateforme<\/p>\n\n\n\n<p><strong>Plateforme passy <\/strong>: dictionnaire phon\u00e9tique fran\u00e7ais et ses variations. Contexte <span class='tooltipsall tooltipsincontent classtoolTips3'>MongoDB<\/span>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    \/***\n     * Retourne que la liste des mots trouv\u00e9s selon le filtre sur la phon\u00e9tique \n     * {\"ilfo\":{\"phonetique\":\"^car\"}}\n     * @param body\n     * @return\n     *\/\n    @RequestMapping(value = \"\/phono\", method = POST)\n    public Map&lt;String, List&lt;atilf&gt;&gt; find_dico_phono(@RequestBody Map&lt;String, Map&lt;String, String&gt;&gt; body) {\n        Map&lt;String, List&lt;atilf&gt;&gt; liste_trouves = new HashMap&lt;&gt;();\n        Query query_ = new Query();\n        query_.addCriteria(Criteria.where(\"phonetique\").regex(body.get(\"ilfo\").get(\"phonetique\")));\n        liste_trouves.put(\"ilfo\", mongoTemplate.find(query_, atilf.class, \"lexique\"));\n        System.out.println(\"Extraction des mots demand\u00e9s\");\n        return liste_trouves;\n    }<\/code><\/pre>\n\n\n\n<p>Dans cet appel on passe par un mapping objet \u00e0 l&#8217;aide de la classe atilf.class <\/p>\n\n\n\n<p>package fr.ilfo.passy;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import java.io.Serializable;\nimport org.springframework.data.annotation.Id;\nimport com.fasterxml.jackson.annotation.JsonProperty;\n\npublic class atilf implements Serializable{\n    private static final long serialVersionUID = 1L;\n    @Id\n    private String _id;\n    @JsonProperty(\"id\")\n    private String id;\n    @JsonProperty(\"graphie\")\n    private String graphie;\n    @JsonProperty(\"categ\")\n    private String categ;\n    @JsonProperty(\"genre\")\n    private String genre;\n    @JsonProperty(\"phonetique\")\n    private String phonetique;\n}<\/code><\/pre>\n\n\n\n<p><strong>Plateforme EMOLGINE<\/strong> : Web service devant la base de donn\u00e9es CHEMBL  &#8212;  Contexte MYSQL <\/p>\n\n\n\n<p>(r\u00e9f : <a href=\"https:\/\/mkyong.com\/spring-boot\/spring-boot-spring-data-jpa-mysql-example\/\">https:\/\/mkyong.com\/spring-boot\/spring-boot-spring-data-jpa-mysql-example\/<\/a>) <\/p>\n\n\n\n<p>Objectif de ce web service est de servir d&#8217;interm\u00e9diaire pour la plateforme EMOLGINE et le site SPGoO avec la  base de donn\u00e9es de la Chembl. L&#8217;exp\u00e9rimentation au sein du site de SPGoO permet de mettre au point les fonctionnalit\u00e9s avec les utilisateurs avant leur int\u00e9gration dans EMOLGINE.<\/p>\n\n\n\n<p>Plusieurs \u00e9tapes pour la mise en place de ce web service :<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Constituer le projet Spring boot sous Eclipse <\/li>\n\n\n\n<li>Ajouter les packages n\u00e9cessaires<\/li>\n\n\n\n<li>D\u00e9velopper les \u00e9l\u00e9ments d&#8217;interrogation <\/li>\n<\/ul>\n\n\n\n<p>Configuration actuelle est une version 2.5.0 de Spring boot et la version 11 de java.<\/p>\n\n\n\n<details class=\"wp-block-details is-layout-flow wp-block-details-is-layout-flow\"><summary>Contenu du fichier pom.xml :<\/summary>\n<pre class=\"wp-block-code\"><code>&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\n&lt;project xmlns=\"http:\/\/maven.apache.org\/POM\/4.0.0\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\n\txsi:schemaLocation=\"http:\/\/maven.apache.org\/POM\/4.0.0 https:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd\"&gt;\n\t&lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\n\t&lt;parent&gt;\n\t\t&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\n\t\t&lt;artifactId&gt;spring-boot-starter-parent&lt;\/artifactId&gt;\n\t\t&lt;version&gt;2.5.0&lt;\/version&gt;\n\t\t&lt;relativePath\/&gt; &lt;!-- lookup parent from repository --&gt;\n\t&lt;\/parent&gt;\n\t&lt;groupId&gt;fr.spgoo&lt;\/groupId&gt;\n\t&lt;artifactId&gt;chembl&lt;\/artifactId&gt;\n\t&lt;version&gt;0.0.1-SNAPSHOT&lt;\/version&gt;\n\t&lt;name&gt;spgoo-chembl&lt;\/name&gt;\n\t&lt;description&gt;service d&amp;apos;exploration de cible&lt;\/description&gt;\n\t&lt;url\/&gt;\n\t&lt;licenses&gt;\n\t\t&lt;license\/&gt;\n\t&lt;\/licenses&gt;\n\t&lt;developers&gt;\n\t\t&lt;developer\/&gt;\n\t&lt;\/developers&gt;\n\t&lt;scm&gt;\n\t\t&lt;connection\/&gt;\n\t\t&lt;developerConnection\/&gt;\n\t\t&lt;tag\/&gt;\n\t\t&lt;url\/&gt;\n\t&lt;\/scm&gt;\n\t&lt;properties&gt;\n\t\t&lt;java.version&gt;11&lt;\/java.version&gt;\n\t&lt;\/properties&gt;\n\t&lt;dependencies&gt;\n\t\t&lt;dependency&gt;\n\t\t\t&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\n\t\t\t&lt;artifactId&gt;spring-boot-starter-jersey&lt;\/artifactId&gt;\n\t\t&lt;\/dependency&gt;\n\t\t&lt;dependency&gt;\n\t\t\t&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\n\t\t\t&lt;artifactId&gt;spring-boot-starter-web&lt;\/artifactId&gt;\n\t\t&lt;\/dependency&gt;\n\t\t&lt;dependency&gt;\n\t\t\t&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\n\t\t\t&lt;artifactId&gt;spring-boot-starter-web-services&lt;\/artifactId&gt;\n\t\t&lt;\/dependency&gt;\n                &lt;dependency&gt;\n                         &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\n                         &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;\/artifactId&gt;\n                &lt;\/dependency&gt;\t\n\t        &lt;dependency&gt;\n\t                 &lt;groupId&gt;mysql&lt;\/groupId&gt;\n\t                 &lt;artifactId&gt;mysql-connector-java&lt;\/artifactId&gt;\n\t\t         &lt;scope&gt;runtime&lt;\/scope&gt;\n\t        &lt;\/dependency&gt;\t\n\t        &lt;dependency&gt;\n\t                 &lt;groupId&gt;org.springframework.data&lt;\/groupId&gt;\n\t                 &lt;artifactId&gt;spring-data-jpa&lt;\/artifactId&gt;\n\t        &lt;\/dependency&gt;\n\t        &lt;dependency&gt;\n\t\t         &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\n\t\t         &lt;artifactId&gt;spring-boot-starter-test&lt;\/artifactId&gt;\n \t\t         &lt;scope&gt;test&lt;\/scope&gt;\n\t        &lt;\/dependency&gt;\t\n\t&lt;\/dependencies&gt;\n\n\t&lt;build&gt;\n\t\t&lt;plugins&gt;\n\t\t\t&lt;plugin&gt;\n\t\t\t\t&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\n\t\t\t\t&lt;artifactId&gt;spring-boot-maven-plugin&lt;\/artifactId&gt;\n\t\t\t&lt;\/plugin&gt;\n\t\t&lt;\/plugins&gt;\n\t&lt;\/build&gt;\n\n&lt;\/project&gt;\n\n\n<\/code><\/pre>\n\n\n\n<p><\/p>\n<\/details>\n\n\n\n<p>Structuration du projet avec un exemple sur la table compound_structures<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"164\" src=\"https:\/\/spgoo.org\/wp-content\/uploads\/2025\/02\/Capture-du-2025-02-26-10-25-31-1024x164.png\" alt=\"\" class=\"wp-image-5470\" srcset=\"https:\/\/spgoo.org\/wp-content\/uploads\/2025\/02\/Capture-du-2025-02-26-10-25-31-1024x164.png 1024w, https:\/\/spgoo.org\/wp-content\/uploads\/2025\/02\/Capture-du-2025-02-26-10-25-31-300x48.png 300w, https:\/\/spgoo.org\/wp-content\/uploads\/2025\/02\/Capture-du-2025-02-26-10-25-31-768x123.png 768w, https:\/\/spgoo.org\/wp-content\/uploads\/2025\/02\/Capture-du-2025-02-26-10-25-31.png 1158w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<details class=\"wp-block-details is-layout-flow wp-block-details-is-layout-flow\"><summary>Entity<\/summary>\n<pre class=\"wp-block-code\"><code>package fr.spgoo.chembl;\n\nimport javax.persistence.Column;\nimport javax.persistence.Entity;\nimport javax.persistence.Id;\n\n@Entity\npublic class Compound_structures {\n\t@Id\n\tprivate Long molregno;\n\tprivate String molfile;\n\t@Column(name = \"standard_inchi\", nullable = false)\n\tprivate String standardinchi;\n\t@Column(name = \"standard_inchi_key\", nullable = false)\n\tprivate String standardinchikey;\n\t@Column(name = \"canonical_smiles\", nullable = false)\n\tprivate String canonicalsmiles;\n\n\tpublic Compound_structures() {\n\n\t}\n\n\tpublic Long getMolregno() {\n\t\treturn molregno;\n\t}\n\n\tpublic void setMolregno(Long molregno) {\n\t\tthis.molregno = molregno;\n\t}\n\n\tpublic String getMolfile() {\n\t\treturn molfile;\n\t}\n\n\tpublic void setMolfile(String molfile) {\n\t\tthis.molfile = molfile;\n\t}\n\n\tpublic String getStandardinchikey() {\n\t\treturn standardinchikey;\n\t}\n\n\tpublic void setStandardinchikey(String standardinchikey) {\n\t\tthis.standardinchikey = standardinchikey;\n\t}\n\n\tpublic String getStandardinchi() {\n\t\treturn standardinchi;\n\t}\n\n\tpublic void setStandardinchi(String standardinchi) {\n\t\tthis.standardinchi = standardinchi;\n\t}\n\n\tpublic String getCanonicalsmiles() {\n\t\treturn canonicalsmiles;\n\t}\n\n\tpublic void setCanonicalsmiles(String canonicalsmiles) {\n\t\tthis.canonicalsmiles = canonicalsmiles;\n\t}\n\n}\n<\/code><\/pre>\n<\/details>\n\n\n\n<details class=\"wp-block-details is-layout-flow wp-block-details-is-layout-flow\"><summary>Interface<\/summary>\n<pre class=\"wp-block-code\"><code>package fr.spgoo.chembl;\n\nimport java.util.List;\n\nimport org.springframework.data.jpa.repository.JpaRepository;\nimport org.springframework.data.jpa.repository.Query;\nimport org.springframework.data.repository.query.Param;\n\npublic interface Repository_Compound_structures extends JpaRepository&lt;Compound_structures, Long&gt; { \n\tList&lt;Compound_structures&gt; findByMolregno(Long molregno);\n\t\n\tList&lt;Compound_structures&gt; findByStandardinchikey(String inchikey);\n\n}\n<\/code><\/pre>\n<\/details>\n\n\n\n<details class=\"wp-block-details is-layout-flow wp-block-details-is-layout-flow\"><summary>Service<\/summary>\n<pre class=\"wp-block-code\"><code>package fr.spgoo.chembl;\n\nimport java.util.List;\n\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.stereotype.Service;\n\n@Service \npublic class Serv_compound_structures {\n\n\t@Autowired\n    private Repository_Compound_structures Repository;\n\n    public List&lt;Compound_structures&gt; findByMolregno(Long inchikey) {\n        return Repository.findByMolregno(inchikey);\n    }\n    public List&lt;Compound_structures&gt; findByStandardinchikey(String inchikey) {\n        return Repository.findByStandardinchikey(inchikey);\n    }\n\t\n\t\n}<\/code><\/pre>\n<\/details>\n\n\n\n<details class=\"wp-block-details is-layout-flow wp-block-details-is-layout-flow\"><summary>DataController<\/summary>\n<pre class=\"wp-block-code\"><code>package fr.spgoo.chembl;\n\nimport java.util.List;\n\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.core.env.Environment;\nimport org.springframework.web.bind.annotation.CrossOrigin;\nimport org.springframework.web.bind.annotation.GetMapping;\nimport org.springframework.web.bind.annotation.PathVariable;\nimport org.springframework.web.bind.annotation.RequestMapping;\nimport org.springframework.web.bind.annotation.RestController;\n\n@CrossOrigin(\"*\")\n@RestController\n@RequestMapping(\"\/chembl\")\npublic class DataController {\n\t@Autowired\n    private Serv_compound_structures SRV_compound_structures;\n\t\n\t@GetMapping(\"\/find\/molregno\/{molregno}\")\n\tpublic List&lt;Compound_structures&gt; findByTitle(@PathVariable Long molregno) {\n\t      return SRV_compound_structures.findByMolregno(molregno);\n\t}\n\n\t@GetMapping(\"\/find\/inchikey\/{inchikey}\")\n\tpublic List&lt;Compound_structures&gt; findByStandardinchikey(@PathVariable String inchikey) {\n\t      return SRV_compound_structures.findByStandardinchikey(inchikey);\n\t}\n\t\n}\n<\/code><\/pre>\n<\/details>\n\n\n\n<p>Exemples d&#8217;appel et affichage des r\u00e9sultats : <\/p>\n\n\n\n<p>http:\/\/localhost:9999\/chembl\/find\/inchikey\/PSOPUAQFGCRDIP-UHFFFAOYSA-N<\/p>\n\n\n\n<details class=\"wp-block-details is-layout-flow wp-block-details-is-layout-flow\"><summary>R\u00e9sultats<\/summary>\n<pre class=\"wp-block-code\"><code>&#91;\n{\n\"molregno\": 4,\n\"molfile\": \"\\n     RDKit          2D\\n\\n 23 25  0  0  0  0  0  0  0  0999 V2000\\n    6.3417   -2.4250    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    6.8542   -2.7250    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0\\n    6.3417   -1.8250    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0\\n    7.3750   -2.4250    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0\\n    7.3750   -1.8250    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    6.8542   -1.5250    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    6.8500   -5.1167    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    6.8542   -3.3250    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    5.8167   -2.7167    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0\\n    6.8500   -4.5167    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    7.3667   -5.4167    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    6.8542   -0.9250    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0\\n    6.3292   -5.4167    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0\\n    7.3667   -3.6167    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    6.3292   -3.6167    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    6.3292   -4.2167    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    7.3667   -4.2167    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    7.3667   -6.0167    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    7.8792   -5.1167    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    8.4042   -5.4167    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    7.8875   -6.3167    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    8.4042   -6.0167    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    8.9250   -6.3167    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n  2  1  1  0\\n  3  1  1  0\\n  4  2  1  0\\n  5  6  1  0\\n  6  3  1  0\\n  7 10  1  0\\n  8  2  1  0\\n  9  1  2  0\\n 10 16  2  0\\n 11  7  1  0\\n 12  6  2  0\\n 13  7  2  0\\n 14  8  1  0\\n 15  8  2  0\\n 16 15  1  0\\n 17 14  2  0\\n 18 11  2  0\\n 19 11  1  0\\n 20 19  2  0\\n 21 18  1  0\\n 22 20  1  0\\n 23 22  1  0\\n  4  5  2  0\\n 10 17  1  0\\n 21 22  2  0\\nM  END\",\n\"standardinchi\": \"InChI=1S\/C17H13N3O3\/c1-11-2-4-12(5-3-11)16(22)13-6-8-14(9-7-13)20-17(23)19-15(21)10-18-20\/h2-10H,1H3,(H,19,21,23)\",\n\"standardinchikey\": \"PSOPUAQFGCRDIP-UHFFFAOYSA-N\",\n\"canonicalsmiles\": \"Cc1ccc(C(=O)c2ccc(-n3ncc(=O)&#91;nH]c3=O)cc2)cc1\"\n}\n]<\/code><\/pre>\n<\/details>\n\n\n\n<p>http:\/\/localhost:9999\/chembl\/find\/molregno\/1<\/p>\n\n\n\n<details class=\"wp-block-details is-layout-flow wp-block-details-is-layout-flow\"><summary>R\u00e9sultat<\/summary>\n<pre class=\"wp-block-code\"><code>&#91;\n{\n\"molregno\": 1,\n\"molfile\": \"\\n     RDKit          2D\\n\\n 24 26  0  0  0  0  0  0  0  0999 V2000\\n    5.2792   -2.0500    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    5.7917   -2.3500    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0\\n    5.2792   -1.4500    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0\\n    6.3125   -2.0500    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0\\n    5.7875   -4.7417    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    5.7875   -4.1417    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    6.3125   -1.4500    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    6.3042   -5.0417    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    5.7917   -1.1500    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    5.7917   -2.9500    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    5.2667   -3.8417    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    5.2667   -3.2417    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    6.3042   -3.8417    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    4.7542   -2.3417    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0\\n    6.3042   -5.6417    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    5.2667   -5.0417    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0\\n    6.3042   -3.2417    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    5.7917   -0.5500    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0\\n    5.7792   -5.9417    0.0000 Cl  0  0  0  0  0  0  0  0  0  0  0  0\\n    6.8167   -4.7417    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    4.7417   -4.1417    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    6.8250   -5.9417    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    7.3417   -5.0417    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n    7.3417   -5.6417    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\\n  2  1  1  0\\n  3  1  1  0\\n  4  2  1  0\\n  5  6  1  0\\n  6 13  1  0\\n  7  9  1  0\\n  8  5  1  0\\n  9  3  1  0\\n 10  2  1  0\\n 11 12  1  0\\n 12 10  2  0\\n 13 17  2  0\\n 14  1  2  0\\n 15  8  2  0\\n 16  5  2  0\\n 17 10  1  0\\n 18  9  2  0\\n 19 15  1  0\\n 20  8  1  0\\n 21 11  1  0\\n 22 15  1  0\\n 23 20  2  0\\n 24 23  1  0\\n  4  7  2  0\\n 11  6  2  0\\n 22 24  2  0\\nM  END\",\n\"standardinchi\": \"InChI=1S\/C17H12ClN3O3\/c1-10-8-11(21-17(24)20-15(22)9-19-21)6-7-12(10)16(23)13-4-2-3-5-14(13)18\/h2-9H,1H3,(H,20,22,24)\",\n\"standardinchikey\": \"OWRSAHYFSSNENM-UHFFFAOYSA-N\",\n\"canonicalsmiles\": \"Cc1cc(-n2ncc(=O)&#91;nH]c2=O)ccc1C(=O)c1ccccc1Cl\"\n}\n]<\/code><\/pre>\n<\/details>\n\n\n\n<p class=\"has-pale-cyan-blue-color has-text-color has-link-color has-medium-font-size wp-elements-104493f6e7a046bb52e40a1f8d6e5df6\">Retour d&#8217;exp\u00e9rience de cette mise en place : <\/p>\n\n\n\n<p>Quelques recommandations \u00e0 prendre en compte : attention aux noms d&#8217;attributs avec des caract\u00e8res sp\u00e9ciaux (_), dans ce cas il faut utiliser la directive column pour associer l&#8217;attribut de la table avec un nom de variable sans ces caract\u00e8res sp\u00e9ciaux. <\/p>\n\n\n\n<p>Vous aurez observer que dans le service il n&#8217;y a pas d&#8217;indication de requ\u00eate SQL correspondant \u00e0 l&#8217;extraction des donn\u00e9es de la base, on a juste indiquer l&#8217;instruction suivante: <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>List&lt;Compound_structures&gt; findByMolregno(Long molregno);<\/code><\/pre>\n\n\n\n<p>C&#8217;est la partie JPA qui prend en charge de fa\u00e7on implicite lors du chargement par l&#8217;Autowired de la r\u00e9solution correspondante. Dans cette exemple, l&#8217;ORM interpr\u00e8te le nom de la fonction Molregno comme une demande d\u2019extraction d&#8217;un attribut molregno d&#8217;une classe Compound_structures. Classe dans laquelle on doit retrouver l&#8217;attribut molregno de type Long. <\/p>\n\n\n\n<p>Prise en compte du NULL dans les attributs <\/p>\n\n\n\n<p>Dans la d\u00e9finition de la classe de l&#8217;Entity  faire attention aux types utilis\u00e9s . Ne pas utiliser les types de bases (Primitive types are not nullable)  qui n&#8217;acceptent pas  la valeur NULL lors de l&#8217;affectation il faut pr\u00e9f\u00e9rer les types &#8220;objet&#8221; String, Long, Integer &#8230;.. qui eux acceptent la valeur NULL. donc dans ce cas l&#8217;ORM est bien en mesure d&#8217;instancier un objet correctement. <\/p>\n<script type=\"text\/javascript\"> toolTips('.classtoolTips3','<a style=\"text-decoration: none;\" href=\"https:\/\/www.mongodb.com\/fr-fr\"><img style=\"width: 180px; height: 50px;\" src=\"\/wp-content\/uploads\/2025\/01\/mongodb-logo-rgb-scaled.jpg\" \/><\/a>'); <\/script>","protected":false},"excerpt":{"rendered":"<p>Web Service sous Spring Boot (08-2024) Langage : Java sous Spring Boot La partie Web service d\u00e9velopp\u00e9e dans les plateformes sert d&#8217;interm\u00e9diaire entre les frontaux et le ou les backends. Objectif est de mutualiser les fonctionnalit\u00e9s d\u00e9velopp\u00e9es, d&#8217;\u00e9viter d&#8217;avoir des liens trop importants antre les frontaux et le backend , de permettre des acc\u00e8s externes [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-599","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/spgoo.org\/index.php?rest_route=\/wp\/v2\/pages\/599","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/spgoo.org\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/spgoo.org\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/spgoo.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/spgoo.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=599"}],"version-history":[{"count":41,"href":"https:\/\/spgoo.org\/index.php?rest_route=\/wp\/v2\/pages\/599\/revisions"}],"predecessor-version":[{"id":11592,"href":"https:\/\/spgoo.org\/index.php?rest_route=\/wp\/v2\/pages\/599\/revisions\/11592"}],"wp:attachment":[{"href":"https:\/\/spgoo.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=599"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}