实例介绍
【实例简介】spring实战第五版源码_102812
【实例截图】
【核心代码】
contents preface xiii acknowledgments xv about this book xvii PART 1FOUNDATIONAL SPRING ......................................1 1 Getting started with Spring 3 1.1 What is Spring? 4 1.2 Initializing a Spring application 6 Initializing a Spring project with Spring Tool Suite 7 Examining the Spring project structure 11 1.3 Writing a Spring application 17 Handling web requests 17 ■ Defining the view 19 Testing the controller 20 ■ Building and running the application 21 ■ Getting to know Spring Boot DevTools 23 Let’s review 25 1.4 Surveying the Spring landscape 26 The core Spring Framework 26 ■ Spring Boot 26 Spring Data 27 ■ Spring Security 27 ■ Spring Integration and Spring Batch 27 ■ Spring Cloud 28 vi CONTENTS 2 Developing web applications 29 2.1 Displaying information 30 Establishing the domain 31 ■ Creating a controller class 32 Designing the view 35 2.2 Processing form submission 40 2.3 Validating form input 45 Declaring validation rules 46 ■ Performing validation at form binding 48 ■ Displaying validation errors 49 2.4 Working with view controllers 51 2.5 Choosing a view template library 52 Caching templates 54 3 Working with data 56 3.1 Reading and writing data with JDBC 57 Adapting the domain for persistence 59 ■ Working with JdbcTemplate 60 ■ Defining a schema and preloading data 64 Inserting data 66 3.2 Persisting data with Spring Data JPA 75 Adding Spring Data JPA to the project 76 ■ Annotating the domain as entities 76 ■ Declaring JPA repositories 80 Customizing JPA repositories 81 4 Securing Spring 84 4.1 Enabling Spring Security 85 4.2 Configuring Spring Security 86 In-memory user store 88 ■ JDBC-based user store 89 LDAP-backed user store 92 ■ Customizing user authentication 96 4.3 Securing web requests 103 Securing requests 104 ■ Creating a custom login page 106 Logging out 109 ■ Preventing cross-site request forgery 109 4.4 Knowing your user 110 5 Working with configuration properties 114 5.1 Fine-tuning autoconfiguration 115 Understanding Spring’s environment abstraction 116 Configuring a data source 117 ■ Configuring the embedded server 119 ■ Configuring logging 120 ■ Using special property values 121 CONTENTS vii 5.2 Creating your own configuration properties 122 Defining configuration properties holders 124 ■ Declaring configuration property metadata 126 5.3 Configuring with profiles 129 Defining profile-specific properties 130 ■ Activating profiles 131 Conditionally creating beans with profiles 132 PART 2INTEGRATED SPRING .......................................135 6 Creating REST services 137 6.1 Writing RESTful controllers 138 Retrieving data from the server 140 ■ Sending data to the server 145 ■ Updating data on the server 146 ■ Deleting data from the server 148 6.2 Enabling hypermedia 149 Adding hyperlinks 152 ■ Creating resource assemblers 154 Naming embedded relationships 159 6.3 Enabling data-backed services 160 Adjusting resource paths and relation names 162 ■ Paging and sorting 164 ■ Adding custom endpoints 165 ■ Adding custom hyperlinks to Spring Data endpoints 167 7 Consuming REST services 169 7.1 Consuming REST endpoints with RestTemplate 170 GETting resources 172 ■ PUTting resources 173 DELETEing resources 174 ■ POSTing resource data 174 7.2 Navigating REST APIs with Traverson 175 8 Sending messages asynchronously 178 8.1 Sending messages with JMS 179 Setting up JMS 179 ■ Sending messages with JmsTemplate 181 Receiving JMS messages 188 8.2 Working with RabbitMQ and AMQP 192 Adding RabbitMQ to Spring 193 ■ Sending messages with RabbitTemplate 194 ■ Receiving message from RabbitMQ 198 8.3 Messaging with Kafka 202 Setting up Spring for Kafka messaging 203 ■ Sending messages with KafkaTemplate 204 ■ Writing Kafka listeners 206 viii CONTENTS 9 Integrating Spring 209 9.1 Declaring a simple integration flow 210 Defining integration flows with XML 211 ■ Configuring integration flows in Java 213 ■ Using Spring Integration’s DSL configuration 215 9.2 Surveying the Spring Integration landscape 216 Message channels 217 ■ Filters 219 ■ Transformers 220 Routers 221 ■ Splitters 223 ■ Service activators 225 Gateways 227 ■ Channel adapters 228 ■ Endpoint modules 230 9.3 Creating an email integration flow 231 PART 3REACTIVE SPRING ...........................................239 10 Introducing Reactor 241 10.1 Understanding reactive programming 242 Defining Reactive Streams 243 10.2 Getting started with Reactor 245 Diagramming reactive flows 246 ■ Adding Reactor dependencies 247 10.3 Applying common reactive operations 248 Creating reactive types 249 ■ Combining reactive types 253 Transforming and filtering reactive streams 257 ■ Performing logic operations on reactive types 266 11 Developing reactive APIs 269 11.1 Working with Spring WebFlux 269 Introducing Spring WebFlux 271 ■ Writing reactive controllers 272 11.2 Defining functional request handlers 276 11.3 Testing reactive controllers 279 Testing GET requests 279 ■ Testing POST requests 282 Testing with a live server 284 11.4 Consuming REST APIs reactively 285 GETting resources 285 ■ Sending resources 287 Deleting resources 288 ■ Handling errors 289 Exchanging requests 290 CONTENTS ix 11.5 Securing reactive web APIs 292 Configuring reactive web security 292 ■ Configuring a reactive user details service 294 12 Persisting data reactively 296 12.1 Understanding Spring Data’s reactive story 297 Spring Data reactive distilled 297 ■ Converting between reactive and non-reactive types 298 ■ Developing reactive repositories 300 12.2 Working with reactive Cassandra repositories 300 Enabling Spring Data Cassandra 301 ■ Understanding Cassandra data modeling 303 ■ Mapping domain types for Cassandra persistence 304 ■ Writing reactive Cassandra repositories 309 12.3 Writing reactive MongoDB repositories 312 Enabling Spring Data MongoDB 312 ■ Mapping domain types to documents 314 ■ Writing reactive MongoDB repository interfaces 317 PART 4CLOUD-NATIVE SPRING....................................321 13 Discovering services 323 13.1 Thinking in microservices 324 13.2 Setting up a service registry 326 Configuring Eureka 330 ■ Scaling Eureka 333 13.3 Registering and discovering services 334 Configuring Eureka client properties 335 ■ Consuming services 337 14 Managing configuration 343 14.1 Sharing configuration 344 14.2 Running Config Server 345 Enabling Config Server 346 ■ Populating the configuration repository 349 14.3 Consuming shared configuration 352 14.4 Serving application- and profile-specific properties 353 Serving application-specific properties 354 ■ Serving properties from profiles 355 14.5 Keeping configuration properties secret 357 Encrypting properties in Git 357 ■ Storing secrets in Vault 360 x CONTENTS 14.6 Refreshing configuration properties on the fly 364 Manually refreshing configuration properties 365 Automatically refreshing configuration properties 367 15 Handling failure and latency 376 15.1 Understanding circuit breakers 376 15.2 Declaring circuit breakers 378 Mitigating latency 381 ■ Managing circuit breaker thresholds 382 15.3 Monitoring failures 383 Introducing the Hystrix dashboard 384 ■ Understanding Hystrix thread pools 387 15.4 Aggregating multiple Hystrix streams 389 PART 5DEPLOYED SPRING ..........................................393 16 Working with Spring Boot Actuator 395 16.1 Introducing Actuator 396 Configuring Actuator’s base path 397 ■ Enabling and disabling Actuator endpoints 398 16.2 Consuming Actuator endpoints 399 Fetching essential application information 400 ■ Viewing configuration details 403 ■ Viewing application activity 411 Tapping runtime metrics 413 16.3 Customizing Actuator 416 Contributing information to the /info endpoint 416 Defining custom health indicators 421 ■ Registering custom metrics 422 ■ Creating custom endpoints 424 16.4 Securing Actuator 426 17 Administering Spring 429 17.1 Using the Spring Boot Admin 430 Creating an Admin server 430 ■ Registering Admin clients 431 17.2 Exploring the Admin server 435 Viewing general application health and information 436 Watching key metrics 437 ■ Examining environment properties 438 ■ Viewing and setting logging levels 439 Monitoring threads 440 ■ Tracing HTTP requests 441 CONTENTS xi 17.3 Securing the Admin server 442 Enabling login in the Admin server 443 ■ Authenticating with the Actuator 444 18 Monitoring Spring with JMX 446 18.1 Working with Actuator MBeans 446 18.2 Creating your own MBeans 449 18.3 Sending notifications 451 19 Deploying Spring 454 19.1 Weighing deployment options 455 19.2 Building and deploying WAR files 456 19.3 Pushing JAR files to Cloud Foundry 458 19.4 Running Spring Boot in a Docker container 461 19.5 The end is where we begin 465 appendix Bootstrapping Spring applications 466 index 487
好例子网口号:伸出你的我的手 — 分享!
相关软件
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论