Nicht aus der Schweiz? Besuchen Sie lehmanns.de
Full Stack AngularJS for Java Developers - Ravi Kant Soni

Full Stack AngularJS for Java Developers (eBook)

Build a Full-Featured Web Application from Scratch Using AngularJS with Spring RESTful

(Autor)

eBook Download: PDF
2017 | 1st ed.
XV, 188 Seiten
Apress (Verlag)
978-1-4842-3198-2 (ISBN)
Systemvoraussetzungen
79,99 inkl. MwSt
(CHF 78,15)
Der eBook-Verkauf erfolgt durch die Lehmanns Media GmbH (Berlin) zum Preis in Euro inkl. MwSt.
  • Download sofort lieferbar
  • Zahlungsarten anzeigen
Get introduced to full stack enterprise development. Whether you are new to AngularJS and Spring RESTful web services, or you are a seasoned expert, you will be able to build a full-featured web application from scratch using AngularJS and Spring RESTful web services. 

Full stack web development is in demand because you can explore the best of different tools and frameworks and yet make your apps solid and reliable in design, scalability, robustness, and security. This book assists you in creating your own full stack development environment that includes the powerful and revamped AngularJS, and Spring REST. The architecture of modern applications is covered to prevent the development of isolated desktop and mobile applications. 

By the time you reach the end of this book you will have built a full-featured dynamic app. You will start your journey by setting up a Spring Boot development environment and creating your RESTful services to perform CRUD operations. Then you will migrate the front-end tools-AngularJS and Bootstrap-into your Spring Boot application to consume RESTful services. You will secure your REST API using Spring Security and consume your secured REST API using AngularJS.

What You'll Learn
  • Build a REST application with Spring Boot
  • Expose CRUD operations using RESTful endpoints
  • Create a single page application by integrating Angular JS and Bootstrap in Spring Boot
  • Secure REST APIs using Spring Security
  • Consume secured RESTful Services using Angular JS
  • Build a REST client using a REST template to consume RESTful services
  • Test RESTful services using the Spring MVC Test Framework

Who This Book Is For

Web application developers with previous Java programming experience who want to create enterprise-grade, scalable Java apps using powerful front tools such as AngularJS and Bootstrap along with popular back-end frameworks such as Spring Boot




Ravi Kant Soni is a Full Stack Java Application Developer and published author of two books, Learning Spring Application Development and Spring: Developing Java Applications for the Enterprise. He completed his bachelor degree (B.E) in information science and engineering from Reva University, Bangalore (India), and schooling from Bal Vikash Vidyalaya, Sasaram, Bihar (India). He is from Lashkariganj (near 'Sher Shah Suri' Tomb), Sasaram, Bihar (India).

Currently, Ravi is working as a Technical Manager. He has worn many hats throughout his tenure, ranging from software development to multi-tenant application design to integration of new technology into an existing system to writing books. He has focused on full stack web application development for most of his career and has been extensively involved in application design and implementation. He has developed applications for banking systems, HR and payroll systems, and e-commerce systems, and also has gained recognition from management for his designing abilities for a premium program. He is well-versed in all aspects of software engineering, including software design, systems architecture, application programming, and automation testing.

Ravi loves problem statements and enjoys brainstorming unique solutions.


Get introduced to full stack enterprise development. Whether you are new to AngularJS and Spring RESTful web services, or you are a seasoned expert, you will be able to build a full-featured web application from scratch using AngularJS and Spring RESTful web services. Full stack web development is in demand because you can explore the best of different tools and frameworks and yet make your apps solid and reliable in design, scalability, robustness, and security. This book assists you in creating your own full stack development environment that includes the powerful and revamped AngularJS, and Spring REST. The architecture of modern applications is covered to prevent the development of isolated desktop and mobile applications. By the time you reach the end of this book you will have built a full-featured dynamic app. You will start your journey by setting up a Spring Boot development environment and creating your RESTful services to perform CRUD operations. Then you will migrate the front-end tools-AngularJS and Bootstrap-into your Spring Boot application to consume RESTful services. You will secure your REST API using Spring Security and consume your secured REST API using AngularJS.What You'll LearnBuild a REST application with Spring BootExpose CRUD operations using RESTful endpointsCreate a single page application by integrating Angular JS and Bootstrap in Spring BootSecure REST APIs using Spring SecurityConsume secured RESTful Services using Angular JSBuild a REST client using a REST template to consume RESTful servicesTest RESTful services using the Spring MVC Test FrameworkWho This Book Is ForWeb application developers with previous Java programming experience who want to create enterprise-grade, scalable Java apps using powerful front tools such as AngularJS and Bootstrap along with popular back-end frameworks such as Spring Boot

Ravi Kant Soni is a Full Stack Java Application Developer and published author of two books, Learning Spring Application Development and Spring: Developing Java Applications for the Enterprise. He completed his bachelor degree (B.E) in information science and engineering from Reva University, Bangalore (India), and schooling from Bal Vikash Vidyalaya, Sasaram, Bihar (India). He is from Lashkariganj (near “Sher Shah Suri” Tomb), Sasaram, Bihar (India).Currently, Ravi is working as a Technical Manager. He has worn many hats throughout his tenure, ranging from software development to multi-tenant application design to integration of new technology into an existing system to writing books. He has focused on full stack web application development for most of his career and has been extensively involved in application design and implementation. He has developed applications for banking systems, HR and payroll systems, and e-commerce systems, and also has gained recognition from management for his designing abilities for a premium program. He is well-versed in all aspects of software engineering, including software design, systems architecture, application programming, and automation testing. Ravi loves problem statements and enjoys brainstorming unique solutions.

Contents 6
About the Author 11
About the Technical Reviewer 12
Acknowledgments 13
Chapter 1: The Big Picture of Full Stack Web Development 14
What Is a Full Stack Developer? 14
Full Stack Web Development 16
Architecture of Modern Web Applications 17
Front End vs. Back End 19
Front-End Framework 20
AngularJS as a Front-End Framework 20
AngularJS Version 20
AngularJS Architecture Concepts 21
MVC Architecture 22
Twitter Bootstrap 23
Back-End Framework 23
Spring Boot as a Back-End Framework 23
Spring Framework Problems and Spring Boot Advantages 24
Primary Goals of Spring Boot 24
Develop Your First Spring Boot Application 25
System Requirements 25
Using the Spring Boot CLI 25
Using Spring Initializr 25
Using Spring Tool Suite 28
A Walk-Through of the Code 31
Looking at pom.xml 31
Writing the Code 35
@SpringBootApplication Annotation 35
@RestController and @RequestMapping Annotations 36
The main Method 36
Running a Spring Boot Application in STS 36
Starters 38
Spring Boot Actuator: Production-Ready Features 38
Enabling Actuator 38
Running the Application 39
Using Actuator Endpoints 39
Customizing the Management Server Port 39
Getting Health Information 40
Summary 40
Chapter 2: Creating the RESTful Layer for Your Application 41
Introduction to REST 41
HTTP Methods and CRUD Operations 41
HTTP Status Codes 42
Build a RESTful Service: UserRegistrationSystem 42
Introducing UserRegistrationSystem 42
Identifying REST Endpoints 43
JSON Format 43
Creating the UserRegistrationSystem Application 44
Embedded Database: H2 45
Domain Implementation: Users 45
Repository Implementation: UserJpaRepository 46
Build a RESTful API 47
Create a RESTful Controller: UserRegistrationRestController 49
@GetMapping: Retrieve All Users 50
@PostMapping: Create a New User 51
@GetMapping ("/ {id}"): Retrieve an Individual User 52
@PutMapping: Update a User 53
@DeleteMapping: Delete a User 54
Handle Errors in a RESTful API 55
UserRegistrationSystem Error Handling 55
Custom Error Response 57
Validating Request Body 59
Adding the Bean Validation Annotations 59
@Valid on @RequestBody in UserRegistrationRestController Method Arguments 61
ValidationError and Updated ErrorDetail Classes 63
Handling Exceptions Using the @ControllerAdvice Annotation 65
Externalizing Error Messages 67
Create ReloadableResourceBundleMessageSource Bean: messageSource 67
Create a Properties File 68
Bean Validation Annotation with the message Attribute 69
Reading Messages from the Properties File 70
Summary 72
Chapter 3: Setting Up AngularJS: Creating Your Single-Page Application 73
Introducing AngularJS as a Front-End Framework 73
AngularJS Basic Components 74
AngularJS Life Cycle 74
Bootstrap Phase 75
Compilation Phase 75
Runtime Data Binding Phase 75
AngularJS Architecture Concepts 75
MVC Architecture 76
Setting Up Your Development Environment 78
Adding AngularJS to Spring Boot 78
Including Angular Scripts from the Google CDN 78
Downloading and Hosting Angular Files Locally 79
Providing Dependency Information in pom.xml 80
Adding Twitter Bootstrap to Spring Boot 81
Developing Your Single-Page Application 81
Bootstrapping the Application 82
Dependency Injection 82
AngularJS Routes 83
AngularJS Templates 83
Implementing the Model, View, and Controller in Your Single-Page Application 84
Create the Home/Application Page 85
Create the View Pages 87
Home Page 87
Register New User Page 88
List of Users 91
Update Existing User 93
Create an AngularJS Application 95
Create an AngularJS Controller 96
Running a Spring Boot Application in STS 98
Summary 104
Chapter 4: Securing Your RESTful API Using Spring Security 105
Introducing Spring Security 105
Authentication and Authorization 105
Introducing Basic Authentication 106
BasicAuthenticationFilter 106
Enabling Spring Security on RESTful Services 106
What Is the Spring Boot Security Starter? 107
Updating the pom.xml File with the Spring Security Dependency 107
Overriding the Spring Security Defaults 110
Customizing User Authentication 112
Authentication Customization with an In-Memory Definition 113
Running the UserRegistrationSystem Application 114
Authentication Customization Against a Relational Database 119
UserDetailsService Implementation 121
Customizing Spring Security and Securing the URI 122
Method-Level Security 124
Summary 125
Chapter 5: Consuming Secured RESTful Services Using AngularJS 126
Enabling Basic Authentication in Spring Security 126
Sending an Authorization Header with Each Request in AngularJS 128
Adding the HTTP Interceptor in AngularJS 128
authInterceptor.js 129
Updating app.js 130
Updating index.html 130
Running the Application 131
HTTP Request with Basic Authentication Header: Verify in Developer Tools 132
The Login Page 133
Updating index.html: Adding Navigation to the Welcome Page 134
Updating app.js: Adding Navigation to the Angular Application 135
Creating login.html: The Login Form 136
Updating controller.js for the Login and Logout Authentication Process 138
Updating the Back-End Code 140
Creating a New RESTful Endpoint to Get the Currently Authenticated User 140
Updating the Spring Security Configuration to Handle Login Requests 141
Running the Application 142
Summary 144
Chapter 6: Building a RESTful Client and Testing RESTful Services 145
Building a REST Client Using RestTemplate 145
RestTemplate 145
RestTemplate Method 146
RestTemplate Operation 146
HTTP GET Request with Parameter to Retrieve User 146
HTTP POST Request with JSON Data to Create an User 149
HTTP PUT Request with Parameter to Update User 150
HTTP DELETE with Parameter to Delete User 152
The RestTemplate Exchange API 153
Basic Authentication with RestTemplate 154
Testing RESTful Services Using the Spring Test Framework 155
What Is Testing? 155
Testing Using JUnit4 156
JUnit 4 Annotations 156
JUnit 4 Assert Methods 156
Example: Implementing JUnit 4 157
Agile Software Testing 159
Unit Testing 160
Unit Testing for the Dependent Class with a Mocking Object 160
The Mockito Framework 161
Integration Testing 161
Testing the Spring Boot Application 162
Maven Dependency 162
Annotations in Spring Testing 162
Unit Testing REST Controller 164
Testing the Web Layer Using the Spring MVC Test Framework 166
MockMvc 166
Summary 170
Chapter 7: Application Monitoring Using Spring Boot Actuator 171
Introducing Spring Boot Actuator 172
Enabling the Actuator Module 172
Actuator Endpoints 173
/info 174
/env 175
/metrics 175
/trace 177
/health 178
Customizing an Actuator Endpoint 178
Properties to Customize 179
Custom Health Indicator 180
Defining New Endpoints 182
Management Over HTTP 183
Customizing the Server Port 183
Accessing a Sensitive Endpoint 184
Summary 184
Appendix A:Tools for Accessing REST APIs 185
API Testing 185
API Testing Tools 185
Postman 185
Functions in Postman 188
Request URL 188
HTTP Method 188
Parameters 189
Authorization 190
Headers 190
Body 191
Send 191
Response Message 191
Body 192
Cookies 192
Headers 192
Tests 192
Other Features 193
Index 194

Erscheint lt. Verlag 4.12.2017
Zusatzinfo XV, 188 p. 112 illus., 110 illus. in color.
Verlagsort Berkeley
Sprache englisch
Themenwelt Informatik Programmiersprachen / -werkzeuge Java
Mathematik / Informatik Informatik Web / Internet
Schlagworte AngularJS • angularjs for Java • angularJS java • full stack • full stack javascript • real-time apps • Spring • Spring Boot • Spring Framework • Spring MVC
ISBN-10 1-4842-3198-8 / 1484231988
ISBN-13 978-1-4842-3198-2 / 9781484231982
Haben Sie eine Frage zum Produkt?
PDFPDF (Wasserzeichen)
Größe: 9,1 MB

DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasser­zeichen und ist damit für Sie persona­lisiert. Bei einer missbräuch­lichen Weiter­gabe des eBooks an Dritte ist eine Rück­ver­folgung an die Quelle möglich.

Dateiformat: PDF (Portable Document Format)
Mit einem festen Seiten­layout eignet sich die PDF besonders für Fach­bücher mit Spalten, Tabellen und Abbild­ungen. Eine PDF kann auf fast allen Geräten ange­zeigt werden, ist aber für kleine Displays (Smart­phone, eReader) nur einge­schränkt geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.

Zusätzliches Feature: Online Lesen
Dieses eBook können Sie zusätzlich zum Download auch online im Webbrowser lesen.

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

Mehr entdecken
aus dem Bereich
Einführung, Ausbildung, Praxis

von Christian Ullenboom

eBook Download (2023)
Rheinwerk Computing (Verlag)
CHF 36,55
Moderne GUIs für RIAs und Java-Applikationen

von Ralph Steyer

eBook Download (2022)
Springer Fachmedien Wiesbaden (Verlag)
CHF 41,95