Java Spring FrameWork: Difference between revisions

From Objectif Client Inc
Jump to navigation Jump to search
Line 21: Line 21:


===Maven Setup===
===Maven Setup===
<pre>
<syntaxhighlight lang="xml">
<!-- General repository to get package -->   
<!-- General repository to get package -->   
<repositories>
<repositories>
Line 56: Line 56:
</dependencies>
</dependencies>


</pre>
</<syntaxhighlight>


==MVC Setup==  
==MVC Setup==  

Revision as of 19:04, 5 December 2014

Notes

Rest Architecture

REST (REpresentational State Transfer) New naming : HATEOAS (Hypermedia as the Engine of Application State)

  1. Client-serveur: Data remain on serveur and client is a separated entity
  2. No state: Each request provide to the server all the necessary information to provide the service
  3. Cache: The information sent by the server must contain, creation date, expiration date.
  4. Uniform Interface:
    1. Each resources has a unic Id;
    2. Resources have representation defined;
    3. Auto descriptive message: The content and how to read the message; (Like how the message is coded Utf8).
    4. Hypermedia Each access to the next step of the application is describe in the current message.
  5. Hyercharchie
  6. Code-on-Demande(facultative): Script excecution on the client retreived from the server.


| Stackoverflow what exactly is restful programming

Maven Setup

<syntaxhighlight lang="xml"> <repositories>

   <repository>
       <id>io.spring.repo.maven.release</id>
       <url>http://repo.spring.io/release/</url>
       <snapshots><enabled>false</enabled></snapshots>
   </repository>

</repositories>

<dependencyManagement>

   <dependencies>
       <dependency>
           <groupId>org.springframework</groupId>
           <artifactId>spring-framework-bom</artifactId>
           <version>4.1.2.RELEASE</version>
           <type>pom</type>
           <scope>import</scope>
       </dependency>
   </dependencies>

</dependencyManagement>

<dependencies>

   <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-context</artifactId>
   </dependency>
   <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-web</artifactId>
   </dependency>

</dependencies>

</<syntaxhighlight>

MVC Setup

  • In the web.xml specify the location of the Spring Configuration File
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:spring/business-config.xml, classpath:spring/tools-config.xml</param-value>
    </context-param>

OR

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath*:META-INF/spring/applicationContext*.xml</param-value>
    </context-param>