{"id":288310,"date":"2018-08-21T15:55:02","date_gmt":"2018-08-21T11:55:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=288310"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=288310","title":{"rendered":"\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 maven \u043f\u0440\u043e\u0435\u043a\u0442 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Java EE + WildFly10 + JPA (Hibernate) + Postgresql + EJB + IntelliJ IDEA"},"content":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/post\/420827\/\" class=\"post__text post__text-html js-mediator-article\">\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u044f \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 JBoss \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 JPA. \u0412 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 JPA, Hibernate, EJB \u043b\u0435\u0437\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0443, \u044d\u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0442\u0435\u043c\u0430. \u041f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043a\u0430\u0436\u0443 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043a\u0430\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c datasource \u043d\u0430 WildFly \u0438 \u0432\u0441\u0435 \u044d\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0432 IntelliJ IDEA. \u0414\u0430\u043d\u043d\u044b\u0439 \u043a\u0430\u0440\u043a\u0430\u0441, \u044f \u0434\u0443\u043c\u0430\u044e, \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u043d\u043e\u0432\u0438\u0447\u043a\u0430\u043c, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u043c \u0441 JavaEE \u0438 JPA. <a name=\"habracut\"><\/a><\/p>\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 WildFly10<\/h3>\n<p>  \u0417\u0430\u0445\u043e\u0434\u0438\u043c \u043d\u0430 <a href=\"http:\/\/wildfly.org\/downloads\/\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0430\u0439\u0442 WildFly<\/a> \u0438 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u044e 10.1.0.Final. (\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0430\u044f, \u043d\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0435\u0435).<\/p>\n<p>  \u0420\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0430\u0440\u0445\u0438\u0432 \u0432 \u043b\u044e\u0431\u0443\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u043d\u0430 \u0432\u0430\u0448\u0435\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435. <br \/>  \u0414\u0430\u043b\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c bin\/add-user.bat. \u0422\u0430\u043c \u0432\u0441\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e. \u0421\u043b\u0435\u0434\u0443\u0435\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c \u0438 \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 username \u0438 password.<\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 datasource<\/h4>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 datasource \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435. \u0421\u0430\u043c\u044b\u043c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0439 WildFly. <\/p>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0432 \u043d\u0435\u0435 \u0437\u0430\u0439\u0442\u0438, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440 \/bin\/standalone.bat \u0438 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <a href=\"http:\/\/127.0.0.1\">127.0.0.1<\/a>:9990. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043f\u0430\u0440\u043e\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043b\u0438.<\/p>\n<p>  \u0418\u0434\u0435\u043c \u0432 \u0440\u0430\u0437\u0434\u0435\u043b Deployments-&gt;Add-&gt;Upload a new deployment.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c jdbc \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0441 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0430\u0439\u0442\u0435 postgresql. \u042f \u0441\u043a\u0430\u0447\u0430\u043b postgresql-42.2.4.jar. \u0415\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 deployments. \u0418\u043c\u044f \u043c\u043e\u0436\u043d\u043e \u0434\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0435. <\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 Configuration-&gt;Subsystems-&gt;Datasources-&gt;Non-XA-&gt;Add.<\/p>\n<p>  \u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c Postgresql Datasource \u0438 \u043d\u0430\u0448 \u0441\u043a\u0430\u0447\u0430\u043d\u043d\u044b\u0439 \u0434\u0440\u0430\u0439\u0432\u0435\u0440. \u0417\u0430\u0434\u0430\u0435\u043c url \u043d\u0430\u0448\u0435\u0439 \u0431\u0430\u0437\u044b, \u043b\u043e\u0433\u0438\u043d \u0438 \u043f\u0430\u0440\u043e\u043b\u044c. (\u043d\u0435 \u043f\u0443\u0442\u0430\u0442\u044c \u0441 \u043b\u043e\u0433\u0438\u043d\u043e\u043c \u0438 \u043f\u0430\u0440\u043e\u043b\u0435\u043c \u043e\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430). \u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0442\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u0432\u0430\u0448 \u043d\u043e\u0432\u044b\u0439 datasource \u0432 \u0441\u043f\u0438\u0441\u043a\u0435. \u0412\u043e \u0432\u043a\u043b\u0430\u0434\u043a\u0435 View \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u0431\u0430\u0437\u043e\u0439, \u0435\u0441\u043b\u0438 \u043d\u0430\u0436\u043c\u0435\u0442\u0435 Test Connection.<\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 IntelliJ IDEA <\/h3>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0432\u0441\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e. \u0414\u0443\u043c\u0430\u044e \u043b\u0438\u0448\u043d\u0438\u0445 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f. \u0421\u043e\u0437\u0434\u0430\u0435\u043c maven \u043f\u0440\u043e\u0435\u043a\u0442. \u0412 packaging \u0441\u0442\u0430\u0432\u0438\u043c war. \u0418 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438.<\/p>\n<p>  \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u043e\u0442 \u043c\u043e\u0439 pom.xml<\/p>\n<pre><code class=\"xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; &lt;project xmlns=&quot;http:\/\/maven.apache.org\/POM\/4.0.0&quot;          xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot;          xsi:schemaLocation=&quot;http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd&quot;&gt;     &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;      &lt;groupId&gt;yst&lt;\/groupId&gt;     &lt;artifactId&gt;hiberProject&lt;\/artifactId&gt;     &lt;version&gt;1.0-SNAPSHOT&lt;\/version&gt;     &lt;packaging&gt;war&lt;\/packaging&gt;      &lt;dependencies&gt;          &lt;dependency&gt;             &lt;groupId&gt;javax&lt;\/groupId&gt;             &lt;artifactId&gt;javaee-api&lt;\/artifactId&gt;             &lt;version&gt;7.0&lt;\/version&gt;             &lt;scope&gt;provided&lt;\/scope&gt;         &lt;\/dependency&gt;          &lt;dependency&gt;             &lt;groupId&gt;org.hibernate&lt;\/groupId&gt;             &lt;artifactId&gt;hibernate-core&lt;\/artifactId&gt;             &lt;version&gt;5.2.12.Final&lt;\/version&gt;             &lt;scope&gt;provided&lt;\/scope&gt;         &lt;\/dependency&gt;       &lt;\/dependencies&gt;      &lt;build&gt;         &lt;finalName&gt;hiberProject&lt;\/finalName&gt;     &lt;\/build&gt;   &lt;\/project&gt; <\/code><\/pre>\n<p>  <\/p>\n<h4>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h4>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/fa\/na\/ck\/fanackq3bgnbbrp23g0adgdlyl8.jpeg\"\/><\/p>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e persitence.xml \u043b\u0435\u0436\u0438\u0442 \u0432 WEB-INF-&gt;classes-&gt;META-INF.<\/p>\n<p>  \u0410 \u0432\u043e\u0442 \u0438 \u0441\u0430\u043c persistence.xml<\/p>\n<pre><code class=\"xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; &lt;persistence version=&quot;2.0&quot;              xmlns=&quot;http:\/\/java.sun.com\/xml\/ns\/persistence&quot; xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot;              xsi:schemaLocation=&quot;http:\/\/java.sun.com\/xml\/ns\/persistence http:\/\/java.sun.com\/xml\/ns\/persistence\/persistence_2_0.xsd&quot;&gt;      &lt;persistence-unit name=&quot;myUnit&quot; &gt;         &lt;provider&gt;org.hibernate.jpa.HibernatePersistenceProvider&lt;\/provider&gt;         &lt;jta-data-source&gt;java:\/PostgresDS&lt;\/jta-data-source&gt;         &lt;class&gt;UserEntity&lt;\/class&gt;         &lt;class&gt;JavaBean&lt;\/class&gt;         &lt;properties&gt;             &lt;property name=&quot;hibernate.show_sql&quot; value=&quot;true&quot; \/&gt;             &lt;property name=&quot;hibernate.format_sql&quot; value=&quot;true&quot; \/&gt;             &lt;property name=&quot;hibernate.hbm2ddl.auto&quot; value=&quot;update&quot; \/&gt;          &lt;\/properties&gt;     &lt;\/persistence-unit&gt;  &lt;\/persistence&gt; <\/code><\/pre>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 jta-data-source \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c jndi-name, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0443\u043a\u0430\u0437\u0430\u043b\u0438 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 datasource. <br \/>  <i>\u0415\u0441\u043b\u0438 \u0437\u0430\u0431\u044b\u043b\u0438, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 127.0.0.1:9990 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 Configuration-&gt;Subsystems-&gt;Datasources-&gt;\u041d\u0430\u0448 datasource-&gt;View-&gt;Attributes-&gt;\u0441\u0442\u0440\u043e\u043a\u0430 JNDI.<\/i><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043d\u0430\u0448\u0438 \u043a\u043b\u0430\u0441\u0441\u044b.<\/p>\n<p>  1. \u041f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 entity \u043a\u043b\u0430\u0441\u0441.<\/p>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043d\u0435 \u0440\u0430\u0441\u043f\u0438\u0441\u044b\u0432\u0430\u044e. \u042d\u0442\u043e \u0443\u0436\u0435 \u0434\u0440\u0443\u0433\u0430\u044f \u0442\u0435\u043c\u0430. <\/p>\n<pre><code class=\"java\">import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id;   @Entity public class UserEntity {      @Id     @GeneratedValue(strategy = GenerationType.IDENTITY)     private int id;      private String name;      public int getId() {         return id;     }      public void setId(int id) {         this.id = id;     }      public String getName() {         return name;     }      public void setName(String name) {         this.name = name;     } } <\/code><\/pre>\n<p>  2. EJB \u043a\u043b\u0430\u0441\u0441<\/p>\n<p>  \u0410\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f @PersistenceContext \u0438\u043d\u0436\u0435\u043a\u0442\u0438\u0442 \u043d\u0430\u0448 persistence-unit \u0438 \u043d\u0430 \u0435\u0433\u043e \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 EntityManager.<\/p>\n<p>  \u0410\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f @Stateless \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u044d\u0442\u043e ejb.<\/p>\n<pre><code class=\"java\">import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext;    @Stateless public class JavaBean {      @PersistenceContext(unitName = &quot;myUnit&quot;)     EntityManager entityManager;      public void saveUser(UserEntity user){         entityManager.persist(user);      }  } <\/code><\/pre>\n<p>  3. \u041f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 Servlet<\/p>\n<p>  \u0410\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f @EJB \u0438\u043d\u0436\u0435\u043a\u0442\u0438\u0442 JavaBean.<\/p>\n<p>  \u0412 \u043c\u0435\u0442\u043e\u0434\u0435 doGet \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u00abSer\u00bb \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 saveUser \u0438\u0437 ejb.<br \/>  \u0415\u0441\u043b\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b userentity \u043d\u0435 \u0431\u044b\u043b\u043e, \u0442\u043e hibernate \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0441\u0430\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438 \u0432\u0441\u0442\u0430\u0432\u0438\u0442 \u0442\u0443\u0434\u0430 \u043d\u0430\u0448\u0435\u0433\u043e user. <\/p>\n<pre><code class=\"java\">import javax.ejb.EJB; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException;   @WebServlet(&quot;\/test&quot;) public class App extends HttpServlet{      @EJB     JavaBean javaBean;       @Override     protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {          UserEntity user=new UserEntity();         user.setName(&quot;Ser&quot;);          javaBean.saveUser(user);          resp.getWriter().println(&quot;Hello from servlet&quot;);     } }<\/code><\/pre>\n<p>  <\/p>\n<h3>\u0417\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h3>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 jboss \u0432 IDEA, \u0437\u0430\u0445\u043e\u0434\u0438\u043c \u0432 Run-&gt;EditConfiguration, \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c &quot;+&quot; \u0432 \u043b\u0435\u0432\u043e\u043c \u0432\u0435\u0440\u0445\u043d\u0435\u043c \u0443\u0433\u043b\u0443 \u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c jboss-local.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/vy\/lq\/dy\/vylqdy3jkdqi6ab7ip6fxzshvde.jpeg\"\/><\/p>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 ApplicationServer \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0430\u043f\u043a\u0443 \u0441 \u043d\u0430\u0448\u0438\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u043c WildFly. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0442\u0438\u0444\u0430\u043a\u0442\u0430 \u044f \u0432\u044b\u0431\u0440\u0430\u043b ExternalArtifact (\u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0439 maven hiberProject.war), \u0443\u0431\u0440\u0430\u043b \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 Build \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 maven (clean package install). <\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0436\u043c\u0435\u043c \u0441\u0442\u0430\u0440\u0442 \u0438 \u0436\u0434\u0435\u043c \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0441\u044f \u0441\u0435\u0440\u0432\u0435\u0440. \u0414\u0430\u043b\u0435\u0435 \u0437\u0430\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 localhost:8080\/\u0438\u043c\u044f\u043f\u0440\u043e\u0435\u043a\u0442\u0430\/test.<\/p>\n<p>  \u041f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 doGet \u0438 \u043d\u0430\u0448 user \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u00abSer\u00bb \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0431\u0430\u0437\u0443. <\/p>\n<p>  \u0412\u0441\u0435\u043c \u0441\u043f\u0430\u0441\u0438\u0431\u043e. \u041d\u0430\u0434\u0435\u044e\u0441\u044c \u043a\u043e\u043c\u0443-\u0442\u043e \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043c\u043e\u0433\u043b\u0430.<\/p><\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/post\/420827\/\"> https:\/\/habr.com\/post\/420827\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/post\/420827\/\" class=\"post__text post__text-html js-mediator-article\">\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u044f \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 JBoss \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 JPA. \u0412 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 JPA, Hibernate, EJB \u043b\u0435\u0437\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0443, \u044d\u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0442\u0435\u043c\u0430. \u041f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043a\u0430\u0436\u0443 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043a\u0430\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c datasource \u043d\u0430 WildFly \u0438 \u0432\u0441\u0435 \u044d\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0432 IntelliJ IDEA. \u0414\u0430\u043d\u043d\u044b\u0439 \u043a\u0430\u0440\u043a\u0430\u0441, \u044f \u0434\u0443\u043c\u0430\u044e, \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u043d\u043e\u0432\u0438\u0447\u043a\u0430\u043c, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u043c \u0441 JavaEE \u0438 JPA. <\/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-288310","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/288310","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=288310"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/288310\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=288310"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=288310"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=288310"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}