Spring Framework. Simple REST Service
From AsIsWiki
(Difference between revisions)
(Created page with "<div style='max-width:700px;text-align:justify;'> Spring Framework ==Simple REST Service== 1. Создаем Maven-проект в IntelliJ IDEA: <pre> File / New / Pr...") |
|||
Line 27: | Line 27: | ||
</pre> | </pre> | ||
− | + | Структура нового проекта: | |
[[File:SimpleRestService.png]] | [[File:SimpleRestService.png]] | ||
− | 3. | + | 2. В папку main добавляем папки: |
+ | |||
+ | main | ||
+ | webapp | ||
+ | WEB-INF | ||
+ | |||
+ | 3. В папку WEB-INF добавляем файл springConf-servlet.xml: | ||
+ | |||
+ | <source lang="xml"> | ||
+ | <?xml version="1.0" encoding="UTF-8"?> | ||
+ | <beans xmlns="http://www.springframework.org/schema/beans" | ||
+ | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
+ | xsi:schemaLocation=" | ||
+ | http://www.springframework.org/schema/beans | ||
+ | http://www.springframework.org/schema/beans/spring-beans.xsd"> | ||
+ | |||
+ | </beans> | ||
+ | </source> | ||
+ | |||
+ | 4. В файл pom.xml добавляем зависимость на spring-webmvc: | ||
Revision as of 11:43, 24 March 2016
Simple REST Service
1. Создаем Maven-проект в IntelliJ IDEA:
File / New / Project... Maven Project SDK: 1.8 [Next] GroupId: org.asistech.web.srs ArtifactId: SimpleRestService Version: 1.0 [Next] Project name: SimpleRestService Project location: ~/projects/web/SimpleRestService [Finish]
Структура нового проекта:
2. В папку main добавляем папки:
main webapp WEB-INF
3. В папку WEB-INF добавляем файл springConf-servlet.xml:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> </beans>
4. В файл pom.xml добавляем зависимость на spring-webmvc: