server.port=8182
spring.jpa.hibernate.ddl-auto=create 。spring.jpa.hibernate.ddl-auto=createと、データベースのテーブルが定期的に作成できます。 - https://docs.spring.io/spring-data/jpa/docs/current/reference/html/
- https://www.logicbig.com/ - https://howtodoinjava.com/
- https://o7planning.org/ - https://www.concretepage.com/spring-boot/
- https://memorynotfound.com/ - https://www.dineshonjava.com/
プロジェクトを実行する方法。 Application.Propertiesを見てください。ポート番号があります。
Links:
http://localhost:3092/ http://localhost:3092/welcome
スプリングブートでJSPファイルを使用して表示する方法
Links:
http://localhost:8182/ http://localhost:8182/personels
スプリングブーツでエラーページを使用して表示する方法
まず、エラーページを表示したい場合は404.html or 403.htmlなどのsrc/main/resources/public/error/(ErrorPage.html)に追加する必要があります。
ボトムリンクのいずれかを記述すると、エラーページがerror.htmlとして表示されません
http://localhost:8182/ http://localhost:8182/personels
ボトムリンクの1つを書くと、エラーページがerror.htmlとして表示されます
http://localhost:8182/deneme http://localhost:8182/asd
http://localhost:8182/asdqwe/121243dqwe?c=asldkwqe http://localhost:8182/deneme.jsp
requestmethod.post、requestmethod.put、requestmethod.delete、requestmethod.getの使用方法
sersonelclinicrestcontrollertest.java(src/test/java/com/javaegitimleri/app/web/)でJunítを試してみることができます。
You can try runnuing anymethods with run as -> Junit Test in src/test/java/com/javaegitimleri/app/web/PersonelClinicRestControllerTest.java.
Then you can look at changing data on localhost:8182/rest/personels
スキーマを作成し、テーブルを作成し、JDBCをテーブルに追加する方法。 src/main/resources/data.sql&schema.sqlを見ることができます。
JDBCでH2データベースの使用方法。
Also You can try runnuing createPersonelTest, deletePersonelTest methods with run as -> Junit Test
in src/test/java/com/javaegitimleri/app/web/PersonelClinicRestControllerTest.java.
H2データベースでJPAを使用する方法
@transactional、@id、@generatedValue、@Entity、@table @columnの使用方法
ログインおよびログアウト手順の使用方法
特定のログインページの使用方法
使用方法セキュリティログインのために私を忘れないでください
まず、POM.xmlにSpring-Boot-Starter-Security依存関係ファイルを追加する必要があります。
src/main/resources/...のapplication.propertiesファイルを見てください。
#you can change username and password. then you can try login proccessing
spring.security.user.name=celal
spring.security.user.password=123456
最初のステップPDADMIN 4を開き、SQLエディターを使用してクエリを作成して、Perenselsと呼ばれるデータベースで顧客テーブルを作成します。また、Diffreant名と呼ばれるデータベースを作成できます。
CREATE TABLE customer(
id BIGINT PRIMARY KEY NOT NULL,
firstname VARCHAR(20),
lastname VARCHAR(20)
);
セカンドステップ
First you need to write localhost:8182/save
Then you can try writing bottom any link
localhost:8182/findall
localhost:8182/findbyid?id=3
localhost:8182/findbylastname?lastname=Terim
ログインプロセスの使用方法
holy_editorまたはlelis_adminがある人は、 AUTHORIZATIONのために /rest /** and /actuator /**というリンクを入力できます。
links - > localhost:8182/rest/personels 、 localhost:8182/rest/personel/3 、 localhost:8182/rest/personel?fn=Celallinks - > localhost:8182/actuator/health INSERT INTO USERS VALUES('user1','{noop}12345',TRUE);
INSERT INTO USERS VALUES('user2','{noop}secrett',TRUE);
INSERT INTO USERS VALUES('celal','{noop}secret',TRUE);
SRC/Main/Resources/data.sqlで、SQL Queris以上ではなく、最初の3つのSQLクエリの下にデータを記述できます。
INSERT INTO USERS VALUES('user1','{bcrypt}$2a$10$FMQOTEUiRN1L2MV2gfYas.MEDnLcEffuenRme5WdFgkwcuWA2jyhG',TRUE);
INSERT INTO USERS VALUES('user2','{bcrypt}$2a$10$.qPu/z1bV0Lw5uSpv6YMKeiCUI4rsxfNY/HJJBgw9E7CYUULMW3CS',TRUE);
INSERT INTO USERS VALUES('celal','{bcrypt}$2a$10$m9RM8vLgWvu/8Ig21HURG.IHIeFEie8CsKaGV1FeQ88bi27Xz4wJS',TRUE);
SRC/Main/Resources/data.sqlで最初の3行を変更した場合、ユーザー名とパスワードは再び同じになります。
暗号化されたデータの場合、src/test/com/javaegitimleri/ap/testのpasswordencodertest.javaクラスを見ることができます(暗号化されたデータ)
12345 - > {bcrypt}$2a$10$FMQOTEUiRN1L2MV2gfYas.MEDnLcEffuenRme5WdFgkwcuWA2jyhGsecrett > {bcrypt}$2a$10$.qPu/z1bV0Lw5uSpv6YMKeiCUI4rsxfNY/HJJBgw9E7CYUULMW3CSsecret > {bcrypt}$2a$10$m9RM8vLgWvu/8Ig21HURG.IHIeFEie8CsKaGV1FeQ88bi27Xz4wJS RESTFULおよびJSPファイルのためにCRUDにJPAを使用してPostgreSQLを使用する方法。 create, read, update, delete
PDADMIN 4を開き、SQLエディターを使用してクエリを作成して、Perenselsと呼ばれるデータベースで顧客テーブルを作成します。また、Diffreant名と呼ばれるデータベースを作成できます。
CREATE TABLE customer(
id BIGINT PRIMARY KEY NOT NULL,
firstname VARCHAR(20),
lastname VARCHAR(20)
);
以下のサンプルリンクを試すことができます。
localhost:8182/ localhost:8182/customers localhost:8182/customer/1
localhost:8182/rest/customers localhost:8182/rest/customer/1
@onetoone、@joincolumn、@jsonignoreの使用方法Spring BootおよびData for Multiple Tableのデータ。
最初の1つ:PGADMIN 4のユーザーと呼ばれるデータベースでボトムテーブルを作成します。
データベースの名前を変更した場合。変更できます。
CREATE TABLE customer(
id BIGINT PRIMARY KEY NOT NULL,
name VARCHAR(255),
email VARCHAR(255)
);
CREATE TABLE details(
id BIGINT PRIMARY KEY NOT NULL,
city VARCHAR(255),
country VARCHAR(255),
phone_number VARCHAR(255),
customeid BIGINT,
FOREIGN KEY (customerid) REFERENCES customer (id)
);
2番目:LocalHost:8182/挿入データベースにデータを挿入します。次に、他のリンクを書きます
localhost:8182/details localhost:8182/customers localhost:8182/customers localhost:8182/customer/{id}
localhost:8182/customerjson/{id}
スプリングブーツと複数のテーブルのデータに@Manytooneを使用する方法。
@Queryで特定のSQLクエリを使用する方法
最初の1つ:PGADMIN 4のユーザーと呼ばれるデータベースでボトムテーブルを作成します。
データベースの名前を変更した場合。変更できます。
CREATE TABLE car(
id BIGINT PRIMARY KEY NOT NULL,
name VARCHAR(255),
model INTEGER
);
CREATE TABLE customer(
id BIGINT PRIMARY KEY NOT NULL,
name VARCHAR(255),
email VARCHAR(255)
);
CREATE TABLE book(
id BIGINT PRIMARY KEY NOT NULL,
name VARCHAR(255),
customeid BIGINT,
FOREIGN KEY (customer_id) REFERENCES customer (id)
);
2番目:LocalHost:8182/挿入データベースにデータを挿入します。
localhost:8182/books localhost:8182/book/{id} localhost:8182/customers localhost:8182/customer/{id}
@embeddableの使用方法、 @embedded for spring data on Springブーツ
最初の1つ:PGADMIN 4のユーザーと呼ばれるデータベースでボトムテーブルを作成します。
データベースの名前を変更した場合。変更できます。
CREATE TABLE car(
id BIGINT PRIMARY KEY NOT NULL,
name VARCHAR(255),
model INTEGER,
details VARCHAR(255)
);
2番目:最初にlocalhost:8182/insert_carを書き込み、データベースにデータを挿入します。
localhost:8182/insert_car
次に、次のような他のリンクを書きます
for Post method on Postman localhost:8182/car
for Put and Delete method on Postman localhost:8182/car/{id}
また、これらのリンクをブラウザに書き込みます
localhost:8182/car1/{id} localhost:8182/car2/{id}
localhost:8182/car_with_name/{name} localhost:8182/car_with_model/{model}
スプリングブーツと複数のテーブルのデータに@Onetomanyと@Manytooneを使用する方法。
Spring BootでJPA HibernateでThymeleafを使用する方法。
最初の1つ:PGADMIN 4のユーザーと呼ばれるデータベースでボトムテーブルを作成します。
データベースの名前を変更した場合。変更できます。
CREATE TABLE customer(
id BIGINT PRIMARY KEY NOT NULL,
name VARCHAR(255),
email VARCHAR(255),
enabled boolen,
password VARCHAR(255)
);
CREATE TABLE customer_role(
id BIGINT PRIMARY KEY NOT NULL,
role_name VARCHAR(255),
customeid BIGINT,
FOREIGN KEY (customer_id) REFERENCES customer (id)
);
2番目:LocalHost:8182/REST/INSERTを記述して、データベースにデータを挿入します。
localhost:8182/customers localhost:8182/rest/customers localhost:8182/rest/cust
Spring Securityと@secured @queryの使用方法Spring BootおよびwebsecurityconfigurerAdapterで静的ユーザーとパスワードデータを使用します。
spring.jpa.hibernate.ddl-auto=create 。 CREATE TABLE customer(
id BIGINT PRIMARY KEY NOT NULL,
name VARCHAR(255),
email VARCHAR(255),
enabled boolen,
password VARCHAR(255)
);
CREATE TABLE customer_role(
id BIGINT PRIMARY KEY NOT NULL,
role_name VARCHAR(255),
customeid BIGINT,
FOREIGN KEY (customer_id) REFERENCES customer (id)
);
Spring Securityと@secured( "...")の使用方法。 Spring-boot-15-springsecurityでこのwebConfigurationClass.javaを見てください(simple)-jpa-postgresql/src/main/java/com/example/demo/
このプロジェクトを実行すると、ユーザーとパスワードを使用してログインできますwebConfigurationClass.java
USER / PASSWORD / ROLE
-------------------------------------------
- admin / admin / "ADMIN"
- celal / celal / "USER"
- arda / arda / "EDITOR"
役割のリンクへのアクセス
Permitall links
localhost:8182/userinfo/
for ADMIN, ADMIN can access these links
localhost:8182/rest/customers/
for USER, USER can acces these links
localhost:8182/rest/customers/ localhost:8182/rest/customer-by-email/{email}/
localhost:8182/customer/{email}/ localhost:8182/rest/customerbyname/{name]
for EDITOR, EDITOR can acces these links
localhost:8182/rest/cust/ localhost:8182/rest/customer-by-name/{name}/
@manytomanyを使用し、 @jointable spring boot and data for multial tableのデータを使用する方法。
spring.jpa.hibernate.ddl-auto=create 。spring.jpa.hibernate.ddl-auto=createと、データベースのテーブルが定期的に作成できます。 CREATE TABLE student(
id INTEGER PRIMARY KEY NOT NULL,
name VARCHAR(255),
);
CREATE TABLE subject(
id INTEGER PRIMARY KEY NOT NULL,
name VARCHAR(255)
);
Spring Bootで登録とログインを使用する方法とMySQLを使用してセキュリティ。
spring.jpa.hibernate.ddl-auto=create 。spring.jpa.hibernate.ddl-auto=createと、データベースのテーブルが定期的に作成できます。 - Spring Boot
- Spring Security
- Jpa, Hibernate
- Mysql
- Thymeleaf
- Bootstrap

@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
- Spring Boot
- Jpa, Hibernate
- PostgreSQL