{"id":261202,"date":"2015-07-11T21:58:02","date_gmt":"2015-07-11T17:58:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=261202"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=261202","title":{"rendered":"Quickstart \u0433\u0430\u0439\u0434 \u043f\u043e Spring + Java EE + Persistence, \u0431\u0435\u0437 XML"},"content":{"rendered":"<p>     \t\u041f\u0440\u0438\u0432\u0435\u0442, \u0445\u0430\u0431\u0440\u0430\u0445\u0430\u0431\u0440!<\/p>\n<p>  \u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0442\u0443\u0442 \u0443\u0436\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0433\u0430\u0439\u0434\u043e\u0432 \u043f\u043e \u0442\u0430\u043a\u043e\u0439 \u0441\u0432\u044f\u0437\u043a\u0435, \u043d\u043e \u043e\u043d\u0438 \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u0432\u043e-\u043f\u0435\u0440\u0432\u044b\u0445 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u0435, \u0432\u043e \u0432\u0442\u043e\u0440\u044b\u0445 \u2014 \u044f \u0441\u0447\u0438\u0442\u0430\u044e \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0433\u0430\u0439\u0434 \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043e\u0441\u044f\u0437\u0430\u0435\u043c\u043e\u0435 \u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0435, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0447\u0442\u043e \u0438 \u0442\u0430\u043a\u043e\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \ud83d\ude42<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c Spring MVC \u0441\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435\u043c \u0432 \u0431\u0430\u0437\u0435 \u0438 0(\u043d\u0443\u043b\u0435\u043c) \u0444\u0430\u0439\u043b\u043e\u0432 xml-\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439, \u043f\u0440\u043e\u0448\u0443 \u043f\u043e\u0434 \u043a\u0430\u0442!<\/p>\n<p>  <a name=\"habracut\"><\/a><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435<\/b><\/p>\n<div class=\"spoiler_text\">\n<h3><a href=\"#1\">1. \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a \u0437\u0430\u043f\u0443\u0441\u043a\u0443<\/a><\/h3>\n<p>  <\/p>\n<h4><a href=\"#11\">1.1 IDE<\/a><\/h4>\n<p>  <\/p>\n<h4><a href=\"#12\">1.2 \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0430\u043f\u043e\u043a<\/a><\/h4>\n<p>  <\/p>\n<h4><a href=\"#13\">1.3 Gradle &#038; Git<\/a><\/h4>\n<p>  <\/p>\n<h5><a href=\"#131\">1.3.1 \u0414\u043b\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445<\/a><\/h5>\n<p>  <\/p>\n<h4><a href=\"#14\">1.4 \u0411\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/a><\/h4>\n<p>  <\/p>\n<h3><a href=\"#2\">2. \u041d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u043a\u043e\u0434\u0438\u0442\u044c<\/a><\/h3>\n<p>  <\/p>\n<h4><a href=\"#21\">2.1 \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/a><\/h4>\n<p>  <\/p>\n<h4><a href=\"#22\">2.2 \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u043a\u043e\u0434<\/a><\/h4>\n<p>  <\/p>\n<h4><a href=\"#23\">2.3 \u041a\u043e\u043d\u0442\u0435\u043d\u0442<\/a><\/h4>\n<p>  <\/p>\n<h3><a href=\"#3\">3. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0411\u0414<\/a><\/h3>\n<p>  <\/p>\n<h4><a href=\"#31\">3.1 \u0421\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u00abUser\u00bb<\/a><\/h4>\n<p>  <\/p>\n<h4><a href=\"#32\">3.2 \u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 UsersRepository<\/a><\/h4>\n<p>  <\/p>\n<h4><a href=\"#33\">3.3 \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0432\u044f\u0437\u0438 \u043c\u0435\u0436\u0434\u0443 \u044e\u0437\u0435\u0440\u043e\u043c \u0438 Spring Security<\/a><\/h4>\n<p>  <\/p>\n<h3><a href=\"#4\">4. \u041a \u0447\u0435\u043c\u0443 \u043c\u044b \u043f\u0440\u0438\u0448\u043b\u0438<\/a><\/h3>\n<p>  <\/p>\n<h4><a href=\"#41\">4.1 \u0414\u043b\u044f \u0436\u0435\u043b\u0430\u044e\u0449\u0438\u0445 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442<\/a><\/h4>\n<p>  <\/div>\n<\/div>\n<p>  \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0441\u0440\u0430\u0437\u0443 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c\u0441\u044f.<\/p>\n<h3><a name=\"1\"><\/a>1. \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a \u0437\u0430\u043f\u0443\u0441\u043a\u0443<\/h3>\n<h4><a name=\"11\"><\/a>1.1 IDE<\/h4>\n<p>  \u0412\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u0435\u0441\u0442\u0438\u0441\u044c \u043d\u0430 Intellij IDEA, \u043d\u043e \u043d\u0435 \u0434\u0443\u043c\u0430\u044e \u0447\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 IDE \u0431\u0443\u0434\u0435\u0442 \u0441\u0438\u043b\u044c\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435.<\/p>\n<h4><a name=\"12\"><\/a>1.2 \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0430\u043f\u043e\u043a<\/h4>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0430\u043f\u043a\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043d\u0430\u0437\u043e\u0432\u0435\u043c \u0435\u0435 ForHabrahabr<br \/>  \u0414\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432 \u043a\u043e\u0440\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e \u043f\u0430\u043f\u043e\u043a:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/0a2\/b80\/e80\/0a2b80e80883e0e394fe350e0ac1ca21.png\" alt=\"directories tree\"\/><br \/>  (\u043c\u043e\u0436\u043d\u043e \u0436\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435)<\/p>\n<h4><a name=\"13\"><\/a>1.3 Gradle &#038; Git<\/h4>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0414\u043b\u044f \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u044b\u0445<\/b><\/p>\n<div class=\"spoiler_text\">\u0418\u0442\u0430\u043a, \u043a\u0430\u0440\u043a\u0430\u0441 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438. <br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043d\u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u0432\u0435\u0440\u0441\u0438\u0439 \u0438 \u0441\u0431\u043e\u0440\u0449\u0438\u043a.<br \/>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 ForHabrahabr \u0434\u043e\u0431\u0430\u0432\u0438\u043c .gitignore \u0441 \u0432\u043e\u0442 \u0442\u0430\u043a\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435\u043c<br \/>  .idea<br \/>  *.iml<br \/>  build\/<\/p>\n<p>  \u0417\u0430\u0445\u043e\u0434\u0438\u043c \u0432 \u044d\u0442\u0443 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0438 \u043f\u0438\u0448\u0435\u043c   <\/p>\n<pre> git init <\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c bulid.gradle \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u043c\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043c \u043f\u0440\u0438\u0433\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">build.gradle<\/b><\/p>\n<div class=\"spoiler_text\">buildscript {<br \/>   repositories {<br \/>   mavenCentral()<br \/>   }<br \/>   dependencies {<br \/>   classpath(\u00aborg.springframework.boot:spring-boot-gradle-plugin:1.2.5.RELEASE\u00bb)<\/p>\n<p>  classpath &#8216;mysql:mysql-connector-java:5.1.34&#8217;<br \/>   }<br \/>  }<\/p>\n<p>  apply plugin: &#8216;java&#8217;<br \/>  apply plugin: &#8216;eclipse&#8217;<br \/>  apply plugin: &#8216;idea&#8217;<br \/>  apply plugin: &#8216;spring-boot&#8217;<\/p>\n<p>  jar {<br \/>   baseName = &#8216;gs-rest-service&#8217;<br \/>   version = &#8216;0.1.0&#8217;<br \/>  }<\/p>\n<p>  repositories {<br \/>   mavenCentral()<br \/>  }<\/p>\n<p>  sourceCompatibility = 1.8<br \/>  targetCompatibility = 1.8<\/p>\n<p>  dependencies {<br \/>   compile(\u00aborg.springframework.boot:spring-boot-starter-web\u00bb)<br \/>   compile(\u00aborg.springframework.boot:spring-boot-starter-data-jpa\u00bb)<br \/>   compile(\u00aborg.springframework.boot:spring-boot-starter-security\u00bb)<br \/>   compile(\u00aborg.springframework.boot:spring-boot-starter-thymeleaf\u00bb)<br \/>   compile &#8216;mysql:mysql-connector-java:5.1.31&#8217;<br \/>   compile &#8216;commons-dbcp:commons-dbcp:1.4&#8217;<br \/>   testCompile(\u00aborg.springframework:spring-test\u00bb)<br \/>   testCompile(\u00abjunit:junit\u00bb)<br \/>   testCompile &#8216;org.springframework.security:spring-security-test:4.0.1.RELEASE&#8217;<br \/>  }<\/p>\n<p>  task wrapper(type: Wrapper) {<br \/>   gradleVersion = &#8216;2.3&#8217;<br \/>  }  <\/div>\n<\/div>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043a\u0435 \u0432 \u0442\u043e\u0439 \u0436\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0433\u0434\u0435 build.gradle \u043f\u0438\u0448\u0435\u043c   <\/p>\n<pre> gradle wrapper .\/gradlew build     (\u0438\u043b\u0438 \u0434\u043b\u044f windows .\/gradlew.bat build)  <\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0432\u0430\u0442\u044c gradlew.bat\/gradlew \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u041e\u0421.<\/p>\n<h5><a name=\"131\"><\/a>1.3.1 \u0414\u043b\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445<\/h5>\n<ul>\n<li> \u0417\u0430\u0445\u043e\u0434\u0438\u0442\u0435 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0432 \u043f\u0430\u043f\u043a\u0443 \u0433\u0434\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432\u0430\u0448\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u044b Idea<\/li>\n<li> git clone <a href=\"https:\/\/github.com\/MaxPovver\/ForHabrahabr.git\">github.com\/MaxPovver\/ForHabrahabr.git<\/a><\/li>\n<li> git cd ForHabrahabr\/<\/li>\n<li> git checkout quikstart<\/li>\n<li> \u0412\u0441\u0435, \u0442\u0435\u043f\u0435\u0440\u044c \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \ud83d\ude42<\/li>\n<\/ul>\n<h4><a name=\"14\"><\/a>1.4 \u0411\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0411\u0414 \u0432\u044b\u0431\u0435\u0440\u0435\u043c MySQL \u043a\u0430\u043a \u0441\u0430\u043c\u0443\u044e \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0434\u043b\u044f quickstart. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0435\u0435 \u043d\u0430 localhost, <br \/>  \u0432 \u043d\u0435\u0439 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0431\u0430\u0437\u0443 forhabrahabr, \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0432 \u043d\u0435\u0439 \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0447\u043a\u0438 <br \/>  users<br \/>  roles<br \/>  users_roles<br \/>  posts<br \/>  likes<br \/>  \u041d\u043e \u043e\u0431 \u044d\u0442\u043e\u043c \u043f\u043e\u0437\u0436\u0435, \u043f\u043e\u043a\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0411\u0414.<\/p>\n<h3><a name=\"2\"><\/a>2. \u041d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u043a\u043e\u0434\u0438\u0442\u044c<\/h3>\n<h4><a name=\"21\"><\/a>2.1 \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h4>\n<p>  \u0418\u0442\u0430\u043a, \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0442\u043a\u0440\u043e\u0435\u043c \u043d\u0430\u0448 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 Intellj IDEA, \u043e\u043d\u0430 \u0443\u0432\u0438\u0434\u0438\u0442 Gradle \u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e:<br \/>  (Welcome to ItelliJ IDEA -&gt; Open -&gt; ForHabrahabr)<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/efb\/712\/365\/efb712365acd3f1cc400772ed23d48e6.png\" alt=\"image\"\/><br \/>  \u0412 \u044d\u0442\u043e\u043c \u043e\u043a\u043e\u0448\u043a\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0436\u043c\u0435\u0442\u0435 \u043e\u043a, \u0435\u0441\u043b\u0438 \u0435\u0433\u043e \u043d\u0435\u0442(\u0438\u043b\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 Gradle JVM) \u2014 \u043f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043b\u0441, \u0431\u0443\u0434\u0443 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0447\u0442\u043e \u043d\u0435 \u0442\u0430\u043a.<\/p>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/cb2\/763\/086\/cb2763086721e79a87d0ba34e7a308a1.png\" alt=\"image\"\/><\/p>\n<h4><a name=\"22\"><\/a>2.2 \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u043a\u043e\u0434<\/h4>\n<p>  \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0430\u043a\u0435\u0442 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u043d\u0430\u0437\u043e\u0432\u0435\u043c \u0435\u0433\u043e habraspring(\u043e\u0431\u044b\u0447\u043d\u0430\u044f \u043f\u0430\u043f\u043a\u0430 \u0432 src\/main\/java\/), \u0430 \u0432 \u043d\u0435\u043c \u2014 \u043f\u0435\u0440\u0432\u044b\u0439 <br \/>  \u043a\u043b\u0430\u0441\u0441 Application  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u043a\u043b\u0430\u0441\u0441\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">package habraspring;  import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; import org.springframework.data.jpa.repository.config.EnableJpaRepositories;  @SpringBootApplication @ComponentScan @EnableJpaRepositories(basePackages = {&quot;habraspring&quot;}) public class Application {     public static void main(String[] args) {         SpringApplication.run(Application.class, args);     } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041d\u043e \u0432 \u0442\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435 \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0435\u0449\u0435 \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0441\u044f, \u043d\u0430\u0434\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0430\u0432\u0442\u043e\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0442\u043e\u0440\u0443 \u0433\u0434\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0444\u0430\u0439\u043b \u0432 \u043f\u0430\u043f\u043a\u0443 resources\/ \u0444\u0430\u0439\u043b <br \/>  <b>application.properties<\/b>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421 \u0432\u043e\u0442 \u0442\u0430\u043a\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435\u043c<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre> #settings for database spring.datasource.url=jdbc:mysql:\/\/localhost\/forhabrahabr spring.datasource.username=root spring.datasource.password= spring.datasource.driver-class-name=com.mysql.jdbc.Driver #turned on to enable lazy loading spring.jpa.properties.hibernate.enable_lazy_load_no_trans = true <\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043d\u0430\u0434\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432 resources\/ \u043f\u0430\u043f\u043a\u0443 templates\/ \u0434\u043b\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u0430. <\/p>\n<p>  \u041f\u0430\u043f\u043a\u0430 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/24c\/034\/4df\/24c0344df9de5a550f7f894ffbf21839.png\" alt=\"image\"\/><br \/>  \u041d\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u0439\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0444\u0430\u0439\u043b\u044b .gitkeep, \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043e\u043d\u0438 \u043d\u0435 \u043d\u0443\u0436\u043d\u044b, \u043c\u043e\u0436\u043d\u043e \u0438\u0445 \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u0443\u0434\u0430\u043b\u044f\u0442\u044c\/\u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c.<\/p>\n<p>  \u0413\u043e\u0442\u043e\u0432\u043e, \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0432\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0435\u0437 \u043f\u0430\u0434\u0435\u043d\u0438\u044f \ud83d\ude42<br \/>  \u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0442\u0430\u0441\u043a\u0443 bootRun(\u0434\u0432\u043e\u0439\u043d\u043e\u0439 \u043a\u043b\u0438\u043a \u043f\u043e \u043d\u0435\u0439)<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/fe4\/2d8\/a24\/fe42d8a24348c7baf3a112b76b6b0888.png\" alt=\"image\"\/><br \/>  \u0415\u0441\u043b\u0438 \u043d\u0435\u0442 \u0442\u0430\u043a\u043e\u0439 \u043f\u0430\u043d\u0435\u043b\u044c\u043a\u0438, \u0438\u0434\u0435\u043c \u0432 View -&gt; Tool Windows -&gt; Gradle<br \/>  \u0412 \u043b\u043e\u0433\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u0442\u0430\u043a\u043e\u0433\u043e:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041b\u043e\u0433 \u0437\u0430\u043f\u0443\u0441\u043a\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre> 15:24:47: Executing external task 'bootRun'... :compileJava UP-TO-DATE :processResources :classes :findMainClass :bootRun    .   ____          _            __ _ _  \/\\\\ \/ ___'_ __ _ _(_)_ __  __ _ \\ \\ \\ \\ ( ( )\\___ | '_ | '_| | '_ \\\/ _` | \\ \\ \\ \\  \\\\\/  ___)| |_)| | | | | || (_| |  ) ) ) )   '  |____| .__|_| |_|_| |_\\__, | \/ \/ \/ \/  =========|_|==============|___\/=\/_\/_\/_\/  :: Spring Boot ::        (v1.2.5.RELEASE)  2015-07-11 14:24:49.180  INFO 12590 --- [           main] habraspring.Application                  : Starting Application on MacBook-Pro-Maksim.local with PID 12590 (\/Users\/admin\/IdeaProjects\/ForHabrahabr\/build\/classes\/main started by admin in \/Users\/admin\/IdeaProjects\/ForHabrahabr) 2015-07-11 14:24:49.230  INFO 12590 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@2eda0940: startup date [Sat Jul 11 14:24:49 MSK 2015]; root of context hierarchy 2015-07-11 14:24:50.029  INFO 12590 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'beanNameViewResolver': replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org\/springframework\/boot\/autoconfigure\/web\/ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org\/springframework\/boot\/autoconfigure\/web\/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]] 2015-07-11 14:24:50.701  INFO 12590 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$1f1e9ae] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2015-07-11 14:24:50.727  INFO 12590 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'transactionAttributeSource' of type [class org.springframework.transaction.annotation.AnnotationTransactionAttributeSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2015-07-11 14:24:50.741  INFO 12590 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'transactionInterceptor' of type [class org.springframework.transaction.interceptor.TransactionInterceptor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2015-07-11 14:24:50.746  INFO 12590 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.config.internalTransactionAdvisor' of type [class org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2015-07-11 14:24:51.168  INFO 12590 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http) 2015-07-11 14:24:51.408  INFO 12590 --- [           main] o.apache.catalina.core.StandardService   : Starting service Tomcat 2015-07-11 14:24:51.409  INFO 12590 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat\/8.0.23 2015-07-11 14:24:51.601  INFO 12590 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[\/]       : Initializing Spring embedded WebApplicationContext 2015-07-11 14:24:51.601  INFO 12590 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2374 ms 2015-07-11 14:24:52.570  INFO 12590 --- [ost-startStop-1] b.a.s.AuthenticationManagerConfiguration :   Using default security password: bd1659e1-4c49-43a2-9fd6-2ca7d46e9e23  2015-07-11 14:24:52.614  INFO 12590 --- [ost-startStop-1] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: Ant [pattern='\/css\/**'], [] 2015-07-11 14:24:52.614  INFO 12590 --- [ost-startStop-1] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: Ant [pattern='\/js\/**'], [] 2015-07-11 14:24:52.614  INFO 12590 --- [ost-startStop-1] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: Ant [pattern='\/images\/**'], [] 2015-07-11 14:24:52.614  INFO 12590 --- [ost-startStop-1] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: Ant [pattern='\/**\/favicon.ico'], [] 2015-07-11 14:24:52.614  INFO 12590 --- [ost-startStop-1] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: Ant [pattern='\/error'], [] 2015-07-11 14:24:52.650  INFO 12590 --- [ost-startStop-1] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: OrRequestMatcher [requestMatchers=[Ant [pattern='\/**']]], [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@5854c7d0, org.springframework.security.web.context.SecurityContextPersistenceFilter@874f491, org.springframework.security.web.header.HeaderWriterFilter@34c74c36, org.springframework.security.web.authentication.logout.LogoutFilter@609329b3, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@a37632c, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@33a36df4, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@a3153e3, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@1b8b1dc9, org.springframework.security.web.session.SessionManagementFilter@5ad0989a, org.springframework.security.web.access.ExceptionTranslationFilter@3e313564, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@1fb86c05] 2015-07-11 14:24:52.723  INFO 12590 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'characterEncodingFilter' to: [\/*] 2015-07-11 14:24:52.724  INFO 12590 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'hiddenHttpMethodFilter' to: [\/*] 2015-07-11 14:24:52.724  INFO 12590 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'springSecurityFilterChain' to: [\/*] 2015-07-11 14:24:52.724  INFO 12590 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean        : Mapping servlet: 'dispatcherServlet' to [\/] 2015-07-11 14:24:53.410  INFO 12590 --- [           main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default' 2015-07-11 14:24:53.425  INFO 12590 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [ \tname: default \t...] 2015-07-11 14:24:53.500  INFO 12590 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate Core {4.3.10.Final} 2015-07-11 14:24:53.503  INFO 12590 --- [           main] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found 2015-07-11 14:24:53.505  INFO 12590 --- [           main] org.hibernate.cfg.Environment            : HHH000021: Bytecode provider name : javassist 2015-07-11 14:24:53.628  INFO 12590 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {4.0.5.Final} 2015-07-11 14:24:53.711  INFO 12590 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect 2015-07-11 14:24:53.774  INFO 12590 --- [           main] o.h.h.i.ast.ASTQueryTranslatorFactory    : HHH000397: Using ASTQueryTranslatorFactory 2015-07-11 14:24:54.244  INFO 12590 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@2eda0940: startup date [Sat Jul 11 14:24:49 MSK 2015]; root of context hierarchy 2015-07-11 14:24:54.328  INFO 12590 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped &quot;{[\/error]}&quot; onto public org.springframework.http.ResponseEntity&lt;java.util.Map&lt;java.lang.String, java.lang.Object&gt;&gt; org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest) 2015-07-11 14:24:54.328  INFO 12590 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped &quot;{[\/error],produces=[text\/html]}&quot; onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest) 2015-07-11 14:24:54.356  INFO 12590 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [\/webjars\/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2015-07-11 14:24:54.357  INFO 12590 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [\/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2015-07-11 14:24:54.393  INFO 12590 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [\/**\/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2015-07-11 14:24:54.723  INFO 12590 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup 2015-07-11 14:24:54.800  INFO 12590 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http) 2015-07-11 14:24:54.803  INFO 12590 --- [           main] habraspring.Application                  : Started Application in 5.945 seconds (JVM running for 6.529)<\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u0439\u0442\u0438 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <a href=\"http:\/\/localhost:8080\">http:\/\/localhost:8080<\/a>, \u0434\u043e\u043b\u0436\u0435\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \ud83d\ude42<\/p>\n<p>  \u041d\u0443 \u0430 \u0442\u0435\u043f\u0435\u0440\u044c \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430, \u043d\u0435 \u0442\u0430\u043a \u043b\u0438?) <\/p>\n<h4><a name=\"23\"><\/a>2.3 \u041a\u043e\u043d\u0442\u0435\u043d\u0442<\/h4>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438(\u043f\u043e\u043c\u043d\u0438\u0442\u0435, \u043d\u0438\u043a\u0430\u043a\u0438\u0445 XML!) \u0432\u043e \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0439 \u043f\u0430\u043f\u043a\u0435 config, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c home.html (\u0430\u043d\u0430\u043b\u043e\u0433 index.html) \u0432 \u043f\u0430\u043f\u043a\u0443 resources.<br \/>  \u0424\u0430\u0439\u043b\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0443 \u043d\u0430\u0441 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0435, \u0432\u0435\u0434\u044c \u043c\u044b \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0434\u043b\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0431\u0435\u0437 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">config\/MvcConfig.java<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">package habraspring.config;  import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;  @Configuration public class MvcConfig extends WebMvcConfigurerAdapter {     @Override     public void addViewControllers(ViewControllerRegistry registry) {         registry.addViewController(&quot;\/home&quot;).setViewName(&quot;home&quot;);         registry.addViewController(&quot;\/&quot;).setViewName(&quot;home&quot;);     } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">config\/WebSecurityConfig.java<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">package habraspring.config;  import org.springframework.boot.autoconfigure.security.SecurityProperties; import org.springframework.context.annotation.Configuration; import org.springframework.core.annotation.Order; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.annotation.web.servlet.configuration.EnableWebMvcSecurity;  @Configuration @EnableWebMvcSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) @Order(SecurityProperties.ACCESS_OVERRIDE_ORDER) public class WebSecurityConfig extends WebSecurityConfigurerAdapter {     @Override     protected void configure(HttpSecurity http) throws Exception {         http                 .authorizeRequests()                 .antMatchers(&quot;\/&quot;, &quot;\/home&quot;).permitAll();     } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041d\u0443 \u0438 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0430\u044f \u0434\u043e\u043c\u0430\u0448\u043d\u044f\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0430:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">home.html<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"html\">&lt;!DOCTYPE html&gt; &lt;html xmlns=&quot;http:\/\/www.w3.org\/1999\/xhtml&quot; xmlns:th=&quot;http:\/\/www.thymeleaf.org&quot; xmlns:sec=&quot;http:\/\/www.thymeleaf.org\/thymeleaf-extras-springsecurity3&quot;&gt; &lt;head&gt;     &lt;title&gt;Habrahabr&lt;\/title&gt; &lt;\/head&gt; &lt;body&gt; &lt;h1&gt;Welcome!&lt;\/h1&gt;  &lt;p&gt;Yours home page.&lt;\/p&gt; &lt;\/body&gt; &lt;\/html&gt; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041a\u0430\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c(\u0438 \u0441\u043a\u0430\u0447\u0430\u0442\u044c) \u0442\u0443\u0442:<br \/>  <a href=\"https:\/\/github.com\/MaxPovver\/ForHabrahabr\/tree\/withbasicmvc\">github.com\/MaxPovver\/ForHabrahabr\/tree\/withbasicmvc<\/a><\/p>\n<p>  \u0415\u0441\u043b\u0438 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0441\u0435 \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043f\u043e <a href=\"http:\/\/localhost:8080\">http:\/\/localhost:8080<\/a> \u0443 \u0432\u0430\u0441 \u0434\u043e\u043b\u0436\u043d\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f   <\/p>\n<pre> Welcome!  Yours home page. <\/pre>\n<h3><a name=\"3\"><\/a>3. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0411\u0414<\/h3>\n<p>  \u0418\u0442\u0430\u043a, \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432, \u0438 \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0438\u043c \u0432\u044b\u0434\u0430\u0432\u0430\u043b\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u044e\u0437\u0435\u0440\u0430\u043c, \u043d\u043e \u0443 \u043d\u0430\u0441 \u0438\u0445 \u043f\u043e\u043a\u0430 \u043d\u0435\u0442 \ud83d\ude42<\/p>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b, \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u044e\u0437\u0435\u0440\u0430 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442.<br \/>  \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0448\u0430\u0433\u0438:  <\/p>\n<ul>\n<li> \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0441, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u044e\u0437\u0435\u0440\u0430 \u0432 \u0431\u0434<\/li>\n<li> \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043d\u043e\u0432\u043e\u0439 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438<\/li>\n<li> \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u00ab\u0441\u0432\u044f\u0437\u044c\u00bb \u043c\u0435\u0436\u0434\u0443 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u043e\u043c Spring Security \u0438 \u043d\u0430\u0448\u0435\u0439 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c\u044e<\/li>\n<li> \u0412\u0441\u0435 \u0432\u0435\u0437\u0434\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c<\/li>\n<li> \u00ab\u0412\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u00bb Spring Security<\/li>\n<\/ul>\n<h4><a name=\"31\"><\/a>3.1 \u0421\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u00abUser\u00bb<\/h4>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0432 \u0431\u0434 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0447\u043a\u0443 users \u0441 \u043f\u043e\u043b\u044f\u043c\u0438 id, username, password.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u043e\u0434\u043f\u0430\u043a\u0435\u0442 entities \u0434\u043b\u044f \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u0438 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0432 \u043d\u0435\u043c \u043a\u043b\u0430\u0441\u0441 User:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">entities\/User.java<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">package habraspring.entities;  import javax.persistence.*;  @Entity @Table(name=&quot;users&quot;) public class User {     @Id     @GeneratedValue(strategy = GenerationType.AUTO)     private long id;     private String username;     private String password;          public String getPassword() {         return password;     }      public void setPassword(String password) {         this.password = password;     }      public long getId() {         return id;     }      public void setId(long id) {         this.id = id;     }      public String getUsername() {         return username;     }      public void setUsername(String username) {         this.username = username;     }      protected User(){}     public User(String name, String pass) {         username = name;         password = pass;     }      } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041d\u0438\u043a\u0430\u043a\u0438\u0445 hbm.xml \u043d\u0435 \u043d\u0443\u0436\u043d\u043e, \u0434\u0430\u0436\u0435 \u0430\u043d\u043d\u043e\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u044f \u043d\u0435 \u043d\u0443\u0436\u043d\u043e(\u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u2014 \u043f\u043e\u043b\u0435 ID, \u0435\u0433\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u043d\u0430\u0434\u043e \u043e\u0442\u043c\u0435\u0447\u0430\u0442\u044c)<\/p>\n<h4><a name=\"32\"><\/a>3.2 \u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 UsersRepository<\/h4>\n<p>  \u0417\u0434\u0435\u0441\u044c Spring \u0432\u0441\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u0437\u0430 \u043d\u0430\u0441, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0442\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u043f\u043e\u043d\u044f\u043b \u0447\u0442\u043e \u0435\u043c\u0443 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043a\u043e\u0434 \u0436\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0432\u043e\u043e\u0431\u0449\u0435:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">UsersRepository.java<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">package habraspring.repositories;  import habraspring.entities.User; import org.springframework.data.repository.CrudRepository;  public interface UsersRepository extends CrudRepository&lt;User, Long&gt; {     User findByUsername(String username); } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h4><a name=\"33\"><\/a>3.3 \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0432\u044f\u0437\u0438 \u043c\u0435\u0436\u0434\u0443 \u044e\u0437\u0435\u0440\u043e\u043c \u0438 Spring Security<\/h4>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 UserDetailsService \u0438 \u043f\u043e\u0434\u043b\u044e\u0447\u0438\u0442\u044c \u0435\u0433\u043e \u0432 WebSecurityConfig<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">utils\/MySQLUserDetailsService.java<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">package habraspring.utils;  import habraspring.entities.User; import habraspring.repositories.UsersRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.InternalAuthenticationServiceException; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Service;  import java.util.ArrayList; import java.util.Collection; import java.util.List;  @Service public class MySQLUserDetailsService implements UserDetailsService {     @Autowired     UsersRepository users;     @Override     public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {         UserDetails loadedUser;          try {             User client = users.findByUsername(username);             loadedUser = new org.springframework.security.core.userdetails.User(                     client.getUsername(), client.getPassword(),                     DummyAuthority.getAuth());         } catch (Exception repositoryProblem) {             throw new InternalAuthenticationServiceException(repositoryProblem.getMessage(), repositoryProblem);         }         return loadedUser;     }      static class DummyAuthority implements GrantedAuthority     {         static Collection&lt;GrantedAuthority&gt; getAuth()         {             List&lt;GrantedAuthority&gt; res = new ArrayList&lt;&gt;(1);             res.add(new DummyAuthority());             return res;         }         @Override         public String getAuthority() {             return &quot;USER&quot;;         }     } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u043a\u043e\u0434 WebSecurityConfig:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0441\u043f\u043e\u0439\u043b\u0435\u0440\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">package habraspring.config;  import habraspring.utils.MySQLUserDetailsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.security.SecurityProperties; import org.springframework.context.annotation.Configuration; import org.springframework.core.annotation.Order; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.annotation.web.servlet.configuration.EnableWebMvcSecurity;  @Configuration @EnableWebMvcSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) @Order(SecurityProperties.ACCESS_OVERRIDE_ORDER) public class WebSecurityConfig extends WebSecurityConfigurerAdapter {     @Override     protected void configure(HttpSecurity http) throws Exception {         http                 .authorizeRequests()                 .antMatchers(&quot;\/&quot;, &quot;\/home&quot;).permitAll()                 .anyRequest().authenticated()                 .and()                 .formLogin()                 .loginPage(&quot;\/login&quot;)                 .permitAll()                 .and()                 .logout()                 .permitAll();     }      @Autowired     private MySQLUserDetailsService mySQLUserDetailsService;      @Autowired     public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {         auth.userDetailsService(mySQLUserDetailsService);     } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0443 \u0432\u0445\u043e\u0434\u0430 login.html \u0438 \u00ab\u0441\u0435\u043a\u0440\u0435\u0442\u043d\u0443\u044e\u00bb(\u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445) \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0443 secret.html  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0418\u0445 \u043a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<div class=\"spoiler\"><b class=\"spoiler_title\">secret.html<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"html\">&lt;!DOCTYPE html&gt; &lt;html xmlns=&quot;http:\/\/www.w3.org\/1999\/xhtml&quot; xmlns:th=&quot;http:\/\/www.thymeleaf.org&quot;       xmlns:sec=&quot;http:\/\/www.thymeleaf.org\/thymeleaf-extras-springsecurity3&quot;&gt; &lt;head&gt;     &lt;title&gt;Secret page&lt;\/title&gt; &lt;\/head&gt; &lt;body&gt; &lt;h1 th:inline=&quot;text&quot;&gt;Hello [[${#httpServletRequest.remoteUser}]]!&lt;\/h1&gt; &lt;form th:action=&quot;@{\/logout}&quot; method=&quot;post&quot;&gt;     &lt;input type=&quot;submit&quot; value=&quot;Sign Out&quot;\/&gt; &lt;\/form&gt; &lt;\/body&gt; &lt;\/html&gt; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">login.html<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"html\">&lt;!DOCTYPE html&gt; &lt;html xmlns=&quot;http:\/\/www.w3.org\/1999\/xhtml&quot; xmlns:th=&quot;http:\/\/www.thymeleaf.org&quot;       xmlns:sec=&quot;http:\/\/www.thymeleaf.org\/thymeleaf-extras-springsecurity3&quot;&gt; &lt;head&gt;     &lt;title&gt;Login page&lt;\/title&gt; &lt;\/head&gt; &lt;body&gt; &lt;div th:if=&quot;${param.error}&quot;&gt;     Invalid username and password. &lt;\/div&gt; &lt;div th:if=&quot;${param.logout}&quot;&gt;     You have been logged out. &lt;\/div&gt; &lt;form th:action=&quot;@{\/login}&quot; method=&quot;post&quot;&gt;     &lt;div&gt;&lt;label&gt; User Name : &lt;input type=&quot;text&quot; name=&quot;username&quot;\/&gt; &lt;\/label&gt;&lt;\/div&gt;     &lt;div&gt;&lt;label&gt; Password: &lt;input type=&quot;password&quot; name=&quot;password&quot;\/&gt; &lt;\/label&gt;&lt;\/div&gt;     &lt;div&gt;&lt;input type=&quot;submit&quot; value=&quot;Sign In&quot;\/&gt;&lt;\/div&gt; &lt;\/form&gt; &lt;\/body&gt; &lt;\/html&gt; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  \u0418 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438 \u0431\u0435\u0437 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0432 WebMvcConfig 2 \u0441\u0442\u0440\u043e\u0447\u043a\u0438:  <\/p>\n<pre><code class=\"java\">        registry.addViewController(&quot;\/login&quot;).setViewName(&quot;login&quot;);         registry.addViewController(&quot;\/secret&quot;).setViewName(&quot;secret&quot;); <\/code><\/pre>\n<p>  \u0413\u043e\u0442\u043e\u0432\u043e! \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <a href=\"http:\/\/localhost:8080\">http:\/\/localhost:8080<\/a> \u0443 \u0432\u0430\u0441 \u0434\u043e\u043b\u0436\u043d\u043e \u0432\u0441\u0435 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e,<br \/>  \u0430 \u0432\u043e\u0442 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <a href=\"http:\/\/localhost\">localhost<\/a>:8080\/secret \u0412\u044b \u043f\u0440\u043e\u0439\u0442\u0438 \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u2014 \u0431\u0443\u0434\u0435\u0442 \u043a\u0438\u0434\u0430\u0442\u044c \u0432 \/login, \u0442\u0440\u0435\u0431\u0443\u044f \u0432\u0430\u043b\u0438\u0434\u043d\u0443\u044e \u043f\u0430\u0440\u0443 \u044e\u0437\u0435\u0440\/\u043f\u0430\u0440\u043e\u043b\u044c.<br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 \u0412\u0430\u0448\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 forhabrahabr.users \u0437\u0430\u043f\u0438\u0441\u044c c \u043f\u0430\u0440\u043e\u043b\u0435\u043c \u0438 \u043b\u043e\u0433\u0438\u043d\u043e\u043c user, user (\u0438\u043b\u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u0441\u043a\u0440\u0438\u043f\u0442 <a href=\"https:\/\/github.com\/MaxPovver\/ForHabrahabr\/blob\/withauth\/import_me.sql\">github.com\/MaxPovver\/ForHabrahabr\/blob\/withauth\/import_me.sql<\/a> \u0432 \u0432\u0430\u0448\u0435\u0439 \u0434\u0431).<br \/>  \u0415\u0441\u043b\u0438 \u0432\u044b \u0432\u0441\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0442\u0435\u043f\u0435\u0440\u044c \u0412\u0430\u0441 \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0432 \/secret =)<\/p>\n<h3><a name=\"4\"><\/a>4. \u041a \u0447\u0435\u043c\u0443 \u043c\u044b \u043f\u0440\u0438\u0448\u043b\u0438<\/h3>\n<p>  \u0418\u0442\u0430\u043a, \u043c\u044b \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0435 Spring MVC \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Spring Security \u0434\u043b\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0438 Spring JPA \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0411\u0414. \u0418 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 XML =)<\/p>\n<h4><a name=\"41\"><\/a>4.1 \u0414\u043b\u044f \u0436\u0435\u043b\u0430\u044e\u0449\u0438\u0445 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442<\/h4>\n<ul>\n<li> git clone <a href=\"https:\/\/github.com\/MaxPovver\/ForHabrahabr.git\">github.com\/MaxPovver\/ForHabrahabr.git<\/a><\/li>\n<li> cd ForHabrahabr\/<\/li>\n<li> git checkout withauth<\/li>\n<li> \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0432 \u0441\u0432\u043e\u0435\u0439 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 mysql \u0431\u0434 import_me.sql(\u0438\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0440\u0443\u043a\u0430\u043c\u0438 \u0442\u0430\u0431\u043b\u0438\u0447\u043a\u0443 \u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043d\u0435\u0435)<\/li>\n<li>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0447\u0435\u0440\u0435\u0437 IDEA \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443 ForHabrahabr<\/b><\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/5d4\/fa8\/270\/5d4fa82708c2714b1fed09693dcaffab.png\" alt=\"image\"\/>  <\/div>\n<\/div>\n<\/li>\n<li>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041d\u0435\u0442\u0443 \u043f\u0430\u043d\u0435\u043b\u044c\u043a\u0438 Gradle? \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0435\u0435 \u0442\u0443\u0442<\/b><\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/70a\/0b7\/9f9\/70a0b79f928a472db4aba5a32bc46431.png\" alt=\"image\"\/>  <\/div>\n<\/div>\n<\/li>\n<li>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c bootRun<\/b><\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/7f4\/8a0\/f0e\/7f48a0f0e66fb21d81f73d1a58a3203f.png\" alt=\"image\"\/>  <\/div>\n<\/div>\n<\/li>\n<li> \u041d\u0430 \u044d\u0442\u043e\u043c \u0448\u0430\u0433\u0435 \u0443\u0436\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c<\/li>\n<\/ul>\n<p>  \u041c\u043d\u043e\u0433\u043e\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c\/\u043d\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0442\u044c \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0437\u0430\u043f\u0443\u0442\u0430\u0442\u044c \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043d\u043e \u0435\u0441\u043b\u0438 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0443\u0436\u0435 \u0441\u0435\u0439\u0447\u0430\u0441 \u2014 \u043f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043b\u0441.<\/p>\n<p>  \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 \u0435\u0449\u0435 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043d\u0430 \u043e\u0434\u043d\u0443 \u0447\u0430\u0441\u0442\u044c, \u0435\u0441\u043b\u0438, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0442\u0435\u043c\u0430 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0430. (Controllers, EntityToEntity(ManyToOne OneToOne etc), User Roles etc)   \t\t\t\t<\/p>\n<div class=\"polling\">\n<form action=\"\/json\/polling\/\" class=\"poll\" method=\"post\">\n<div class=\"poll_title\">\u041f\u043e\u043b\u0435\u0437\u043d\u0430 \u043b\u0438 \u0441\u0442\u0430\u0442\u044c\u044f?<\/div>\n<p>  \t\t<input type=\"hidden\" name=\"post_id\" value=\"262323\"\/> \t\t<input type=\"hidden\" name=\"polling_question_id\" value=\"13779\"\/>  \t\t<\/p>\n<table class=\"answer\">\n<tr>\n<td class=\"input\"> \t\t\t\t\t<input type=\"radio\" id=\"vv67863\" \t\t\t\t\t\tclass=\"radio js-field-data\" \t\t\t\t\t\tname=\"variant[]\" \t\t\t\t\t\tvalue=\"67863\" \/> \t\t\t\t<\/td>\n<td class=\"label\"> \t\t\t\t\t<label for=\"vv67863\">\u0414\u0430. \u0414\u0430\u043b\u044c\u0448\u0435 \u043f\u0438\u043b\u0438\u0442\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e.<\/label> \t\t\t\t<\/td>\n<\/tr>\n<tr>\n<td class=\"input\"> \t\t\t\t\t<input type=\"radio\" id=\"vv67865\" \t\t\t\t\t\tclass=\"radio js-field-data\" \t\t\t\t\t\tname=\"variant[]\" \t\t\t\t\t\tvalue=\"67865\" \/> \t\t\t\t<\/td>\n<td class=\"label\"> \t\t\t\t\t<label for=\"vv67865\">\u0414\u0430, \u043f\u0438\u043b\u0438 \u0434\u0430\u043b\u044c\u0448\u0435!<\/label> \t\t\t\t<\/td>\n<\/tr>\n<tr>\n<td class=\"input\"> \t\t\t\t\t<input type=\"radio\" id=\"vv67867\" \t\t\t\t\t\tclass=\"radio js-field-data\" \t\t\t\t\t\tname=\"variant[]\" \t\t\t\t\t\tvalue=\"67867\" \/> \t\t\t\t<\/td>\n<td class=\"label\"> \t\t\t\t\t<label for=\"vv67867\">\u041d\u0435\u0442.<\/label> \t\t\t\t<\/td>\n<\/tr>\n<\/table>\n<p class=\"total\">\u041d\u0438\u043a\u0442\u043e \u0435\u0449\u0451 \u043d\u0435 \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043b. \u0412\u043e\u0437\u0434\u0435\u0440\u0436\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u043d\u0435\u0442.<\/p>\n<\/p><\/form>\n<p class=\"for_users_only_msg\">\u0422\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u043e\u043f\u0440\u043e\u0441\u0435. <a href=\"https:\/\/habrahabr.ru\/auth\/login\/\">\u0412\u043e\u0439\u0434\u0438\u0442\u0435<\/a>, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430.<\/p>\n<\/p><\/div>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/262323\/\"> http:\/\/habrahabr.ru\/post\/262323\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>     \t\u041f\u0440\u0438\u0432\u0435\u0442, \u0445\u0430\u0431\u0440\u0430\u0445\u0430\u0431\u0440!<\/p>\n<p>  \u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0442\u0443\u0442 \u0443\u0436\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0433\u0430\u0439\u0434\u043e\u0432 \u043f\u043e \u0442\u0430\u043a\u043e\u0439 \u0441\u0432\u044f\u0437\u043a\u0435, \u043d\u043e \u043e\u043d\u0438 \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u0432\u043e-\u043f\u0435\u0440\u0432\u044b\u0445 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u0435, \u0432\u043e \u0432\u0442\u043e\u0440\u044b\u0445 \u2014 \u044f \u0441\u0447\u0438\u0442\u0430\u044e \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0433\u0430\u0439\u0434 \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043e\u0441\u044f\u0437\u0430\u0435\u043c\u043e\u0435 \u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0435, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0447\u0442\u043e \u0438 \u0442\u0430\u043a\u043e\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \ud83d\ude42<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c Spring MVC \u0441\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435\u043c \u0432 \u0431\u0430\u0437\u0435 \u0438 0(\u043d\u0443\u043b\u0435\u043c) \u0444\u0430\u0439\u043b\u043e\u0432 xml-\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439, \u043f\u0440\u043e\u0448\u0443 \u043f\u043e\u0434 \u043a\u0430\u0442!<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-261202","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/261202","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=261202"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/261202\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=261202"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=261202"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=261202"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}