Spring Boot+Hibernate Project with Weblogic server. Deploy Spring Boot Project to WebLogic (with Datasource). (Part Three) - NESTED CODE || TECH FLOAT

Breaking

Post Top Ad

Post Top Ad

Saturday, 9 May 2020

Spring Boot+Hibernate Project with Weblogic server. Deploy Spring Boot Project to WebLogic (with Datasource). (Part Three)


Well, Hope you have already checked our previous blog on "how to run springboot project on embedded tomcat". Now we will use the data source connection into the project which was created in first blog on the same topic. Our main purpose of this update is Project will use the DB connection pool from data source not via user id password mentioned in application.properties.  Lets follow the below steps.

Step-1: First of all update Application.properties file link below screen. Commented out url, password and driver class. And add new highlighted line as below.



File Code :


server.port=8086
#spring.datasource.url=jdbc:mysql://localhost:3306/sys?useSSL=false
#spring.datasource.password=Password123
#spring.datasource.driver-class-name=com.mysql.jdbc.Driver
#This is to connect weblogic DS
spring.datasource.jndi-name=tutorial/jdbcDS
# The SQL dialect makes Hibernate generate better SQL for the chosen database
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect
# Hibernate ddl auto (create, create-drop, validate, update)
spring.jpa.hibernate.ddl-auto = update
spring.jpa.show-sql=true
#spring.jpa.properties.hibernate.format_sql=true 
#If want to see very extensive logging
#spring.jpa.properties.hibernate.generate_statistics=true
#logging.level.org.hibernate.type=trace
logging.level.org.hibernate.stat=debug


Step:-2 Lets build the project that is WAR file (weblogicDeploy.war) as shown in below screen. Choose export as war option in eclipse.







Step-3: Now open weblogic console and choose Deployments -> install option as shown in below image.



Step-4: Choose File as the war file we have created in step-2, click next.


Step-5: Make sure to choose Install this deployment as an application.


Step-6: Make sure to choose target server. We will deploy this in Admin server itself. You want to choose any managed server that also is possible.


Step-7: Click next and finish you should be able to see the below screen as server started and war has been deployed successfully.


Step-8: Now time to test the application. Pass the json body as shown the below image and you should be able to test API end point successfuly.






That's all for today, So, we have created a new data source, created a new project and later used the datasource to project and deployed the war into weblogic finally. Let me know if you have any confusion, comment below.

Download the complete Project Click Here.


No comments:

Post a Comment

Post Bottom Ad