Download presentation
Presentation is loading. Please wait.
Published byGerald Elliott Modified over 9 years ago
1
CHAPTER 4 SPRING FRAMEWORK Wattanapong suttapak, Software Engineering, school of Information communication Technology, university of phayao
2
จุดประสงค์การเรียนรู้ ตั้งค่า spring framework เพิ่ม ลบ แก้ไข ค้นหา ข้อมูลภายในตารางของ ฐานข้อมูลโดยใช้ spring framework ได้
3
SPRING FRAMEWORK what is spring framework? The Spring Framework provides a comprehensive programming and configuration model for modern Java-based enterprise applications - on any kind of deployment platform. A key element of Spring is infrastructural support at the application level: Spring focuses on the "plumbing" of enterprise applications so that teams can focus on application-level business logic, without unnecessary ties to specific deployment environments.
4
SPRING FRAMEWORK
5
ARCHITECTURAL CONCEPT :: 3 TIER 3 tier - presentation tier - business, domain logic, middle tier - data tier View Controller Model JSP Spring Hibernate
6
SPRING FRAMEWORK useful 1. application developer Make a Java method execute in a database transaction without having to deal with transaction APIs. Dependency Injection and Inversion of Control Aspect-Oriented Programming(AOP) Spring MVC web application and RESTful web service framework Foundation support JDBC, JPA, JMA, JMS, Hibernate Framework
7
DEPENDENCY INJECTION setWriter(obj) ----------------- NiceWriter obj; IWriter obj;
8
DEPENDENCY INJECTION META-INF/beans.xml Main.java
9
SPRING FRAMEWORK prerequisite - Eclipse - Maven or Gradle
10
GRADLE WHAT IS GRADLE? Gradle is an open source build automation system. Gradle can automate the building, testing, publishing, deployment and more of software packages or other types of projects such as generated static websites, generated documentation or indeed anything else. Gradle combines the power and flexibility of Ant with the dependency management and conventions of Maven into a more effective way to build. Powered by Build Programming Language, Gradle is concise yet expressive.AntMaven
11
INSTALLATION GUIDE
13
gradle build
14
INSTALLATION GUIDE
15
TEST JAVA APPLICATION gradle run
16
DEPENDENCY INJECTION
17
gradle clean gradle build gradle run
18
GRADLE WEB APPLICATION create java dynamic website convert java web to gradle reconvert folder src\main\... to java build path
19
GRADLE WEB APPLICATION
22
build.gradle buildscript { repositories { mavenCentral() maven { url "http://repo.spring.io/snapshot" } maven { url "http://repo.spring.io/milestone" } } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:1.1.10.RELEASE") } apply plugin: 'java' apply plugin: 'spring-boot‘ apply plugin: ‘war’ jar { baseName = 'myproject' version = '0.0.1-SNAPSHOT' } repositories { mavenCentral() maven { url "http://repo.spring.io/snapshot" } maven { url "http://repo.spring.io/milestone" } } dependencies { compile("org.springframework.boot:spring-boot-starter-web") testCompile("org.springframework.boot:spring-boot-starter-test") }
23
GRADLE WEB APPLICATION SampleController package com.spring; import org.springframework.boot.*; import org.springframework.boot.autoconfigure.*; import org.springframework.stereotype.*; import org.springframework.web.bind.annotation.*; @Controller @EnableAutoConfiguration public class SampleController { @RequestMapping("/") @ResponseBody String home() { return "Hello World!"; } public static void main(String[] args) throws Exception { SpringApplication.run(SampleController.class, args); } public static void main(String[] args) throws Exception { SpringApplication spring = new SpringApplication(SampleController.class); spring.setShowBanner(false); spring.run(args); }
24
GRADLE WEB APPLICATION export spring-boot to exist tomcat or JEE Server
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.