自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(8)
  • 资源 (48)
  • 收藏
  • 关注

原创 springmvc 第一课

springmvc4.0demo入门 1、先从导入jar包开始    只要运行一个pringmvc   hello world要导入如下jar包2、jar导入好了之后建一个springmvc的配置文件  springmvc-servlet.xml内容如下xmlns:context="http://www.springframework.org/schema/cont

2015-09-23 22:42:51 359

原创 JavaBeans 组件模型与EJB 组件模型的比较

范中定义了事件监听事件引发和JavaBeans 属性等特征EJB 也定义了一个Java 组件模型但是EJB 组件模型和JavaBeans 组件模型是不同的两个模型首先这两个模型的侧重点不同JavaBeans 组件模型的重点在于允许开发者在Java 集成开发环境中可视化地操纵JavaBeans 组件把若干个JavaBeans 组件拼装成为一个完整的Java 应用程序JavaBeans规范详细地解

2014-07-25 15:56:13 828

翻译 Manifest.permission

Summary: Constants| Ctors| InheritedMethods | [ExpandAll] Added in APIlevel 1 public static final class Manifest.permissionextends Objectjava.lang.Object   ↳andro

2014-07-11 17:39:18 4028

翻译 Manifest

public final classManifestextends Objectjava.lang.Object   ↳android.ManifestSummaryNested ClassesclassManifest.per mission classManifest

2014-07-11 17:09:41 576

转载 设计模式之Proxy(代理)

设计模式之Proxy(代理)板桥里人banq http://www.jdon.com 理解并使用设计模式,能够培养我们良好的面向对象编程习惯,同时在实际应用中,可以如鱼得水,享受游刃有余的乐趣.代理模式是比较有用途的一种模式,而且变种较多,应用场合覆盖从小结构到整个系统的大结构,Proxy是代理的意思,我们也许有代理服务器等概念,代理概念可以解释为:在出发点到目的地之间有一道中间层,意

2013-05-08 23:43:54 430

转载 设计模式之Singleton(单态)

单态定义:Singleton模式主要作用是保证在Java应用程序中,一个类Class只有一个实例存在。 在很多操作中,比如建立目录 数据库连接都需要这样的单线程操作。还有, singleton能够被状态化; 这样,多个单态类在一起就可以作为一个状态仓库一样向外提供服务,比如,你要论坛中的帖子计数器,每次浏览一次需要计数,单态类能否保持住这个计数,并且能synchronize的安全自动加

2013-05-08 23:26:31 520

转载 设计模式之Prototype(原型)

设计模式之Prototype(原型)板桥里人 http://www.jdon.com原型模式定义:用原型实例指定创建对象的种类,并且通过拷贝这些原型创建新的对象.Prototype模式允许一个对象再创建另外一个可定制的对象,根本无需知道任何如何创建的细节,工作原理是:通过将一个原型对象传给那个要发动创建的对象,这个要发动创建的对象通过请求原型对象拷贝它们自己来实施创建。

2013-05-08 23:17:15 499

转载 设计模式之Factory

设计模式之Factory板桥里人 http://www.jdon.com工厂模式定义:提供创建对象的接口.为何使用?工厂模式是我们最常用的模式了,著名的Jive论坛 ,就大量使用了工厂模式,工厂模式在Java程序系统可以说是随处可见。为什么工厂模式是如此常用?因为工厂模式就相当于创建实例对象的new,我们经常要根据类Class生成实例对象,如A a=new A() 工厂模式

2013-05-08 23:11:39 454

水利信息智能化建设整体解决方案.pptx

水利信息智能化建设整体解决方案 项目背景与目标 基础设施建设规划 智能监测与控制系统设计 数据管理与分析应用平台构建 信息安全保障体系建设 培训推广与运维服务体系建设

2024-04-29

第一本Docker书 PDF电子书下载 带书签目录 完整版

Docker 是可移植(或者说跨平台)的,可以在各种主流Linux 发布版或者OS X 以及 Windows 上(需要使用boot2docker 或者虚拟机)使用。Java 可以做到“一次编译,到处运行”,而Docker 则可以称为“构建一次,在各平台上运行”(Build once,run anywhere)。 从这一点可以豪不夸张地说,Docker 是革命性的,它重新定义了软件开发、测试、交付和部署的流程。我们交付的东西不再只是代码、配置文件、数据库定义等,而是整个应用程序运行环境:“OS+各种中间件、类库+应用程序代码”。

2017-03-22

spring-framework-reference-4.1.2

Not Using Commons Logging ................................................................... 12 Using SLF4J ............................................................................................ 13 Using Log4J ............................................................................................. 14 II. What’s New in Spring Framework 4.x .................................................................................... 16 3. New Features and Enhancements in Spring Framework 4.0 ............................................ 17 3.1. Improved Getting Started Experience .................................................................. 17 3.2. Removed Deprecated Packages and Methods .................................................... 17 3.3. Java 8 (as well as 6 and 7) ............................................................................... 17 3.4. Java EE 6 and 7 ............................................................................................... 18 3.5. Groovy Bean Definition DSL .............................................................................. 18 3.6. Core Container Improvements ............................................................................ 19 3.7. General Web Improvements ............................................................................... 19 3.8. WebSocket, SockJS, and STOMP Messaging ..................................................... 19 3.9. Testing Improvements ........................................................................................ 20 III. Core Technologies .............................................................................................................. 21 4. The IoC container ........................................................................................................ 22 4.1. Introduction to the Spring IoC container and beans .............................................. 22 4.2. Container overview ............................................................................................ 22 Configuration metadata ..................................................................................... 23 Instantiating a container .................................................................................... 24 Composing XML-based configuration metadata .......................................... 25 Using the container .......................................................................................... 26 4.3. Bean overview ................................................................................................... 27 Naming beans .................................................................................................. 28 Aliasing a bean outside the bean definition ................................................ 28 Instantiating beans ........................................................................................... 29 Instantiation with a constructor .................................................................. 29 Instantiation with a static factory method .................................................... 30 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation iii Instantiation using an instance factory method ........................................... 30 4.4. Dependencies ................................................................................................... 32 Dependency injection ....................................................................................... 32 Constructor-based dependency injection .................................................... 32 Setter-based dependency injection ............................................................ 34 Dependency resolution process ................................................................. 35 Examples of dependency injection ............................................................. 36 Dependencies and configuration in detail ........................................................... 38 Straight values (primitives, Strings, and so on) ........................................... 38 References to other beans (collaborators) .................................................. 40 Inner beans .............................................................................................. 41 Collections ............................................................................................... 41 Null and empty string values ..................................................................... 44 XML shortcut with the p-namespace .......................................................... 44 XML shortcut with the c-namespace .......................................................... 46 Compound property names ....................................................................... 46 Using depends-on ............................................................................................ 47 Lazy-initialized beans ....................................................................................... 47 Autowiring collaborators .................................................................................... 48 Limitations and disadvantages of autowiring ............................................... 49 Excluding a bean from autowiring .............................................................. 50 Method injection ............................................................................................... 50 Lookup method injection ........................................................................... 51 Arbitrary method replacement ................................................................... 53 4.5. Bean scopes ..................................................................................................... 54 The singleton scope ......................................................................................... 55 The prototype scope ......................................................................................... 55 Singleton beans with prototype-bean dependencies ............................................ 56 Request, session, and global session scopes .................................................... 56 Initial web configuration ............................................................................ 57 Request scope ......................................................................................... 58 Session scope .......................................................................................... 58 Global session scope ............................................................................... 58 Scoped beans as dependencies ................................................................ 58 Custom scopes ................................................................................................ 60 Creating a custom scope .......................................................................... 60 Using a custom scope .............................................................................. 61 4.6. Customizing the nature of a bean ....................................................................... 62 Lifecycle callbacks ............................................................................................ 62 Initialization callbacks ............................................................................... 63 Destruction callbacks ................................................................................ 64 Default initialization and destroy methods .................................................. 64 Combining lifecycle mechanisms ............................................................... 66 Startup and shutdown callbacks ................................................................ 66 Shutting down the Spring IoC container gracefully in non-web applications ................................................................................................................. 68 ApplicationContextAware and BeanNameAware ................................................. 68 Other Aware interfaces ..................................................................................... 69 4.7. Bean definition inheritance ................................................................................. 71 4.8. Container Extension Points ................................................................................ 72 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation iv Customizing beans using a BeanPostProcessor ................................................. 72 Example: Hello World, BeanPostProcessor-style ........................................ 74 Example: The RequiredAnnotationBeanPostProcessor ............................... 75 Customizing configuration metadata with a BeanFactoryPostProcessor ................ 75 Example: the Class name substitution PropertyPlaceholderConfigurer .......... 76 Example: the PropertyOverrideConfigurer .................................................. 77 Customizing instantiation logic with a FactoryBean ............................................. 78 4.9. Annotation-based container configuration ............................................................ 79 @Required ....................................................................................................... 80 @Autowired ..................................................................................................... 80 Fine-tuning annotation-based autowiring with qualifiers ....................................... 83 Using generics as autowiring qualifiers .............................................................. 89 CustomAutowireConfigurer ................................................................................ 90 @Resource ...................................................................................................... 90 @PostConstruct and @PreDestroy .................................................................... 92 4.10. Classpath scanning and managed components ................................................. 92 @Component and further stereotype annotations ............................................... 93 Meta-annotations .............................................................................................. 93 Automatically detecting classes and registering bean definitions .......................... 94 Using filters to customize scanning ................................................................... 95 Defining bean metadata within components ....................................................... 96 Naming autodetected components ..................................................................... 97 Providing a scope for autodetected components ................................................ 98 Providing qualifier metadata with annotations ..................................................... 99 4.11. Using JSR 330 Standard Annotations ............................................................... 99 Dependency Injection with @Inject and @Named ............................................. 100 @Named: a standard equivalent to the @Component annotation ....................... 100 Limitations of the standard approach ............................................................... 101 4.12. Java-based container configuration ................................................................. 102 Basic concepts: @Bean and @Configuration ................................................... 102 Instantiating the Spring container using AnnotationConfigApplicationContext ....... 103 Simple construction ................................................................................ 103 Building the container programmatically using register(Class<?>…) ........... 104 Enabling component scanning with scan(String…) .................................... 104 Support for web applications with AnnotationConfigWebApplicationContext ............................................................................................................... 105 Using the @Bean annotation .......................................................................... 106 Declaring a bean .................................................................................... 107 Receiving lifecycle callbacks ................................................................... 107 Specifying bean scope ............................................................................ 108 Customizing bean naming ....................................................................... 109 Bean aliasing ......................................................................................... 109 Bean description ..................................................................................... 110 Using the @Configuration annotation ............................................................... 110 Injecting inter-bean dependencies ............................................................ 110 Lookup method injection ......................................................................... 111 Further information about how Java-based configuration works internally .... 111 Composing Java-based configurations ............................................................. 112 Using the @Import annotation ................................................................. 112 Conditionally including @Configuration classes or @Beans ....................... 116 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation v Combining Java and XML configuration ................................................... 117 4.13. Bean definition profiles and environment abstraction ........................................ 120 4.14. PropertySource Abstraction ............................................................................ 120 4.15. Registering a LoadTimeWeaver ...................................................................... 120 4.16. Additional Capabilities of the ApplicationContext .............................................. 120 Internationalization using MessageSource ........................................................ 121 Standard and Custom Events .......................................................................... 124 Convenient access to low-level resources ........................................................ 127 Convenient ApplicationContext instantiation for web applications ....................... 128 Deploying a Spring ApplicationContext as a J2EE RAR file ............................... 128 4.17. The BeanFactory ........................................................................................... 129 BeanFactory or ApplicationContext? ................................................................ 129 Glue code and the evil singleton ..................................................................... 131 5. Resources .................................................................................................................. 132 5.1. Introduction ..................................................................................................... 132 5.2. The Resource interface .................................................................................... 132 5.3. Built-in Resource implementations .................................................................... 133 UrlResource ................................................................................................... 133 ClassPathResource ........................................................................................ 133 FileSystemResource ....................................................................................... 134 ServletContextResource .................................................................................. 134 InputStreamResource ..................................................................................... 134 ByteArrayResource ......................................................................................... 134 5.4. The ResourceLoader ....................................................................................... 134 5.5. The ResourceLoaderAware interface ................................................................ 135 5.6. Resources as dependencies ............................................................................. 136 5.7. Application contexts and Resource paths .......................................................... 137 Constructing application contexts ..................................................................... 137 Constructing ClassPathXmlApplicationContext instances - shortcuts .......... 137 Wildcards in application context constructor resource paths ............................... 138 Ant-style Patterns ................................................................................... 138 The Classpath*: portability classpath*: prefix ............................................ 139 Other notes relating to wildcards ............................................................. 139 FileSystemResource caveats .......................................................................... 140 6. Validation, Data Binding, and Type Conversion ............................................................ 141 6.1. Introduction ..................................................................................................... 141 6.2. Validation using Spring’s Validator interface ...................................................... 141 6.3. Resolving codes to error messages .................................................................. 143 6.4. Bean manipulation and the BeanWrapper ......................................................... 144 Setting and getting basic and nested properties ............................................... 144 Built-in PropertyEditor implementations ............................................................ 146 Registering additional custom PropertyEditors .......................................... 149 6.5. Spring Type Conversion ................................................................................... 151 Converter SPI ................................................................................................ 151 ConverterFactory ............................................................................................ 152 GenericConverter ........................................................................................... 153 ConditionalGenericConverter ................................................................... 154 ConversionService API ................................................................................... 154 Configuring a ConversionService ..................................................................... 154 Using a ConversionService programmatically ................................................... 155 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation vi 6.6. Spring Field Formatting .................................................................................... 155 Formatter SPI ................................................................................................. 156 Annotation-driven Formatting ........................................................................... 157 Format Annotation API ............................................................................ 158 FormatterRegistry SPI ..................................................................................... 159 FormatterRegistrar SPI ................................................................................... 159 Configuring Formatting in Spring MVC ............................................................. 159 6.7. Configuring a global date & time format ............................................................ 161 6.8. Spring Validation ............................................................................................. 163 Overview of the JSR-303 Bean Validation API ................................................. 163 Configuring a Bean Validation Provider ............................................................ 164 Injecting a Validator ................................................................................ 164 Configuring Custom Constraints .............................................................. 164 Additional Configuration Options .............................................................. 165 Configuring a DataBinder ................................................................................ 165 Spring MVC 3 Validation ................................................................................. 166 Triggering @Controller Input Validation .................................................... 166 Configuring a Validator for use by Spring MVC ......................................... 166 Configuring a JSR-303/JSR-349 Validator for use by Spring MVC .............. 167 7. Spring Expression Language (SpEL) ........................................................................... 168 7.1. Introduction ..................................................................................................... 168 7.2. Feature Overview ............................................................................................ 168 7.3. Expression Evaluation using Spring’s Expression Interface ................................. 169 The EvaluationContext interface ...................................................................... 171 Type Conversion .................................................................................... 171 7.4. Expression support for defining bean definitions ................................................ 172 XML based configuration ................................................................................ 172 Annotation-based configuration ........................................................................ 173 7.5. Language Reference ........................................................................................ 174 Literal expressions .......................................................................................... 174 Properties, Arrays, Lists, Maps, Indexers ......................................................... 174 Inline lists ....................................................................................................... 175 Array construction ........................................................................................... 175 Methods ......................................................................................................... 176 Operators ....................................................................................................... 176 Relational operators ................................................................................ 176 Logical operators .................................................................................... 177 Mathematical operators ........................................................................... 177 Assignment .................................................................................................... 178 Types ............................................................................................................. 178 Constructors ................................................................................................... 179 Variables ........................................................................................................ 179 The #this and #root variables .................................................................. 179 Functions ....................................................................................................... 180 Bean references ............................................................................................. 180 Ternary Operator (If-Then-Else) ....................................................................... 180 The Elvis Operator ......................................................................................... 181 Safe Navigation operator ................................................................................ 181 Collection Selection ........................................................................................ 182 Collection Projection ....................................................................................... 182 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation vii Expression templating ..................................................................................... 183 7.6. Classes used in the examples .......................................................................... 183 8. Aspect Oriented Programming with Spring ................................................................... 187 8.1. Introduction ..................................................................................................... 187 AOP concepts ................................................................................................ 187 Spring AOP capabilities and goals ................................................................... 189 AOP Proxies .................................................................................................. 190 8.2. @AspectJ support ........................................................................................... 190 Enabling @AspectJ Support ............................................................................ 190 Enabling @AspectJ Support with Java configuration ................................. 190 Enabling @AspectJ Support with XML configuration ................................. 191 Declaring an aspect ........................................................................................ 191 Declaring a pointcut ........................................................................................ 192 Supported Pointcut Designators .............................................................. 192 Combining pointcut expressions .............................................................. 194 Sharing common pointcut definitions ........................................................ 194 Examples ............................................................................................... 196 Writing good pointcuts ............................................................................ 198 Declaring advice ............................................................................................. 199 Before advice ......................................................................................... 199 After returning advice .............................................................................. 200 After throwing advice .............................................................................. 200 After (finally) advice ................................................................................ 201 Around advice ........................................................................................ 202 Advice parameters .................................................................................. 203 Advice ordering ...................................................................................... 206 Introductions ................................................................................................... 206 Aspect instantiation models ............................................................................. 207 Example ......................................................................................................... 208 8.3. Schema-based AOP support ............................................................................ 209 Declaring an aspect ........................................................................................ 210 Declaring a pointcut ........................................................................................ 210 Declaring advice ............................................................................................. 212 Before advice ......................................................................................... 212 After returning advice .............................................................................. 212 After throwing advice .............................................................................. 213 After (finally) advice ................................................................................ 214 Around advice ........................................................................................ 214 Advice parameters .................................................................................. 215 Advice ordering ...................................................................................... 216 Introductions ................................................................................................... 217 Aspect instantiation models ............................................................................. 217 Advisors ......................................................................................................... 217 Example ......................................................................................................... 218 8.4. Choosing which AOP declaration style to use .................................................... 220 Spring AOP or full AspectJ? ........................................................................... 220 @AspectJ or XML for Spring AOP? ................................................................. 221 8.5. Mixing aspect types ......................................................................................... 222 8.6. Proxying mechanisms ...................................................................................... 222 Understanding AOP proxies ............................................................................ 223 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation viii 8.7. Programmatic creation of @AspectJ Proxies ..................................................... 225 8.8. Using AspectJ with Spring applications ............................................................. 225 Using AspectJ to dependency inject domain objects with Spring ........................ 226 Unit testing @Configurable objects .......................................................... 228 Working with multiple application contexts ................................................ 228 Other Spring aspects for AspectJ .................................................................... 229 Configuring AspectJ aspects using Spring IoC ................................................. 229 Load-time weaving with AspectJ in the Spring Framework ................................. 230 A first example ....................................................................................... 231 Aspects .................................................................................................. 234 ' META-INF/aop.xml' ............................................................................... 234 Required libraries (JARS) ........................................................................ 234 Spring configuration ................................................................................ 235 Environment-specific configuration ........................................................... 237 8.9. Further Resources ........................................................................................... 239 9. Spring AOP APIs ....................................................................................................... 240 9.1. Introduction ..................................................................................................... 240 9.2. Pointcut API in Spring ...................................................................................... 240 Concepts ........................................................................................................ 240 Operations on pointcuts .................................................................................. 241 AspectJ expression pointcuts .......................................................................... 241 Convenience pointcut implementations ............................................................ 241 Static pointcuts ....................................................................................... 241 Dynamic pointcuts .................................................................................. 242 Pointcut superclasses ..................................................................................... 243 Custom pointcuts ............................................................................................ 243 9.3. Advice API in Spring ........................................................................................ 243 Advice lifecycles ............................................................................................. 243 Advice types in Spring .................................................................................... 244 Interception around advice ...................................................................... 244 Before advice ......................................................................................... 244 Throws advice ........................................................................................ 245 After Returning advice ............................................................................ 246 Introduction advice .................................................................................. 247 9.4. Advisor API in Spring ....................................................................................... 249 9.5. Using the ProxyFactoryBean to create AOP proxies ........................................... 250 Basics ............................................................................................................ 250 JavaBean properties ....................................................................................... 250 JDK- and CGLIB-based proxies ...................................................................... 251 Proxying interfaces ......................................................................................... 252 Proxying classes ............................................................................................ 254 Using global advisors ...................................................................................... 255 9.6. Concise proxy definitions ................................................................................. 255 9.7. Creating AOP proxies programmatically with the ProxyFactory ............................ 256 9.8. Manipulating advised objects ............................................................................ 257 9.9. Using the "auto-proxy" facility ........................................................................... 258 Autoproxy bean definitions .............................................................................. 258 BeanNameAutoProxyCreator ................................................................... 259 DefaultAdvisorAutoProxyCreator .............................................................. 259 AbstractAdvisorAutoProxyCreator ............................................................ 260 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation ix Using metadata-driven auto-proxying ............................................................... 260 9.10. Using TargetSources ...................................................................................... 262 Hot swappable target sources ......................................................................... 263 Pooling target sources .................................................................................... 263 Prototype target sources ................................................................................. 265 ThreadLocal target sources ............................................................................. 265 9.11. Defining new Advice types ............................................................................. 265 9.12. Further resources ........................................................................................... 266 10. Testing ..................................................................................................................... 267 10.1. Introduction to Spring Testing ......................................................................... 267 10.2. Unit Testing ................................................................................................... 267 Mock Objects ................................................................................................. 267 Environment ........................................................................................... 267 JNDI ...................................................................................................... 267 Servlet API ............................................................................................. 267 Portlet API ............................................................................................. 268 Unit Testing support Classes .......................................................................... 268 General utilities ...................................................................................... 268 Spring MVC ........................................................................................... 268 10.3. Integration Testing ......................................................................................... 268 Overview ........................................................................................................ 268 Goals of Integration Testing ............................................................................ 269 Context management and caching ........................................................... 269 Dependency Injection of test fixtures ....................................................... 269 Transaction management ........................................................................ 270 Support classes for integration testing ..................................................... 270 JDBC Testing Support .................................................................................... 271 Annotations .................................................................................................... 271 Spring Testing Annotations ..................................................................... 271 Standard Annotation Support .................................................................. 276 Spring JUnit Testing Annotations ............................................................. 277 Meta-Annotation Support for Testing ........................................................ 278 Spring TestContext Framework ....................................................................... 279 Key abstractions ..................................................................................... 280 Context management .............................................................................. 281 Dependency injection of test fixtures ........................................................ 297 Testing request and session scoped beans .............................................. 299 Transaction management ........................................................................ 301 TestContext Framework support classes .................................................. 304 Spring MVC Test Framework .......................................................................... 306 Server-Side Tests ................................................................................... 306 Client-Side REST Tests .......................................................................... 312 PetClinic Example .......................................................................................... 313 10.4. Further Resources ......................................................................................... 314 IV. Data Access ..................................................................................................................... 316 11. Transaction Management .......................................................................................... 317 11.1. Introduction to Spring Framework transaction management .............................. 317 11.2. Advantages of the Spring Framework’s transaction support model ..................... 317 Global transactions ......................................................................................... 317 Local transactions ........................................................................................... 318 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation x Spring Framework’s consistent programming model ......................................... 318 11.3. Understanding the Spring Framework transaction abstraction ............................ 319 11.4. Synchronizing resources with transactions ....................................................... 323 High-level synchronization approach ................................................................ 323 Low-level synchronization approach ................................................................. 323 TransactionAwareDataSourceProxy ................................................................. 324 11.5. Declarative transaction management ............................................................... 324 Understanding the Spring Framework’s declarative transaction implementation ... 325 Example of declarative transaction implementation ........................................... 326 Rolling back a declarative transaction .............................................................. 330 Configuring different transactional semantics for different beans ........................ 331 <tx:advice/> settings ....................................................................................... 333 Using @Transactional ..................................................................................... 335 @Transactional settings .......................................................................... 339 Multiple Transaction Managers with @Transactional ................................. 340 Custom shortcut annotations ................................................................... 341 Transaction propagation .................................................................................. 341 Required ................................................................................................ 342 RequiresNew .......................................................................................... 342 Nested ................................................................................................... 343 Advising transactional operations ..................................................................... 343 Using @Transactional with AspectJ ................................................................. 346 11.6. Programmatic transaction management ........................................................... 347 Using the TransactionTemplate ....................................................................... 347 Specifying transaction settings ................................................................ 349 Using the PlatformTransactionManager ............................................................ 349 11.7. Choosing between programmatic and declarative transaction management ........ 350 11.8. Application server-specific integration .............................................................. 350 IBM WebSphere ............................................................................................. 351 Oracle WebLogic Server ................................................................................. 351 11.9. Solutions to common problems ....................................................................... 351 Use of the wrong transaction manager for a specific DataSource ....................... 351 11.10. Further Resources ....................................................................................... 351 12. DAO support ............................................................................................................ 352 12.1. Introduction .................................................................................................... 352 12.2. Consistent exception hierarchy ....................................................................... 352 12.3. Annotations used for configuring DAO or Repository classes ............................ 353 13. Data access with JDBC ............................................................................................ 355 13.1. Introduction to Spring Framework JDBC .......................................................... 355 Choosing an approach for JDBC database access ........................................... 355 Package hierarchy .......................................................................................... 356 13.2. Using the JDBC core classes to control basic JDBC processing and error handling ................................................................................................................. 357 JdbcTemplate ................................................................................................. 357 Examples of JdbcTemplate class usage ................................................... 357 JdbcTemplate best practices ................................................................... 359 NamedParameterJdbcTemplate ....................................................................... 361 SQLExceptionTranslator .................................................................................. 363 Executing statements ...................................................................................... 365 Running queries ............................................................................................. 365 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation xi Updating the database .................................................................................... 366 Retrieving auto-generated keys ....................................................................... 367 13.3. Controlling database connections .................................................................... 367 DataSource .................................................................................................... 367 DataSourceUtils .............................................................................................. 369 SmartDataSource ........................................................................................... 369 AbstractDataSource ........................................................................................ 369 SingleConnectionDataSource .......................................................................... 369 DriverManagerDataSource .............................................................................. 369 TransactionAwareDataSourceProxy ................................................................. 370 DataSourceTransactionManager ...................................................................... 370 NativeJdbcExtractor ........................................................................................ 370 13.4. JDBC batch operations .................................................................................. 371 Basic batch operations with the JdbcTemplate ................................................. 371 Batch operations with a List of objects ............................................................. 372 Batch operations with multiple batches ............................................................ 373 13.5. Simplifying JDBC operations with the SimpleJdbc classes ................................ 374 Inserting data using SimpleJdbcInsert .............................................................. 374 Retrieving auto-generated keys using SimpleJdbcInsert .................................... 375 Specifying columns for a SimpleJdbcInsert ...................................................... 376 Using SqlParameterSource to provide parameter values ................................... 376 Calling a stored procedure with SimpleJdbcCall ............................................... 377 Explicitly declaring parameters to use for a SimpleJdbcCall ............................... 379 How to define SqlParameters .......................................................................... 380 Calling a stored function using SimpleJdbcCall ................................................. 381 Returning ResultSet/REF Cursor from a SimpleJdbcCall ................................... 381 13.6. Modeling JDBC operations as Java objects ..................................................... 382 SqlQuery ........................................................................................................ 383 MappingSqlQuery ........................................................................................... 383 SqlUpdate ...................................................................................................... 384 StoredProcedure ............................................................................................. 385 13.7. Common problems with parameter and data value handling .............................. 388 Providing SQL type information for parameters ................................................. 389 Handling BLOB and CLOB objects .................................................................. 389 Passing in lists of values for IN clause ............................................................ 390 Handling complex types for stored procedure calls ........................................... 391 13.8. Embedded database support .......................................................................... 392 Why use an embedded database? .................................................................. 392 Creating an embedded database instance using Spring XML ............................ 392 Creating an embedded database instance programmatically .............................. 392 Extending the embedded database support ...................................................... 393 Using HSQL ................................................................................................... 393 Using H2 ........................................................................................................ 393 Using Derby ................................................................................................... 393 Testing data access logic with an embedded database ..................................... 393 13.9. Initializing a DataSource ................................................................................. 394 Initializing a database instance using Spring XML ............................................. 394 Initialization of Other Components that Depend on the Database ............... 395 14. Object Relational Mapping (ORM) Data Access .......................................................... 397 14.1. Introduction to ORM with Spring ..................................................................... 397 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation xii 14.2. General ORM integration considerations ......................................................... 398 Resource and transaction management ........................................................... 398 Exception translation ....................................................................................... 399 14.3. Hibernate ....................................................................................................... 399 SessionFactory setup in a Spring container ...................................................... 400 Implementing DAOs based on plain Hibernate 3 API ........................................ 400 Declarative transaction demarcation ................................................................ 402 Programmatic transaction demarcation ............................................................ 404 Transaction management strategies ................................................................ 405 Comparing container-managed and locally defined resources ............................ 407 Spurious application server warnings with Hibernate ......................................... 408 14.4. JDO .............................................................................................................. 409 PersistenceManagerFactory setup ................................................................... 409 Implementing DAOs based on the plain JDO API ............................................. 410 Transaction management ................................................................................ 412 JdoDialect ...................................................................................................... 413 14.5. JPA ............................................................................................................... 414 Three options for JPA setup in a Spring environment ........................................ 414 LocalEntityManagerFactoryBean .............................................................. 414 Obtaining an EntityManagerFactory from JNDI ......................................... 415 LocalContainerEntityManagerFactoryBean ............................................... 415 Dealing with multiple persistence units ..................................................... 417 Implementing DAOs based on plain JPA .......................................................... 418 Transaction Management ................................................................................ 420 JpaDialect ...................................................................................................... 421 15. Marshalling XML using O/X Mappers ......................................................................... 423 15.1. Introduction .................................................................................................... 423 Ease of configuration ...................................................................................... 423 Consistent Interfaces ...................................................................................... 423 Consistent Exception Hierarchy ....................................................................... 423 15.2. Marshaller and Unmarshaller .......................................................................... 423 Marshaller ...................................................................................................... 423 Unmarshaller .................................................................................................. 424 XmlMappingException ..................................................................................... 425 15.3. Using Marshaller and Unmarshaller ................................................................. 425 15.4. XML Schema-based Configuration .................................................................. 427 15.5. JAXB ............................................................................................................. 427 Jaxb2Marshaller ............................................................................................. 428 XML Schema-based Configuration ........................................................... 428 15.6. Castor ........................................................................................................... 429 CastorMarshaller ............................................................................................ 429 Mapping ......................................................................................................... 429 XML Schema-based Configuration ........................................................... 429 15.7. XMLBeans ..................................................................................................... 430 XmlBeansMarshaller ....................................................................................... 430 XML Schema-based Configuration ........................................................... 430 15.8. JiBX .............................................................................................................. 431 JibxMarshaller ................................................................................................ 431 XML Schema-based Configuration ........................................................... 431 15.9. XStream ........................................................................................................ 432 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation xiii XStreamMarshaller ......................................................................................... 432 V. The Web ........................................................................................................................... 434 16. Web MVC framework ................................................................................................ 435 16.1. Introduction to Spring Web MVC framework .................................................... 435 Features of Spring Web MVC ......................................................................... 436 Pluggability of other MVC implementations ...................................................... 437 16.2. The DispatcherServlet .................................................................................... 437 Special Bean Types In the WebApplicationContext ........................................... 440 Default DispatcherServlet Configuration ........................................................... 441 DispatcherServlet Processing Sequence .......................................................... 441 16.3. Implementing Controllers ................................................................................ 443 Defining a controller with @Controller .............................................................. 443 Mapping Requests With Using @RequestMapping ........................................... 444 New Support Classes for @RequestMapping methods in Spring MVC 3.1 .. 446 URI Template Patterns ........................................................................... 447 URI Template Patterns with Regular Expressions ..................................... 448 Path Patterns ......................................................................................... 449 Patterns with Placeholders ...................................................................... 449 Matrix Variables ...................................................................................... 449 Consumable Media Types ....................................................................... 450 Producible Media Types .......................................................................... 451 Request Parameters and Header Values ................................................. 451 Defining @RequestMapping handler methods .................................................. 452 Supported method argument types .......................................................... 452 Supported method return types ............................................................... 454 Binding request parameters to method parameters with @RequestParam ... 455 Mapping the request body with the @RequestBody annotation .................. 456 Mapping the response body with the @ResponseBody annotation ............. 457 Creating REST Controllers with the @RestController annotation ................ 457 Using HttpEntity ...................................................................................... 457 Using @ModelAttribute on a method ....................................................... 458 Using @ModelAttribute on a method argument ......................................... 459 Using @SessionAttributes to store model attributes in the HTTP session between requests ................................................................................... 461 Specifying redirect and flash attributes ..................................................... 461 Working with "application/x-www-form-urlencoded" data ............................ 462 Mapping cookie values with the @CookieValue annotation ........................ 462 Mapping request header attributes with the @RequestHeader annotation ... 463 Method Parameters And Type Conversion ............................................... 463 Customizing WebDataBinder initialization ................................................. 464 Support for the Last-Modified Response Header To Facilitate Content Caching ................................................................................................. 465 Assisting Controllers with the @ControllerAdvice annotation ...................... 465 Asynchronous Request Processing .................................................................. 466 Exception Handling for Async Requests ................................................... 467 Intercepting Async Requests ................................................................... 467 Configuration for Async Request Processing ............................................ 468 Testing Controllers ......................................................................................... 469 16.4. Handler mappings .......................................................................................... 469 Intercepting requests with a HandlerInterceptor ................................................ 469 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation xiv 16.5. Resolving views ............................................................................................. 471 Resolving views with the ViewResolver interface .............................................. 471 Chaining ViewResolvers ................................................................................. 473 Redirecting to views ....................................................................................... 474 RedirectView .......................................................................................... 474 The redirect: prefix ................................................................................. 475 The forward: prefix ................................................................................. 475 ContentNegotiatingViewResolver ..................................................................... 475 16.6. Using flash attributes ..................................................................................... 478 16.7. Building URIs ................................................................................................. 479 16.8. Building URIs to Controllers and methods ....................................................... 480 16.9. Using locales ................................................................................................. 480 Obtaining Time Zone Information .................................................................... 481 AcceptHeaderLocaleResolver .......................................................................... 481 CookieLocaleResolver ..................................................................................... 481 SessionLocaleResolver ................................................................................... 481 LocaleChangeInterceptor ................................................................................ 482 16.10. Using themes ............................................................................................... 482 Overview of themes ........................................................................................ 482 Defining themes ............................................................................................. 482 Theme resolvers ............................................................................................. 483 16.11. Spring’s multipart (file upload) support ........................................................... 483 Introduction .................................................................................................... 483 Using a MultipartResolver with Commons FileUpload ........................................ 484 Using a MultipartResolver with Servlet 3.0 ....................................................... 484 Handling a file upload in a form ...................................................................... 484 Handling a file upload request from programmatic clients .................................. 486 16.12. Handling exceptions ..................................................................................... 486 HandlerExceptionResolver ............

2015-12-15

spring-framework-reference4.1.4

Not Using Commons Logging ................................................................... 12 Using SLF4J ............................................................................................ 13 Using Log4J ............................................................................................. 14 II. What’s New in Spring Framework 4.x .................................................................................... 16 3. New Features and Enhancements in Spring Framework 4.0 ............................................ 17 3.1. Improved Getting Started Experience .................................................................. 17 3.2. Removed Deprecated Packages and Methods .................................................... 17 3.3. Java 8 (as well as 6 and 7) ............................................................................... 17 3.4. Java EE 6 and 7 ............................................................................................... 18 3.5. Groovy Bean Definition DSL .............................................................................. 18 3.6. Core Container Improvements ............................................................................ 19 3.7. General Web Improvements ............................................................................... 19 3.8. WebSocket, SockJS, and STOMP Messaging ..................................................... 19 3.9. Testing Improvements ........................................................................................ 20 III. Core Technologies .............................................................................................................. 21 4. The IoC container ........................................................................................................ 22 4.1. Introduction to the Spring IoC container and beans .............................................. 22 4.2. Container overview ............................................................................................ 22 Configuration metadata ..................................................................................... 23 Instantiating a container .................................................................................... 24 Composing XML-based configuration metadata .......................................... 25 Using the container .......................................................................................... 26 4.3. Bean overview ................................................................................................... 27 Naming beans .................................................................................................. 28 Aliasing a bean outside the bean definition ................................................ 28 Instantiating beans ........................................................................................... 29 Instantiation with a constructor .................................................................. 29 Instantiation with a static factory method .................................................... 30 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation iii Instantiation using an instance factory method ........................................... 30 4.4. Dependencies ................................................................................................... 32 Dependency injection ....................................................................................... 32 Constructor-based dependency injection .................................................... 32 Setter-based dependency injection ............................................................ 34 Dependency resolution process ................................................................. 35 Examples of dependency injection ............................................................. 36 Dependencies and configuration in detail ........................................................... 38 Straight values (primitives, Strings, and so on) ........................................... 38 References to other beans (collaborators) .................................................. 40 Inner beans .............................................................................................. 41 Collections ............................................................................................... 41 Null and empty string values ..................................................................... 44 XML shortcut with the p-namespace .......................................................... 44 XML shortcut with the c-namespace .......................................................... 46 Compound property names ....................................................................... 46 Using depends-on ............................................................................................ 47 Lazy-initialized beans ....................................................................................... 47 Autowiring collaborators .................................................................................... 48 Limitations and disadvantages of autowiring ............................................... 49 Excluding a bean from autowiring .............................................................. 50 Method injection ............................................................................................... 50 Lookup method injection ........................................................................... 51 Arbitrary method replacement ................................................................... 53 4.5. Bean scopes ..................................................................................................... 54 The singleton scope ......................................................................................... 55 The prototype scope ......................................................................................... 55 Singleton beans with prototype-bean dependencies ............................................ 56 Request, session, and global session scopes .................................................... 56 Initial web configuration ............................................................................ 57 Request scope ......................................................................................... 58 Session scope .......................................................................................... 58 Global session scope ............................................................................... 58 Scoped beans as dependencies ................................................................ 58 Custom scopes ................................................................................................ 60 Creating a custom scope .......................................................................... 60 Using a custom scope .............................................................................. 61 4.6. Customizing the nature of a bean ....................................................................... 62 Lifecycle callbacks ............................................................................................ 62 Initialization callbacks ............................................................................... 63 Destruction callbacks ................................................................................ 64 Default initialization and destroy methods .................................................. 64 Combining lifecycle mechanisms ............................................................... 66 Startup and shutdown callbacks ................................................................ 66 Shutting down the Spring IoC container gracefully in non-web applications ................................................................................................................. 68 ApplicationContextAware and BeanNameAware ................................................. 68 Other Aware interfaces ..................................................................................... 69 4.7. Bean definition inheritance ................................................................................. 71 4.8. Container Extension Points ................................................................................ 72 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation iv Customizing beans using a BeanPostProcessor ................................................. 72 Example: Hello World, BeanPostProcessor-style ........................................ 74 Example: The RequiredAnnotationBeanPostProcessor ............................... 75 Customizing configuration metadata with a BeanFactoryPostProcessor ................ 75 Example: the Class name substitution PropertyPlaceholderConfigurer .......... 76 Example: the PropertyOverrideConfigurer .................................................. 77 Customizing instantiation logic with a FactoryBean ............................................. 78 4.9. Annotation-based container configuration ............................................................ 79 @Required ....................................................................................................... 80 @Autowired ..................................................................................................... 80 Fine-tuning annotation-based autowiring with qualifiers ....................................... 83 Using generics as autowiring qualifiers .............................................................. 89 CustomAutowireConfigurer ................................................................................ 90 @Resource ...................................................................................................... 90 @PostConstruct and @PreDestroy .................................................................... 92 4.10. Classpath scanning and managed components ................................................. 92 @Component and further stereotype annotations ............................................... 93 Meta-annotations .............................................................................................. 93 Automatically detecting classes and registering bean definitions .......................... 94 Using filters to customize scanning ................................................................... 95 Defining bean metadata within components ....................................................... 96 Naming autodetected components ..................................................................... 97 Providing a scope for autodetected components ................................................ 98 Providing qualifier metadata with annotations ..................................................... 99 4.11. Using JSR 330 Standard Annotations ............................................................... 99 Dependency Injection with @Inject and @Named ............................................. 100 @Named: a standard equivalent to the @Component annotation ....................... 100 Limitations of the standard approach ............................................................... 101 4.12. Java-based container configuration ................................................................. 102 Basic concepts: @Bean and @Configuration ................................................... 102 Instantiating the Spring container using AnnotationConfigApplicationContext ....... 103 Simple construction ................................................................................ 103 Building the container programmatically using register(Class<?>…) ........... 104 Enabling component scanning with scan(String…) .................................... 104 Support for web applications with AnnotationConfigWebApplicationContext ............................................................................................................... 105 Using the @Bean annotation .......................................................................... 106 Declaring a bean .................................................................................... 107 Receiving lifecycle callbacks ................................................................... 107 Specifying bean scope ............................................................................ 108 Customizing bean naming ....................................................................... 109 Bean aliasing ......................................................................................... 109 Bean description ..................................................................................... 110 Using the @Configuration annotation ............................................................... 110 Injecting inter-bean dependencies ............................................................ 110 Lookup method injection ......................................................................... 111 Further information about how Java-based configuration works internally .... 111 Composing Java-based configurations ............................................................. 112 Using the @Import annotation ................................................................. 112 Conditionally including @Configuration classes or @Beans ....................... 116 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation v Combining Java and XML configuration ................................................... 117 4.13. Bean definition profiles and environment abstraction ........................................ 120 4.14. PropertySource Abstraction ............................................................................ 120 4.15. Registering a LoadTimeWeaver ...................................................................... 120 4.16. Additional Capabilities of the ApplicationContext .............................................. 120 Internationalization using MessageSource ........................................................ 121 Standard and Custom Events .......................................................................... 124 Convenient access to low-level resources ........................................................ 127 Convenient ApplicationContext instantiation for web applications ....................... 128 Deploying a Spring ApplicationContext as a J2EE RAR file ............................... 128 4.17. The BeanFactory ........................................................................................... 129 BeanFactory or ApplicationContext? ................................................................ 129 Glue code and the evil singleton ..................................................................... 131 5. Resources .................................................................................................................. 132 5.1. Introduction ..................................................................................................... 132 5.2. The Resource interface .................................................................................... 132 5.3. Built-in Resource implementations .................................................................... 133 UrlResource ................................................................................................... 133 ClassPathResource ........................................................................................ 133 FileSystemResource ....................................................................................... 134 ServletContextResource .................................................................................. 134 InputStreamResource ..................................................................................... 134 ByteArrayResource ......................................................................................... 134 5.4. The ResourceLoader ....................................................................................... 134 5.5. The ResourceLoaderAware interface ................................................................ 135 5.6. Resources as dependencies ............................................................................. 136 5.7. Application contexts and Resource paths .......................................................... 137 Constructing application contexts ..................................................................... 137 Constructing ClassPathXmlApplicationContext instances - shortcuts .......... 137 Wildcards in application context constructor resource paths ............................... 138 Ant-style Patterns ................................................................................... 138 The Classpath*: portability classpath*: prefix ............................................ 139 Other notes relating to wildcards ............................................................. 139 FileSystemResource caveats .......................................................................... 140 6. Validation, Data Binding, and Type Conversion ............................................................ 141 6.1. Introduction ..................................................................................................... 141 6.2. Validation using Spring’s Validator interface ...................................................... 141 6.3. Resolving codes to error messages .................................................................. 143 6.4. Bean manipulation and the BeanWrapper ......................................................... 144 Setting and getting basic and nested properties ............................................... 144 Built-in PropertyEditor implementations ............................................................ 146 Registering additional custom PropertyEditors .......................................... 149 6.5. Spring Type Conversion ................................................................................... 151 Converter SPI ................................................................................................ 151 ConverterFactory ............................................................................................ 152 GenericConverter ........................................................................................... 153 ConditionalGenericConverter ................................................................... 154 ConversionService API ................................................................................... 154 Configuring a ConversionService ..................................................................... 154 Using a ConversionService programmatically ................................................... 155 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation vi 6.6. Spring Field Formatting .................................................................................... 155 Formatter SPI ................................................................................................. 156 Annotation-driven Formatting ........................................................................... 157 Format Annotation API ............................................................................ 158 FormatterRegistry SPI ..................................................................................... 159 FormatterRegistrar SPI ................................................................................... 159 Configuring Formatting in Spring MVC ............................................................. 159 6.7. Configuring a global date & time format ............................................................ 161 6.8. Spring Validation ............................................................................................. 163 Overview of the JSR-303 Bean Validation API ................................................. 163 Configuring a Bean Validation Provider ............................................................ 164 Injecting a Validator ................................................................................ 164 Configuring Custom Constraints .............................................................. 164 Additional Configuration Options .............................................................. 165 Configuring a DataBinder ................................................................................ 165 Spring MVC 3 Validation ................................................................................. 166 Triggering @Controller Input Validation .................................................... 166 Configuring a Validator for use by Spring MVC ......................................... 166 Configuring a JSR-303/JSR-349 Validator for use by Spring MVC .............. 167 7. Spring Expression Language (SpEL) ........................................................................... 168 7.1. Introduction ..................................................................................................... 168 7.2. Feature Overview ............................................................................................ 168 7.3. Expression Evaluation using Spring’s Expression Interface ................................. 169 The EvaluationContext interface ...................................................................... 171 Type Conversion .................................................................................... 171 7.4. Expression support for defining bean definitions ................................................ 172 XML based configuration ................................................................................ 172 Annotation-based configuration ........................................................................ 173 7.5. Language Reference ........................................................................................ 174 Literal expressions .......................................................................................... 174 Properties, Arrays, Lists, Maps, Indexers ......................................................... 174 Inline lists ....................................................................................................... 175 Array construction ........................................................................................... 175 Methods ......................................................................................................... 176 Operators ....................................................................................................... 176 Relational operators ................................................................................ 176 Logical operators .................................................................................... 177 Mathematical operators ........................................................................... 177 Assignment .................................................................................................... 178 Types ............................................................................................................. 178 Constructors ................................................................................................... 179 Variables ........................................................................................................ 179 The #this and #root variables .................................................................. 179 Functions ....................................................................................................... 180 Bean references ............................................................................................. 180 Ternary Operator (If-Then-Else) ....................................................................... 180 The Elvis Operator ......................................................................................... 181 Safe Navigation operator ................................................................................ 181 Collection Selection ........................................................................................ 182 Collection Projection ....................................................................................... 182 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation vii Expression templating ..................................................................................... 183 7.6. Classes used in the examples .......................................................................... 183 8. Aspect Oriented Programming with Spring ................................................................... 187 8.1. Introduction ..................................................................................................... 187 AOP concepts ................................................................................................ 187 Spring AOP capabilities and goals ................................................................... 189 AOP Proxies .................................................................................................. 190 8.2. @AspectJ support ........................................................................................... 190 Enabling @AspectJ Support ............................................................................ 190 Enabling @AspectJ Support with Java configuration ................................. 190 Enabling @AspectJ Support with XML configuration ................................. 191 Declaring an aspect ........................................................................................ 191 Declaring a pointcut ........................................................................................ 192 Supported Pointcut Designators .............................................................. 192 Combining pointcut expressions .............................................................. 194 Sharing common pointcut definitions ........................................................ 194 Examples ............................................................................................... 196 Writing good pointcuts ............................................................................ 198 Declaring advice ............................................................................................. 199 Before advice ......................................................................................... 199 After returning advice .............................................................................. 200 After throwing advice .............................................................................. 200 After (finally) advice ................................................................................ 201 Around advice ........................................................................................ 202 Advice parameters .................................................................................. 203 Advice ordering ...................................................................................... 206 Introductions ................................................................................................... 206 Aspect instantiation models ............................................................................. 207 Example ......................................................................................................... 208 8.3. Schema-based AOP support ............................................................................ 209 Declaring an aspect ........................................................................................ 210 Declaring a pointcut ........................................................................................ 210 Declaring advice ............................................................................................. 212 Before advice ......................................................................................... 212 After returning advice .............................................................................. 212 After throwing advice .............................................................................. 213 After (finally) advice ................................................................................ 214 Around advice ........................................................................................ 214 Advice parameters .................................................................................. 215 Advice ordering ...................................................................................... 216 Introductions ................................................................................................... 217 Aspect instantiation models ............................................................................. 217 Advisors ......................................................................................................... 217 Example ......................................................................................................... 218 8.4. Choosing which AOP declaration style to use .................................................... 220 Spring AOP or full AspectJ? ........................................................................... 220 @AspectJ or XML for Spring AOP? ................................................................. 221 8.5. Mixing aspect types ......................................................................................... 222 8.6. Proxying mechanisms ...................................................................................... 222 Understanding AOP proxies ............................................................................ 223 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation viii 8.7. Programmatic creation of @AspectJ Proxies ..................................................... 225 8.8. Using AspectJ with Spring applications ............................................................. 225 Using AspectJ to dependency inject domain objects with Spring ........................ 226 Unit testing @Configurable objects .......................................................... 228 Working with multiple application contexts ................................................ 228 Other Spring aspects for AspectJ .................................................................... 229 Configuring AspectJ aspects using Spring IoC ................................................. 229 Load-time weaving with AspectJ in the Spring Framework ................................. 230 A first example ....................................................................................... 231 Aspects .................................................................................................. 234 ' META-INF/aop.xml' ............................................................................... 234 Required libraries (JARS) ........................................................................ 234 Spring configuration ................................................................................ 235 Environment-specific configuration ........................................................... 237 8.9. Further Resources ........................................................................................... 239 9. Spring AOP APIs ....................................................................................................... 240 9.1. Introduction ..................................................................................................... 240 9.2. Pointcut API in Spring ...................................................................................... 240 Concepts ........................................................................................................ 240 Operations on pointcuts .................................................................................. 241 AspectJ expression pointcuts .......................................................................... 241 Convenience pointcut implementations ............................................................ 241 Static pointcuts ....................................................................................... 241 Dynamic pointcuts .................................................................................. 242 Pointcut superclasses ..................................................................................... 243 Custom pointcuts ............................................................................................ 243 9.3. Advice API in Spring ........................................................................................ 243 Advice lifecycles ............................................................................................. 243 Advice types in Spring .................................................................................... 244 Interception around advice ...................................................................... 244 Before advice ......................................................................................... 244 Throws advice ........................................................................................ 245 After Returning advice ............................................................................ 246 Introduction advice .................................................................................. 247 9.4. Advisor API in Spring ....................................................................................... 249 9.5. Using the ProxyFactoryBean to create AOP proxies ........................................... 250 Basics ............................................................................................................ 250 JavaBean properties ....................................................................................... 250 JDK- and CGLIB-based proxies ...................................................................... 251 Proxying interfaces ......................................................................................... 252 Proxying classes ............................................................................................ 254 Using global advisors ...................................................................................... 255 9.6. Concise proxy definitions ................................................................................. 255 9.7. Creating AOP proxies programmatically with the ProxyFactory ............................ 256 9.8. Manipulating advised objects ............................................................................ 257 9.9. Using the "auto-proxy" facility ........................................................................... 258 Autoproxy bean definitions .............................................................................. 258 BeanNameAutoProxyCreator ................................................................... 259 DefaultAdvisorAutoProxyCreator .............................................................. 259 AbstractAdvisorAutoProxyCreator ............................................................ 260 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation ix Using metadata-driven auto-proxying ............................................................... 260 9.10. Using TargetSources ...................................................................................... 262 Hot swappable target sources ......................................................................... 263 Pooling target sources .................................................................................... 263 Prototype target sources ................................................................................. 265 ThreadLocal target sources ............................................................................. 265 9.11. Defining new Advice types ............................................................................. 265 9.12. Further resources ........................................................................................... 266 10. Testing ..................................................................................................................... 267 10.1. Introduction to Spring Testing ......................................................................... 267 10.2. Unit Testing ................................................................................................... 267 Mock Objects ................................................................................................. 267 Environment ........................................................................................... 267 JNDI ...................................................................................................... 267 Servlet API ............................................................................................. 267 Portlet API ............................................................................................. 268 Unit Testing support Classes .......................................................................... 268 General utilities ...................................................................................... 268 Spring MVC ........................................................................................... 268 10.3. Integration Testing ......................................................................................... 268 Overview ........................................................................................................ 268 Goals of Integration Testing ............................................................................ 269 Context management and caching ........................................................... 269 Dependency Injection of test fixtures ....................................................... 269 Transaction management ........................................................................ 270 Support classes for integration testing ..................................................... 270 JDBC Testing Support .................................................................................... 271 Annotations .................................................................................................... 271 Spring Testing Annotations ..................................................................... 271 Standard Annotation Support .................................................................. 276 Spring JUnit Testing Annotations ............................................................. 277 Meta-Annotation Support for Testing ........................................................ 278 Spring TestContext Framework ....................................................................... 279 Key abstractions ..................................................................................... 280 Context management .............................................................................. 281 Dependency injection of test fixtures ........................................................ 297 Testing request and session scoped beans .............................................. 299 Transaction management ........................................................................ 301 TestContext Framework support classes .................................................. 304 Spring MVC Test Framework .......................................................................... 306 Server-Side Tests ................................................................................... 306 Client-Side REST Tests .......................................................................... 312 PetClinic Example .......................................................................................... 313 10.4. Further Resources ......................................................................................... 314 IV. Data Access ..................................................................................................................... 316 11. Transaction Management .......................................................................................... 317 11.1. Introduction to Spring Framework transaction management .............................. 317 11.2. Advantages of the Spring Framework’s transaction support model ..................... 317 Global transactions ......................................................................................... 317 Local transactions ........................................................................................... 318 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation x Spring Framework’s consistent programming model ......................................... 318 11.3. Understanding the Spring Framework transaction abstraction ............................ 319 11.4. Synchronizing resources with transactions ....................................................... 323 High-level synchronization approach ................................................................ 323 Low-level synchronization approach ................................................................. 323 TransactionAwareDataSourceProxy ................................................................. 324 11.5. Declarative transaction management ............................................................... 324 Understanding the Spring Framework’s declarative transaction implementation ... 325 Example of declarative transaction implementation ........................................... 326 Rolling back a declarative transaction .............................................................. 330 Configuring different transactional semantics for different beans ........................ 331 <tx:advice/> settings ....................................................................................... 333 Using @Transactional ..................................................................................... 335 @Transactional settings .......................................................................... 339 Multiple Transaction Managers with @Transactional ................................. 340 Custom shortcut annotations ................................................................... 341 Transaction propagation .................................................................................. 341 Required ................................................................................................ 342 RequiresNew .......................................................................................... 342 Nested ................................................................................................... 343 Advising transactional operations ..................................................................... 343 Using @Transactional with AspectJ ................................................................. 346 11.6. Programmatic transaction management ........................................................... 347 Using the TransactionTemplate ....................................................................... 347 Specifying transaction settings ................................................................ 349 Using the PlatformTransactionManager ............................................................ 349 11.7. Choosing between programmatic and declarative transaction management ........ 350 11.8. Application server-specific integration .............................................................. 350 IBM WebSphere ............................................................................................. 351 Oracle WebLogic Server ................................................................................. 351 11.9. Solutions to common problems ....................................................................... 351 Use of the wrong transaction manager for a specific DataSource ....................... 351 11.10. Further Resources ....................................................................................... 351 12. DAO support ............................................................................................................ 352 12.1. Introduction .................................................................................................... 352 12.2. Consistent exception hierarchy ....................................................................... 352 12.3. Annotations used for configuring DAO or Repository classes ............................ 353 13. Data access with JDBC ............................................................................................ 355 13.1. Introduction to Spring Framework JDBC .......................................................... 355 Choosing an approach for JDBC database access ........................................... 355 Package hierarchy .......................................................................................... 356 13.2. Using the JDBC core classes to control basic JDBC processing and error handling ................................................................................................................. 357 JdbcTemplate ................................................................................................. 357 Examples of JdbcTemplate class usage ................................................... 357 JdbcTemplate best practices ................................................................... 359 NamedParameterJdbcTemplate ....................................................................... 361 SQLExceptionTranslator .................................................................................. 363 Executing statements ...................................................................................... 365 Running queries ............................................................................................. 365 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation xi Updating the database .................................................................................... 366 Retrieving auto-generated keys ....................................................................... 367 13.3. Controlling database connections .................................................................... 367 DataSource .................................................................................................... 367 DataSourceUtils .............................................................................................. 369 SmartDataSource ........................................................................................... 369 AbstractDataSource ........................................................................................ 369 SingleConnectionDataSource .......................................................................... 369 DriverManagerDataSource .............................................................................. 369 TransactionAwareDataSourceProxy ................................................................. 370 DataSourceTransactionManager ...................................................................... 370 NativeJdbcExtractor ........................................................................................ 370 13.4. JDBC batch operations .................................................................................. 371 Basic batch operations with the JdbcTemplate ................................................. 371 Batch operations with a List of objects ............................................................. 372 Batch operations with multiple batches ............................................................ 373 13.5. Simplifying JDBC operations with the SimpleJdbc classes ................................ 374 Inserting data using SimpleJdbcInsert .............................................................. 374 Retrieving auto-generated keys using SimpleJdbcInsert .................................... 375 Specifying columns for a SimpleJdbcInsert ...................................................... 376 Using SqlParameterSource to provide parameter values ................................... 376 Calling a stored procedure with SimpleJdbcCall ............................................... 377 Explicitly declaring parameters to use for a SimpleJdbcCall ............................... 379 How to define SqlParameters .......................................................................... 380 Calling a stored function using SimpleJdbcCall ................................................. 381 Returning ResultSet/REF Cursor from a SimpleJdbcCall ................................... 381 13.6. Modeling JDBC operations as Java objects ..................................................... 382 SqlQuery ........................................................................................................ 383 MappingSqlQuery ........................................................................................... 383 SqlUpdate ...................................................................................................... 384 StoredProcedure ............................................................................................. 385 13.7. Common problems with parameter and data value handling .............................. 388 Providing SQL type information for parameters ................................................. 389 Handling BLOB and CLOB objects .................................................................. 389 Passing in lists of values for IN clause ............................................................ 390 Handling complex types for stored procedure calls ........................................... 391 13.8. Embedded database support .......................................................................... 392 Why use an embedded database? .................................................................. 392 Creating an embedded database instance using Spring XML ............................ 392 Creating an embedded database instance programmatically .............................. 392 Extending the embedded database support ...................................................... 393 Using HSQL ................................................................................................... 393 Using H2 ........................................................................................................ 393 Using Derby ................................................................................................... 393 Testing data access logic with an embedded database ..................................... 393 13.9. Initializing a DataSource ................................................................................. 394 Initializing a database instance using Spring XML ............................................. 394 Initialization of Other Components that Depend on the Database ............... 395 14. Object Relational Mapping (ORM) Data Access .......................................................... 397 14.1. Introduction to ORM with Spring ..................................................................... 397 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation xii 14.2. General ORM integration considerations ......................................................... 398 Resource and transaction management ........................................................... 398 Exception translation ....................................................................................... 399 14.3. Hibernate ....................................................................................................... 399 SessionFactory setup in a Spring container ...................................................... 400 Implementing DAOs based on plain Hibernate 3 API ........................................ 400 Declarative transaction demarcation ................................................................ 402 Programmatic transaction demarcation ............................................................ 404 Transaction management strategies ................................................................ 405 Comparing container-managed and locally defined resources ............................ 407 Spurious application server warnings with Hibernate ......................................... 408 14.4. JDO .............................................................................................................. 409 PersistenceManagerFactory setup ................................................................... 409 Implementing DAOs based on the plain JDO API ............................................. 410 Transaction management ................................................................................ 412 JdoDialect ...................................................................................................... 413 14.5. JPA ............................................................................................................... 414 Three options for JPA setup in a Spring environment ........................................ 414 LocalEntityManagerFactoryBean .............................................................. 414 Obtaining an EntityManagerFactory from JNDI ......................................... 415 LocalContainerEntityManagerFactoryBean ............................................... 415 Dealing with multiple persistence units ..................................................... 417 Implementing DAOs based on plain JPA .......................................................... 418 Transaction Management ................................................................................ 420 JpaDialect ...................................................................................................... 421 15. Marshalling XML using O/X Mappers ......................................................................... 423 15.1. Introduction .................................................................................................... 423 Ease of configuration ...................................................................................... 423 Consistent Interfaces ...................................................................................... 423 Consistent Exception Hierarchy ....................................................................... 423 15.2. Marshaller and Unmarshaller .......................................................................... 423 Marshaller ...................................................................................................... 423 Unmarshaller .................................................................................................. 424 XmlMappingException ..................................................................................... 425 15.3. Using Marshaller and Unmarshaller ................................................................. 425 15.4. XML Schema-based Configuration .................................................................. 427 15.5. JAXB ............................................................................................................. 427 Jaxb2Marshaller ............................................................................................. 428 XML Schema-based Configuration ........................................................... 428 15.6. Castor ........................................................................................................... 429 CastorMarshaller ............................................................................................ 429 Mapping ......................................................................................................... 429 XML Schema-based Configuration ........................................................... 429 15.7. XMLBeans ..................................................................................................... 430 XmlBeansMarshaller ....................................................................................... 430 XML Schema-based Configuration ........................................................... 430 15.8. JiBX .............................................................................................................. 431 JibxMarshaller ................................................................................................ 431 XML Schema-based Configuration ........................................................... 431 15.9. XStream ........................................................................................................ 432 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation xiii XStreamMarshaller ......................................................................................... 432 V. The Web ........................................................................................................................... 434 16. Web MVC framework ................................................................................................ 435 16.1. Introduction to Spring Web MVC framework .................................................... 435 Features of Spring Web MVC ......................................................................... 436 Pluggability of other MVC implementations ...................................................... 437 16.2. The DispatcherServlet .................................................................................... 437 Special Bean Types In the WebApplicationContext ........................................... 440 Default DispatcherServlet Configuration ........................................................... 441 DispatcherServlet Processing Sequence .......................................................... 441 16.3. Implementing Controllers ................................................................................ 443 Defining a controller with @Controller .............................................................. 443 Mapping Requests With Using @RequestMapping ........................................... 444 New Support Classes for @RequestMapping methods in Spring MVC 3.1 .. 446 URI Template Patterns ........................................................................... 447 URI Template Patterns with Regular Expressions ..................................... 448 Path Patterns ......................................................................................... 449 Patterns with Placeholders ...................................................................... 449 Matrix Variables ...................................................................................... 449 Consumable Media Types ....................................................................... 450 Producible Media Types .......................................................................... 451 Request Parameters and Header Values ................................................. 451 Defining @RequestMapping handler methods .................................................. 452 Supported method argument types .......................................................... 452 Supported method return types ............................................................... 454 Binding request parameters to method parameters with @RequestParam ... 455 Mapping the request body with the @RequestBody annotation .................. 456 Mapping the response body with the @ResponseBody annotation ............. 457 Creating REST Controllers with the @RestController annotation ................ 457 Using HttpEntity ...................................................................................... 457 Using @ModelAttribute on a method ....................................................... 458 Using @ModelAttribute on a method argument ......................................... 459 Using @SessionAttributes to store model attributes in the HTTP session between requests ................................................................................... 461 Specifying redirect and flash attributes ..................................................... 461 Working with "application/x-www-form-urlencoded" data ............................ 462 Mapping cookie values with the @CookieValue annotation ........................ 462 Mapping request header attributes with the @RequestHeader annotation ... 463 Method Parameters And Type Conversion ............................................... 463 Customizing WebDataBinder initialization ................................................. 464 Support for the Last-Modified Response Header To Facilitate Content Caching ................................................................................................. 465 Assisting Controllers with the @ControllerAdvice annotation ...................... 465 Asynchronous Request Processing .................................................................. 466 Exception Handling for Async Requests ................................................... 467 Intercepting Async Requests ................................................................... 467 Configuration for Async Request Processing ............................................ 468 Testing Controllers ......................................................................................... 469 16.4. Handler mappings .......................................................................................... 469 Intercepting requests with a HandlerInterceptor ................................................ 469 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation xiv 16.5. Resolving views ............................................................................................. 471 Resolving views with the ViewResolver interface .............................................. 471 Chaining ViewResolvers ................................................................................. 473 Redirecting to views ....................................................................................... 474 RedirectView .......................................................................................... 474 The redirect: prefix ................................................................................. 475 The forward: prefix ................................................................................. 475 ContentNegotiatingViewResolver ..................................................................... 475 16.6. Using flash attributes ..................................................................................... 478 16.7. Building URIs ................................................................................................. 479 16.8. Building URIs to Controllers and methods ....................................................... 480 16.9. Using locales ................................................................................................. 480 Obtaining Time Zone Information .................................................................... 481 AcceptHeaderLocaleResolver .......................................................................... 481 CookieLocaleResolver ..................................................................................... 481 SessionLocaleResolver ................................................................................... 481 LocaleChangeInterceptor ................................................................................ 482 16.10. Using themes ............................................................................................... 482 Overview of themes ........................................................................................ 482 Defining themes ............................................................................................. 482 Theme resolvers ............................................................................................. 483 16.11. Spring’s multipart (file upload) support ........................................................... 483 Introduction .................................................................................................... 483 Using a MultipartResolver with Commons FileUpload ........................................ 484 Using a MultipartResolver with Servlet 3.0 ....................................................... 484 Handling a file upload in a form ...................................................................... 484 Handling a file upload request from programmatic clients .................................. 486 16.12. Handling exceptions ..................................................................................... 486 HandlerExceptionResolver ............

2015-12-15

spring-framework-reference-4.1.1

Spring Dependencies and Depending on Spring ......................................... 11 Maven Dependency Management ............................................................. 11 Maven "Bill Of Materials" Dependency ....................................................... 12 Gradle Dependency Management ............................................................. 12 Ivy Dependency Management ................................................................... 13 Distribution Zip Files ................................................................................. 13 Logging ............................................................................................................ 13 Not Using Commons Logging ................................................................... 14 Using SLF4J ............................................................................................ 14 Using Log4J ............................................................................................. 15 II. What’s New in Spring Framework 4.x .................................................................................... 17 3. New Features and Enhancements in Spring Framework 4.0 ............................................ 18 3.1. Improved Getting Started Experience .................................................................. 18 3.2. Removed Deprecated Packages and Methods .................................................... 18 3.3. Java 8 (as well as 6 and 7) ............................................................................... 18 3.4. Java EE 6 and 7 ............................................................................................... 19 3.5. Groovy Bean Definition DSL .............................................................................. 19 3.6. Core Container Improvements ............................................................................ 19 3.7. General Web Improvements ............................................................................... 20 3.8. WebSocket, SockJS, and STOMP Messaging ..................................................... 20 3.9. Testing Improvements ........................................................................................ 21 4. New Features and Enhancements in Spring Framework 4.1 ............................................ 22 4.1. JMS Improvements ............................................................................................ 22 4.2. Caching Improvements ...................................................................................... 22 4.3. Web Improvements ............................................................................................ 23 4.4. WebSocket Messaging Improvements ................................................................. 24 4.5. Testing Improvements ........................................................................................ 24 5. New Features and Enhancements in Spring Framework 4.2 ............................................ 26 5.1. Core Container Improvements ............................................................................ 26 5.2. Data Access Improvements ................................................................................ 27 5.3. JMS Improvements ............................................................................................ 28 5.4. Web Improvements ............................................................................................ 28 5.5. WebSocket Messaging Improvements ................................................................. 29 5.6. Testing Improvements ........................................................................................ 29 Configuration metadata ..................................................................................... 34 Instantiating a container .................................................................................... 35 Composing XML-based configuration metadata .......................................... 36 Using the container .......................................................................................... 37 6.3. Bean overview ................................................................................................... 37 Naming beans .................................................................................................. 38 Aliasing a bean outside the bean definition ................................................ 39 Instantiating beans ........................................................................................... 40 Instantiation with a constructor .................................................................. 40 Instantiation with a static factory method .................................................... 41 Instantiation using an instance factory method ........................................... 41 6.4. Dependencies ................................................................................................... 42 Dependency Injection ....................................................................................... 42 Constructor-based dependency injection .................................................... 43 Setter-based dependency injection ............................................................ 45 Dependency resolution process ................................................................. 46 Examples of dependency injection ............................................................. 47 Dependencies and configuration in detail ........................................................... 49 Straight values (primitives, Strings, and so on) ........................................... 49 References to other beans (collaborators) .................................................. 50 Inner beans .............................................................................................. 51 Collections ............................................................................................... 51 Null and empty string values ..................................................................... 54 XML shortcut with the p-namespace .......................................................... 54 XML shortcut with the c-namespace .......................................................... 55 Compound property names ....................................................................... 56 Using depends-on ............................................................................................ 57 Lazy-initialized beans ....................................................................................... 57 Autowiring collaborators .................................................................................... 58 Limitations and disadvantages of autowiring ............................................... 59 Excluding a bean from autowiring .............................................................. 59 Method injection ............................................................................................... 60 Lookup method injection ........................................................................... 61 Arbitrary method replacement ................................................................... 62 6.5. Bean scopes ..................................................................................................... 63 The singleton scope ......................................................................................... 64 The prototype scope ......................................................................................... 65 Singleton beans with prototype-bean dependencies ............................................ 66 Request, session, and global session scopes .................................................... 66 Initial web configuration ............................................................................ 67 Request scope ......................................................................................... 67 Session scope .......................................................................................... 68 Global session scope ............................................................................... 68 Application scope ..................................................................................... 68 Scoped beans as dependencies ................................................................ 68 Custom scopes ................................................................................................ 71 and BeanNameAware ................................................. 79 Other Aware interfaces ..................................................................................... 79 6.7. Bean definition inheritance ................................................................................. 81 6.8. Container Extension Points ................................................................................ 82 Customizing beans using a BeanPostProcessor ................................................. 82 Example: Hello World, BeanPostProcessor-style ........................................ 84 Example: The RequiredAnnotationBeanPostProcessor ............................... 85 Customizing configuration metadata with a BeanFactoryPostProcessor ................ 85 Example: the Class name substitution PropertyPlaceholderConfigurer .......... 86 Example: the PropertyOverrideConfigurer .................................................. 88 Customizing instantiation logic with a FactoryBean ............................................. 89 6.9. Annotation-based container configuration ............................................................ 89 @Required ....................................................................................................... 90 @Autowired ..................................................................................................... 91 Fine-tuning annotation-based autowiring with @Primary ..................................... 94 Fine-tuning annotation-based autowiring with qualifiers ....................................... 95 Using generics as autowiring qualifiers ............................................................ 100 CustomAutowireConfigurer .............................................................................. 100 @Resource .................................................................................................... 101 @PostConstruct and @PreDestroy .................................................................. 102 6.10. Classpath scanning and managed components ................................................ 102 @Component and further stereotype annotations ............................................. 103 Meta-annotations ............................................................................................ 103 Automatically detecting classes and registering bean definitions ........................ 104 Using filters to customize scanning .................................................................. 105 Defining bean metadata within components ..................................................... 106 Naming autodetected components ................................................................... 109 Providing a scope for autodetected components ............................................... 110 Providing qualifier metadata with annotations ................................................... 111 6.11. Using JSR 330 Standard Annotations ............................................................. 111 Dependency Injection with @Inject and @Named ............................................. 112 @Named: a standard equivalent to the @Component annotation ....................... 112 Limitations of the standard approach ............................................................... 113 6.12. Java-based container configuration ................................................................. 114 Basic concepts: @Bean and @Configuration ................................................... 114 Instantiating the Spring container using AnnotationConfigApplicationContext ....... 115 Simple construction ................................................................................ 116 Building the container programmatically using register(Class<?>…) ........... 116 Enabling component scanning with scan(String…) .................................... 116 bean scope ............................................................................ 121 Customizing bean naming ....................................................................... 122 Bean aliasing ......................................................................................... 122 Bean description ..................................................................................... 122 Using the @Configuration annotation ............................................................... 122 Injecting inter-bean dependencies ............................................................ 122 Lookup method injection ......................................................................... 123 Further information about how Java-based configuration works internally .... 124 Composing Java-based configurations ............................................................. 125 Using the @Import annotation ................................................................. 125 Conditionally include @Configuration classes or @Bean methods .............. 129 Combining Java and XML configuration ................................................... 129 6.13. Environment abstraction ................................................................................. 131 Bean definition profiles ................................................................................... 132 @Profile ................................................................................................. 132 XML bean definition profiles ............................................................................ 134 Activating a profile .................................................................................. 135 Default profile ......................................................................................... 135 PropertySource abstraction ............................................................................. 136 @PropertySource ........................................................................................... 137 Placeholder resolution in statements ................................................................ 138 6.14. Registering a LoadTimeWeaver ...................................................................... 138 6.15. Additional Capabilities of the ApplicationContext .............................................. 138 Internationalization using MessageSource ........................................................ 139 Standard and Custom Events .......................................................................... 141 Annotation-based Event Listeners ............................................................ 144 Generic Events ....................................................................................... 146 Convenient access to low-level resources ........................................................ 147 Convenient ApplicationContext instantiation for web applications ....................... 147 Deploying a Spring ApplicationContext as a Java EE RAR file ........................... 148 6.16. The BeanFactory ........................................................................................... 149 BeanFactory or ApplicationContext? ................................................................ 149 Glue code and the evil singleton ..................................................................... 150 7. Resources .................................................................................................................. 151 7.1. Introduction ..................................................................................................... 151 7.2. The Resource interface .................................................................................... 151 7.3. Built-in Resource implementations .................................................................... 152 UrlResource ................................................................................................... 152 ClassPathResource ........................................................................................ 152 FileSystemResource ....................................................................................... 153 ServletContextResource .................................................................................. 153 InputStreamResource ..................................................................................... 153 ByteArrayResource ......................................................................................... 153 7.4. The ResourceLoader ....................................................................................... 153 ...........

2015-12-15

spring-framework

Not Using Commons Logging ................................................................... 12 Using SLF4J ............................................................................................ 13 Using Log4J ............................................................................................. 14 II. What’s New in Spring Framework 4.x .................................................................................... 16 3. New Features and Enhancements in Spring Framework 4.0 ............................................ 17 3.1. Improved Getting Started Experience .................................................................. 17 3.2. Removed Deprecated Packages and Methods .................................................... 17 3.3. Java 8 (as well as 6 and 7) ............................................................................... 17 3.4. Java EE 6 and 7 ............................................................................................... 18 3.5. Groovy Bean Definition DSL .............................................................................. 18 3.6. Core Container Improvements ............................................................................ 19 3.7. General Web Improvements ............................................................................... 19 3.8. WebSocket, SockJS, and STOMP Messaging ..................................................... 19 3.9. Testing Improvements ........................................................................................ 20 III. Core Technologies .............................................................................................................. 21 4. The IoC container ........................................................................................................ 22 4.1. Introduction to the Spring IoC container and beans .............................................. 22 4.2. Container overview ............................................................................................ 22 Configuration metadata ..................................................................................... 23 Instantiating a container .................................................................................... 24 Composing XML-based configuration metadata .......................................... 25 Using the container .......................................................................................... 26 4.3. Bean overview ................................................................................................... 27 Naming beans .................................................................................................. 28 Aliasing a bean outside the bean definition ................................................ 28 Instantiating beans ........................................................................................... 29 Instantiation with a constructor .................................................................. 29 Instantiation with a static factory method .................................................... 30 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation iii Instantiation using an instance factory method ........................................... 30 4.4. Dependencies ................................................................................................... 32 Dependency injection ....................................................................................... 32 Constructor-based dependency injection .................................................... 32 Setter-based dependency injection ............................................................ 34 Dependency resolution process ................................................................. 35 Examples of dependency injection ............................................................. 36 Dependencies and configuration in detail ........................................................... 38 Straight values (primitives, Strings, and so on) ........................................... 38 References to other beans (collaborators) .................................................. 40 Inner beans .............................................................................................. 41 Collections ............................................................................................... 41 Null and empty string values ..................................................................... 44 XML shortcut with the p-namespace .......................................................... 44 XML shortcut with the c-namespace .......................................................... 46 Compound property names ....................................................................... 46 Using depends-on ............................................................................................ 47 Lazy-initialized beans ....................................................................................... 47 Autowiring collaborators .................................................................................... 48 Limitations and disadvantages of autowiring ............................................... 49 Excluding a bean from autowiring .............................................................. 50 Method injection ............................................................................................... 50 Lookup method injection ........................................................................... 51 Arbitrary method replacement ................................................................... 53 4.5. Bean scopes ..................................................................................................... 54 The singleton scope ......................................................................................... 55 The prototype scope ......................................................................................... 55 Singleton beans with prototype-bean dependencies ............................................ 56 Request, session, and global session scopes .................................................... 56 Initial web configuration ............................................................................ 57 Request scope ......................................................................................... 58 Session scope .......................................................................................... 58 Global session scope ............................................................................... 58 Scoped beans as dependencies ................................................................ 58 Custom scopes ................................................................................................ 60 Creating a custom scope .......................................................................... 60 Using a custom scope .............................................................................. 61 4.6. Customizing the nature of a bean ....................................................................... 62 Lifecycle callbacks ............................................................................................ 62 Initialization callbacks ............................................................................... 63 Destruction callbacks ................................................................................ 64 Default initialization and destroy methods .................................................. 64 Combining lifecycle mechanisms ............................................................... 66 Startup and shutdown callbacks ................................................................ 66 Shutting down the Spring IoC container gracefully in non-web applications ................................................................................................................. 68 ApplicationContextAware and BeanNameAware ................................................. 68 Other Aware interfaces ..................................................................................... 69 4.7. Bean definition inheritance ................................................................................. 71 4.8. Container Extension Points ................................................................................ 72 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation iv Customizing beans using a BeanPostProcessor ................................................. 72 Example: Hello World, BeanPostProcessor-style ........................................ 74 Example: The RequiredAnnotationBeanPostProcessor ............................... 75 Customizing configuration metadata with a BeanFactoryPostProcessor ................ 75 Example: the Class name substitution PropertyPlaceholderConfigurer .......... 76 Example: the PropertyOverrideConfigurer .................................................. 77 Customizing instantiation logic with a FactoryBean ............................................. 78 4.9. Annotation-based container configuration ............................................................ 79 @Required ....................................................................................................... 80 @Autowired ..................................................................................................... 80 Fine-tuning annotation-based autowiring with qualifiers ....................................... 83 Using generics as autowiring qualifiers .............................................................. 89 CustomAutowireConfigurer ................................................................................ 90 @Resource ...................................................................................................... 90 @PostConstruct and @PreDestroy .................................................................... 92 4.10. Classpath scanning and managed components ................................................. 92 @Component and further stereotype annotations ............................................... 93 Meta-annotations .............................................................................................. 93 Automatically detecting classes and registering bean definitions .......................... 94 Using filters to customize scanning ................................................................... 95 Defining bean metadata within components ....................................................... 96 Naming autodetected components ..................................................................... 97 Providing a scope for autodetected components ................................................ 98 Providing qualifier metadata with annotations ..................................................... 99 4.11. Using JSR 330 Standard Annotations ............................................................... 99 Dependency Injection with @Inject and @Named ............................................. 100 @Named: a standard equivalent to the @Component annotation ....................... 100 Limitations of the standard approach ............................................................... 101 4.12. Java-based container configuration ................................................................. 102 Basic concepts: @Bean and @Configuration ................................................... 102 Instantiating the Spring container using AnnotationConfigApplicationContext ....... 103 Simple construction ................................................................................ 103 Building the container programmatically using register(Class<?>…) ........... 104 Enabling component scanning with scan(String…) .................................... 104 Support for web applications with AnnotationConfigWebApplicationContext ............................................................................................................... 105 Using the @Bean annotation .......................................................................... 106 Declaring a bean .................................................................................... 107 Receiving lifecycle callbacks ................................................................... 107 Specifying bean scope ............................................................................ 108 Customizing bean naming ....................................................................... 109 Bean aliasing ......................................................................................... 109 Bean description ..................................................................................... 110 Using the @Configuration annotation ............................................................... 110 Injecting inter-bean dependencies ............................................................ 110 Lookup method injection ......................................................................... 111 Further information about how Java-based configuration works internally .... 111 Composing Java-based configurations ............................................................. 112 Using the @Import annotation ................................................................. 112 Conditionally including @Configuration classes or @Beans ....................... 116 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation v Combining Java and XML configuration ................................................... 117 4.13. Bean definition profiles and environment abstraction ........................................ 120 4.14. PropertySource Abstraction ............................................................................ 120 4.15. Registering a LoadTimeWeaver ...................................................................... 120 4.16. Additional Capabilities of the ApplicationContext .............................................. 120 Internationalization using MessageSource ........................................................ 121 Standard and Custom Events .......................................................................... 124 Convenient access to low-level resources ........................................................ 127 Convenient ApplicationContext instantiation for web applications ....................... 128 Deploying a Spring ApplicationContext as a J2EE RAR file ............................... 128 4.17. The BeanFactory ........................................................................................... 129 BeanFactory or ApplicationContext? ................................................................ 129 Glue code and the evil singleton ..................................................................... 131 5. Resources .................................................................................................................. 132 5.1. Introduction ..................................................................................................... 132 5.2. The Resource interface .................................................................................... 132 5.3. Built-in Resource implementations .................................................................... 133 UrlResource ................................................................................................... 133 ClassPathResource ........................................................................................ 133 FileSystemResource ....................................................................................... 134 ServletContextResource .................................................................................. 134 InputStreamResource ..................................................................................... 134 ByteArrayResource ......................................................................................... 134 5.4. The ResourceLoader ....................................................................................... 134 5.5. The ResourceLoaderAware interface ................................................................ 135 5.6. Resources as dependencies ............................................................................. 136 5.7. Application contexts and Resource paths .......................................................... 137 Constructing application contexts ..................................................................... 137 Constructing ClassPathXmlApplicationContext instances - shortcuts .......... 137 Wildcards in application context constructor resource paths ............................... 138 Ant-style Patterns ................................................................................... 138 The Classpath*: portability classpath*: prefix ............................................ 139 Other notes relating to wildcards ............................................................. 139 FileSystemResource caveats .......................................................................... 140 6. Validation, Data Binding, and Type Conversion ............................................................ 141 6.1. Introduction ..................................................................................................... 141 6.2. Validation using Spring’s Validator interface ...................................................... 141 6.3. Resolving codes to error messages .................................................................. 143 6.4. Bean manipulation and the BeanWrapper ......................................................... 144 Setting and getting basic and nested properties ............................................... 144 Built-in PropertyEditor implementations ............................................................ 146 Registering additional custom PropertyEditors .......................................... 149 6.5. Spring Type Conversion ................................................................................... 151 Converter SPI ................................................................................................ 151 ConverterFactory ............................................................................................ 152 GenericConverter ........................................................................................... 153 ConditionalGenericConverter ................................................................... 154 ConversionService API ................................................................................... 154 Configuring a ConversionService ..................................................................... 154 Using a ConversionService programmatically ................................................... 155 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation vi 6.6. Spring Field Formatting .................................................................................... 155 Formatter SPI ................................................................................................. 156 Annotation-driven Formatting ........................................................................... 157 Format Annotation API ............................................................................ 158 FormatterRegistry SPI ..................................................................................... 159 FormatterRegistrar SPI ................................................................................... 159 Configuring Formatting in Spring MVC ............................................................. 159 6.7. Configuring a global date & time format ............................................................ 161 6.8. Spring Validation ............................................................................................. 163 Overview of the JSR-303 Bean Validation API ................................................. 163 Configuring a Bean Validation Provider ............................................................ 164 Injecting a Validator ................................................................................ 164 Configuring Custom Constraints .............................................................. 164 Additional Configuration Options .............................................................. 165 Configuring a DataBinder ................................................................................ 165 Spring MVC 3 Validation ................................................................................. 166 Triggering @Controller Input Validation .................................................... 166 Configuring a Validator for use by Spring MVC ......................................... 166 Configuring a JSR-303/JSR-349 Validator for use by Spring MVC .............. 167 7. Spring Expression Language (SpEL) ........................................................................... 168 7.1. Introduction ..................................................................................................... 168 7.2. Feature Overview ............................................................................................ 168 7.3. Expression Evaluation using Spring’s Expression Interface ................................. 169 The EvaluationContext interface ...................................................................... 171 Type Conversion .................................................................................... 171 7.4. Expression support for defining bean definitions ................................................ 172 XML based configuration ................................................................................ 172 Annotation-based configuration ........................................................................ 173 7.5. Language Reference ........................................................................................ 174 Literal expressions .......................................................................................... 174 Properties, Arrays, Lists, Maps, Indexers ......................................................... 174 Inline lists ....................................................................................................... 175 Array construction ........................................................................................... 175 Methods ......................................................................................................... 176 Operators ....................................................................................................... 176 Relational operators ................................................................................ 176 Logical operators .................................................................................... 177 Mathematical operators ........................................................................... 177 Assignment .................................................................................................... 178 Types ............................................................................................................. 178 Constructors ................................................................................................... 179 Variables ........................................................................................................ 179 The #this and #root variables .................................................................. 179 Functions ....................................................................................................... 180 Bean references ............................................................................................. 180 Ternary Operator (If-Then-Else) ....................................................................... 180 The Elvis Operator ......................................................................................... 181 Safe Navigation operator ................................................................................ 181 Collection Selection ........................................................................................ 182 Collection Projection ....................................................................................... 182 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation vii Expression templating ..................................................................................... 183 7.6. Classes used in the examples .......................................................................... 183 8. Aspect Oriented Programming with Spring ................................................................... 187 8.1. Introduction ..................................................................................................... 187 AOP concepts ................................................................................................ 187 Spring AOP capabilities and goals ................................................................... 189 AOP Proxies .................................................................................................. 190 8.2. @AspectJ support ........................................................................................... 190 Enabling @AspectJ Support ............................................................................ 190 Enabling @AspectJ Support with Java configuration ................................. 190 Enabling @AspectJ Support with XML configuration ................................. 191 Declaring an aspect ........................................................................................ 191 Declaring a pointcut ........................................................................................ 192 Supported Pointcut Designators .............................................................. 192 Combining pointcut expressions .............................................................. 194 Sharing common pointcut definitions ........................................................ 194 Examples ............................................................................................... 196 Writing good pointcuts ............................................................................ 198 Declaring advice ............................................................................................. 199 Before advice ......................................................................................... 199 After returning advice .............................................................................. 200 After throwing advice .............................................................................. 200 After (finally) advice ................................................................................ 201 Around advice ........................................................................................ 202 Advice parameters .................................................................................. 203 Advice ordering ...................................................................................... 206 Introductions ................................................................................................... 206 Aspect instantiation models ............................................................................. 207 Example ......................................................................................................... 208 8.3. Schema-based AOP support ............................................................................ 209 Declaring an aspect ........................................................................................ 210 Declaring a pointcut ........................................................................................ 210 Declaring advice ............................................................................................. 212 Before advice ......................................................................................... 212 After returning advice .............................................................................. 212 After throwing advice .............................................................................. 213 After (finally) advice ................................................................................ 214 Around advice ........................................................................................ 214 Advice parameters .................................................................................. 215 Advice ordering ...................................................................................... 216 Introductions ................................................................................................... 217 Aspect instantiation models ............................................................................. 217 Advisors ......................................................................................................... 217 Example ......................................................................................................... 218 8.4. Choosing which AOP declaration style to use .................................................... 220 Spring AOP or full AspectJ? ........................................................................... 220 @AspectJ or XML for Spring AOP? ................................................................. 221 8.5. Mixing aspect types ......................................................................................... 222 8.6. Proxying mechanisms ...................................................................................... 222 Understanding AOP proxies ............................................................................ 223 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation viii 8.7. Programmatic creation of @AspectJ Proxies ..................................................... 225 8.8. Using AspectJ with Spring applications ............................................................. 225 Using AspectJ to dependency inject domain objects with Spring ........................ 226 Unit testing @Configurable objects .......................................................... 228 Working with multiple application contexts ................................................ 228 Other Spring aspects for AspectJ .................................................................... 229 Configuring AspectJ aspects using Spring IoC ................................................. 229 Load-time weaving with AspectJ in the Spring Framework ................................. 230 A first example ....................................................................................... 231 Aspects .................................................................................................. 234 ' META-INF/aop.xml' ............................................................................... 234 Required libraries (JARS) ........................................................................ 234 Spring configuration ................................................................................ 235 Environment-specific configuration ........................................................... 237 8.9. Further Resources ........................................................................................... 239 9. Spring AOP APIs ....................................................................................................... 240 9.1. Introduction ..................................................................................................... 240 9.2. Pointcut API in Spring ...................................................................................... 240 Concepts ........................................................................................................ 240 Operations on pointcuts .................................................................................. 241 AspectJ expression pointcuts .......................................................................... 241 Convenience pointcut implementations ............................................................ 241 Static pointcuts ....................................................................................... 241 Dynamic pointcuts .................................................................................. 242 Pointcut superclasses ..................................................................................... 243 Custom pointcuts ............................................................................................ 243 9.3. Advice API in Spring ........................................................................................ 243 Advice lifecycles ............................................................................................. 243 Advice types in Spring .................................................................................... 244 Interception around advice ...................................................................... 244 Before advice ......................................................................................... 244 Throws advice ........................................................................................ 245 After Returning advice ............................................................................ 246 Introduction advice .................................................................................. 247 9.4. Advisor API in Spring ....................................................................................... 249 9.5. Using the ProxyFactoryBean to create AOP proxies ........................................... 250 Basics ............................................................................................................ 250 JavaBean properties ....................................................................................... 250 JDK- and CGLIB-based proxies ...................................................................... 251 Proxying interfaces ......................................................................................... 252 Proxying classes ............................................................................................ 254 Using global advisors ...................................................................................... 255 9.6. Concise proxy definitions ................................................................................. 255 9.7. Creating AOP proxies programmatically with the ProxyFactory ............................ 256 9.8. Manipulating advised objects ............................................................................ 257 9.9. Using the "auto-proxy" facility ........................................................................... 258 Autoproxy bean definitions .............................................................................. 258 BeanNameAutoProxyCreator ................................................................... 259 DefaultAdvisorAutoProxyCreator .............................................................. 259 AbstractAdvisorAutoProxyCreator ............................................................ 260 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation ix Using metadata-driven auto-proxying ............................................................... 260 9.10. Using TargetSources ...................................................................................... 262 Hot swappable target sources ......................................................................... 263 Pooling target sources .................................................................................... 263 Prototype target sources ................................................................................. 265 ThreadLocal target sources ............................................................................. 265 9.11. Defining new Advice types ............................................................................. 265 9.12. Further resources ........................................................................................... 266 10. Testing ..................................................................................................................... 267 10.1. Introduction to Spring Testing ......................................................................... 267 10.2. Unit Testing ................................................................................................... 267 Mock Objects ................................................................................................. 267 Environment ........................................................................................... 267 JNDI ...................................................................................................... 267 Servlet API ............................................................................................. 267 Portlet API ............................................................................................. 268 Unit Testing support Classes .......................................................................... 268 General utilities ...................................................................................... 268 Spring MVC ........................................................................................... 268 10.3. Integration Testing ......................................................................................... 268 Overview ........................................................................................................ 268 Goals of Integration Testing ............................................................................ 269 Context management and caching ........................................................... 269 Dependency Injection of test fixtures ....................................................... 269 Transaction management ........................................................................ 270 Support classes for integration testing ..................................................... 270 JDBC Testing Support .................................................................................... 271 Annotations .................................................................................................... 271 Spring Testing Annotations ..................................................................... 271 Standard Annotation Support .................................................................. 276 Spring JUnit Testing Annotations ............................................................. 277 Meta-Annotation Support for Testing ........................................................ 278 Spring TestContext Framework ....................................................................... 279 Key abstractions ..................................................................................... 280 Context management .............................................................................. 281 Dependency injection of test fixtures ........................................................ 297 Testing request and session scoped beans .............................................. 299 Transaction management ........................................................................ 301 TestContext Framework support classes .................................................. 304 Spring MVC Test Framework .......................................................................... 306 Server-Side Tests ................................................................................... 306 Client-Side REST Tests .......................................................................... 312 PetClinic Example .......................................................................................... 313 10.4. Further Resources ......................................................................................... 314 IV. Data Access ..................................................................................................................... 316 11. Transaction Management .......................................................................................... 317 11.1. Introduction to Spring Framework transaction management .............................. 317 11.2. Advantages of the Spring Framework’s transaction support model ..................... 317 Global transactions ......................................................................................... 317 Local transactions ........................................................................................... 318 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation x Spring Framework’s consistent programming model ......................................... 318 11.3. Understanding the Spring Framework transaction abstraction ............................ 319 11.4. Synchronizing resources with transactions ....................................................... 323 High-level synchronization approach ................................................................ 323 Low-level synchronization approach ................................................................. 323 TransactionAwareDataSourceProxy ................................................................. 324 11.5. Declarative transaction management ............................................................... 324 Understanding the Spring Framework’s declarative transaction implementation ... 325 Example of declarative transaction implementation ........................................... 326 Rolling back a declarative transaction .............................................................. 330 Configuring different transactional semantics for different beans ........................ 331 <tx:advice/> settings ....................................................................................... 333 Using @Transactional ..................................................................................... 335 @Transactional settings .......................................................................... 339 Multiple Transaction Managers with @Transactional ................................. 340 Custom shortcut annotations ................................................................... 341 Transaction propagation .................................................................................. 341 Required ................................................................................................ 342 RequiresNew .......................................................................................... 342 Nested ................................................................................................... 343 Advising transactional operations ..................................................................... 343 Using @Transactional with AspectJ ................................................................. 346 11.6. Programmatic transaction management ........................................................... 347 Using the TransactionTemplate ....................................................................... 347 Specifying transaction settings ................................................................ 349 Using the PlatformTransactionManager ............................................................ 349 11.7. Choosing between programmatic and declarative transaction management ........ 350 11.8. Application server-specific integration .............................................................. 350 IBM WebSphere ............................................................................................. 351 Oracle WebLogic Server ................................................................................. 351 11.9. Solutions to common problems ....................................................................... 351 Use of the wrong transaction manager for a specific DataSource ....................... 351 11.10. Further Resources ....................................................................................... 351 12. DAO support ............................................................................................................ 352 12.1. Introduction .................................................................................................... 352 12.2. Consistent exception hierarchy ....................................................................... 352 12.3. Annotations used for configuring DAO or Repository classes ............................ 353 13. Data access with JDBC ............................................................................................ 355 13.1. Introduction to Spring Framework JDBC .......................................................... 355 Choosing an approach for JDBC database access ........................................... 355 Package hierarchy .......................................................................................... 356 13.2. Using the JDBC core classes to control basic JDBC processing and error handling ................................................................................................................. 357 JdbcTemplate ................................................................................................. 357 Examples of JdbcTemplate class usage ................................................... 357 JdbcTemplate best practices ................................................................... 359 NamedParameterJdbcTemplate ....................................................................... 361 SQLExceptionTranslator .................................................................................. 363 Executing statements ...................................................................................... 365 Running queries ............................................................................................. 365 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation xi Updating the database .................................................................................... 366 Retrieving auto-generated keys ....................................................................... 367 13.3. Controlling database connections .................................................................... 367 DataSource .................................................................................................... 367 DataSourceUtils .............................................................................................. 369 SmartDataSource ........................................................................................... 369 AbstractDataSource ........................................................................................ 369 SingleConnectionDataSource .......................................................................... 369 DriverManagerDataSource .............................................................................. 369 TransactionAwareDataSourceProxy ................................................................. 370 DataSourceTransactionManager ...................................................................... 370 NativeJdbcExtractor ........................................................................................ 370 13.4. JDBC batch operations .................................................................................. 371 Basic batch operations with the JdbcTemplate ................................................. 371 Batch operations with a List of objects ............................................................. 372 Batch operations with multiple batches ............................................................ 373 13.5. Simplifying JDBC operations with the SimpleJdbc classes ................................ 374 Inserting data using SimpleJdbcInsert .............................................................. 374 Retrieving auto-generated keys using SimpleJdbcInsert .................................... 375 Specifying columns for a SimpleJdbcInsert ...................................................... 376 Using SqlParameterSource to provide parameter values ................................... 376 Calling a stored procedure with SimpleJdbcCall ............................................... 377 Explicitly declaring parameters to use for a SimpleJdbcCall ............................... 379 How to define SqlParameters .......................................................................... 380 Calling a stored function using SimpleJdbcCall ................................................. 381 Returning ResultSet/REF Cursor from a SimpleJdbcCall ................................... 381 13.6. Modeling JDBC operations as Java objects ..................................................... 382 SqlQuery ........................................................................................................ 383 MappingSqlQuery ........................................................................................... 383 SqlUpdate ...................................................................................................... 384 StoredProcedure ............................................................................................. 385 13.7. Common problems with parameter and data value handling .............................. 388 Providing SQL type information for parameters ................................................. 389 Handling BLOB and CLOB objects .................................................................. 389 Passing in lists of values for IN clause ............................................................ 390 Handling complex types for stored procedure calls ........................................... 391 13.8. Embedded database support .......................................................................... 392 Why use an embedded database? .................................................................. 392 Creating an embedded database instance using Spring XML ............................ 392 Creating an embedded database instance programmatically .............................. 392 Extending the embedded database support ...................................................... 393 Using HSQL ................................................................................................... 393 Using H2 ........................................................................................................ 393 Using Derby ................................................................................................... 393 Testing data access logic with an embedded database ..................................... 393 13.9. Initializing a DataSource ................................................................................. 394 Initializing a database instance using Spring XML ............................................. 394 Initialization of Other Components that Depend on the Database ............... 395 14. Object Relational Mapping (ORM) Data Access .......................................................... 397 14.1. Introduction to ORM with Spring ..................................................................... 397 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation xii 14.2. General ORM integration considerations ......................................................... 398 Resource and transaction management ........................................................... 398 Exception translation ....................................................................................... 399 14.3. Hibernate ....................................................................................................... 399 SessionFactory setup in a Spring container ...................................................... 400 Implementing DAOs based on plain Hibernate 3 API ........................................ 400 Declarative transaction demarcation ................................................................ 402 Programmatic transaction demarcation ............................................................ 404 Transaction management strategies ................................................................ 405 Comparing container-managed and locally defined resources ............................ 407 Spurious application server warnings with Hibernate ......................................... 408 14.4. JDO .............................................................................................................. 409 PersistenceManagerFactory setup ................................................................... 409 Implementing DAOs based on the plain JDO API ............................................. 410 Transaction management ................................................................................ 412 JdoDialect ...................................................................................................... 413 14.5. JPA ............................................................................................................... 414 Three options for JPA setup in a Spring environment ........................................ 414 LocalEntityManagerFactoryBean .............................................................. 414 Obtaining an EntityManagerFactory from JNDI ......................................... 415 LocalContainerEntityManagerFactoryBean ............................................... 415 Dealing with multiple persistence units ..................................................... 417 Implementing DAOs based on plain JPA .......................................................... 418 Transaction Management ................................................................................ 420 JpaDialect ...................................................................................................... 421 15. Marshalling XML using O/X Mappers ......................................................................... 423 15.1. Introduction .................................................................................................... 423 Ease of configuration ...................................................................................... 423 Consistent Interfaces ...................................................................................... 423 Consistent Exception Hierarchy ....................................................................... 423 15.2. Marshaller and Unmarshaller .......................................................................... 423 Marshaller ...................................................................................................... 423 Unmarshaller .................................................................................................. 424 XmlMappingException ..................................................................................... 425 15.3. Using Marshaller and Unmarshaller ................................................................. 425 15.4. XML Schema-based Configuration .................................................................. 427 15.5. JAXB ............................................................................................................. 427 Jaxb2Marshaller ............................................................................................. 428 XML Schema-based Configuration ........................................................... 428 15.6. Castor ........................................................................................................... 429 CastorMarshaller ............................................................................................ 429 Mapping ......................................................................................................... 429 XML Schema-based Configuration ........................................................... 429 15.7. XMLBeans ..................................................................................................... 430 XmlBeansMarshaller ....................................................................................... 430 XML Schema-based Configuration ........................................................... 430 15.8. JiBX .............................................................................................................. 431 JibxMarshaller ................................................................................................ 431 XML Schema-based Configuration ........................................................... 431 15.9. XStream ........................................................................................................ 432 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation xiii XStreamMarshaller ......................................................................................... 432 V. The Web ........................................................................................................................... 434 16. Web MVC framework ................................................................................................ 435 16.1. Introduction to Spring Web MVC framework .................................................... 435 Features of Spring Web MVC ......................................................................... 436 Pluggability of other MVC implementations ...................................................... 437 16.2. The DispatcherServlet .................................................................................... 437 Special Bean Types In the WebApplicationContext ........................................... 440 Default DispatcherServlet Configuration ........................................................... 441 DispatcherServlet Processing Sequence .......................................................... 441 16.3. Implementing Controllers ................................................................................ 443 Defining a controller with @Controller .............................................................. 443 Mapping Requests With Using @RequestMapping ........................................... 444 New Support Classes for @RequestMapping methods in Spring MVC 3.1 .. 446 URI Template Patterns ........................................................................... 447 URI Template Patterns with Regular Expressions ..................................... 448 Path Patterns ......................................................................................... 449 Patterns with Placeholders ...................................................................... 449 Matrix Variables ...................................................................................... 449 Consumable Media Types ....................................................................... 450 Producible Media Types .......................................................................... 451 Request Parameters and Header Values ................................................. 451 Defining @RequestMapping handler methods .................................................. 452 Supported method argument types .......................................................... 452 Supported method return types ............................................................... 454 Binding request parameters to method parameters with @RequestParam ... 455 Mapping the request body with the @RequestBody annotation .................. 456 Mapping the response body with the @ResponseBody annotation ............. 457 Creating REST Controllers with the @RestController annotation ................ 457 Using HttpEntity ...................................................................................... 457 Using @ModelAttribute on a method ....................................................... 458 Using @ModelAttribute on a method argument ......................................... 459 Using @SessionAttributes to store model attributes in the HTTP session between requests ................................................................................... 461 Specifying redirect and flash attributes ..................................................... 461 Working with "application/x-www-form-urlencoded" data ............................ 462 Mapping cookie values with the @CookieValue annotation ........................ 462 Mapping request header attributes with the @RequestHeader annotation ... 463 Method Parameters And Type Conversion ............................................... 463 Customizing WebDataBinder initialization ................................................. 464 Support for the Last-Modified Response Header To Facilitate Content Caching ................................................................................................. 465 Assisting Controllers with the @ControllerAdvice annotation ...................... 465 Asynchronous Request Processing .................................................................. 466 Exception Handling for Async Requests ................................................... 467 Intercepting Async Requests ................................................................... 467 Configuration for Async Request Processing ............................................ 468 Testing Controllers ......................................................................................... 469 16.4. Handler mappings .......................................................................................... 469 Intercepting requests with a HandlerInterceptor ................................................ 469 Spring Framework 4.0.0.RELEASE Spring Framework Reference Documentation xiv 16.5. Resolving views ............................................................................................. 471 Resolving views with the ViewResolver interface .............................................. 471 Chaining ViewResolvers ................................................................................. 473 Redirecting to views ....................................................................................... 474 RedirectView .......................................................................................... 474 The redirect: prefix ................................................................................. 475 The forward: prefix ................................................................................. 475 ContentNegotiatingViewResolver ..................................................................... 475 16.6. Using flash attributes ..................................................................................... 478 16.7. Building URIs ................................................................................................. 479 16.8. Building URIs to Controllers and methods ....................................................... 480 16.9. Using locales ................................................................................................. 480 Obtaining Time Zone Information .................................................................... 481 AcceptHeaderLocaleResolver .......................................................................... 481 CookieLocaleResolver ..................................................................................... 481 SessionLocaleResolver ................................................................................... 481 LocaleChangeInterceptor ................................................................................ 482 16.10. Using themes ............................................................................................... 482 Overview of themes ........................................................................................ 482 Defining themes ............................................................................................. 482 Theme resolvers ............................................................................................. 483 16.11. Spring’s multipart (file upload) support ........................................................... 483 Introduction .................................................................................................... 483 Using a MultipartResolver with Commons FileUpload ........................................ 484 Using a MultipartResolver with Servlet 3.0 ....................................................... 484 Handling a file upload in a form ...................................................................... 484 Handling a file upload request from programmatic clients .................................. 486 16.12. Handling exceptions ..................................................................................... 486 HandlerExceptionResolver ............

2015-05-28

微信公众平台服务器

#快速搭建微信公众平台服务器 简单封装了所有与微信服务器交互的消息:文本消息、图片消息、图文消息等等 提供了基于`springmvc`以及基于`servlet`框架的控制器,集成了微信服务器绑定、监听所有类型消息的方法 使用时继承,重写即可,十分方便 v1.2.0开始支持高级接口的API,https请求基于org.apache.httpcomponents 4.3.X,json解析基于fastjson 1.1.X 框架中提供MenuAPI、CustomAPI、QrcodeAPI、UserAPI、MediaAPI、OauthAPI用于实现所有高级接口功能,使用极其简单 内部实现token过期自动刷新,不用再关注token细节

2015-05-11

JFinal-JFinal

JFinal 是基于Java 语言的极速 web 开发框架,其核心设计目标是开发迅速、代码量少、学习简单、功能强大、轻量级、易扩展、Restful。在拥有Java语言所有优势的同时再拥有ruby、python等动态语言的开发效率

2015-05-05

银行管理系统

本系统是基于C#+sqlserver2008开发的,实现了基本的银行业务

2013-06-10

OA办公系统V1.0源码.rar

本系统是基于C#+sqlserver2008开发的

2013-06-10

Linux C程序设计大全

第1篇 Linux下C语言基础 第1章 Linux简介 1.1 GNU简介 1.2 Linux简介 1.2.1 Linux发展史 1.2.2 Linux发行版 1.2.3 Linux内核版本 1.2.4 Linux与UNIX的关系 1.2.5 Linux在服务器方面的发展 1.2.6 Linux在嵌入式系统方面的发展 1.2.7 Linux在桌面系统方面的发展 1.3 Linux环境下的其他编程语言 1.3.1 C++ 1.3.2 Java 1.3.3 Perl 1.3.4 Python 1.3.5 Ruby 1.3.6 PHP 第2章 控制结构 2.1 goto语句 2.1.1 C语言中的无条件跳转 2.1.2 使用goto语句进行出错处理 2.1.3 出错处理的一般模型 2.2 C语言中的分支结构 2.2.1 分支结构的翻译 2.2.2 使用goto语句实现分支结构 2.3 短路计算 2.3.1 短路计算 2.3.2 &&运算的短路计算 2.3.3 ||运算的短路计算 2.4 C语言中的循环结构 2.4.1 while循环 2.4.2 do…while循环 2.4.3 for循环 2.5 switch语句 2.5.1 switch语句的应用 2.5.2 使用goto语句实现switch语句 2.6 优化控制结构 2.6.1 表达式优化——使用替换程序中的乘除法 2.6.2  表达式优化——常量折叠 2.6.3 表达式优化——使用数学公式 2.6.4 表达式优化——存储问题 2.6.5 分支优化——改变判断顺序 2.6.6 分支优化——使用switch语句 2.6.7 循环优化——一次性计算 第3章 C语言中的函数 3.1 函数的本质 3.2 变量的作用域和生命期 3.2.1 全局变量 3.2.2 局部变量 3.3 变量的初始值 3.3.1 全局变量的初始值 3.3.2 局部变量的初始值 3.4 与函数有关的优化 3.4.1 函数调用与程序优化 3.4.2 变量存储优化 3.5 编写多文件程序——变量的存储类别 3.5.1 存储类别 3.5.2 static变量的作用——改变变量的生命期 3.5.3 static变量的作用——实现封装和模块化设计 3.6 编写多文件的程序——链接的作用 3.6.1 链接多个文件 3.6.2 链接时符号解析规则 3.6.3 链接规则的应用 3.7 可变参数 3.7.1 可变参数的概念 3.7.2 实现一个简单的可变参数的函数 3.7.3 可变参数实例 3.7.4 关于printf函数的疑问——缺少整型参数 3.7.5 关于printf函数的疑问——缺少字符串地址参数 第4章 C语言中的指针与字符串 4.1 sizeof运算符 4.1.1 sizeof运算符的应用——得到内置类型的大小 4.1.2 sizeof运算符的应用——得到复合类型的大小 4.2 指针的应用 4.2.1 指针与别名陷阱 4.2.2 数组的指针 4.2.3 指针的指针 4.2.4 指针与参数传递 4.2.5 指针类型的意义 4.2.6 void*型指针 4.3 函数的指针 4.3.1 C语言中的函数指针 4.3.2 函数指针的应用——回调函数 4.3.3 函数指针数组 4.4 字符串 4.4.1 字符串与字符数组 4.4.2 字符串与指针 4.4.3 限定修饰符const 4.4.4 const关键字修饰指针——在指针定义之前 4.4.5 const关键字修饰指针——在指针定义之中 4.4.6 const关键字修饰指针——在指针定义之前和定义之中 4.4.7 使用const关键字的意义 第5章 C语言的高级技术 第2篇 C语言开发环境 第6章 vi与vim编辑器 第7章 gcc编译器 第8章 makefile 第9章 gdb 第3篇 Linux进程操作 第10章 进程环境 第11章 进程控制 第12章 时间和日历历程 第13章 信号及信号处理 第14章 进程间通信 第15章 线程 第4篇 Linux文件操作 第17章 文件I/O 第18章 文件管理 第19章 目录操作 第20章 特殊文件 第21章 基于流的I/O 第5篇 Linux网络编程 第22章 TCP和UDP协议 第23章 网络编程基础 第24章 网络编程进阶 第25章 网络编程实例——实现文件传输程序 第26章 网络编程实例——简单的Web服务器 第6篇 shell脚本知识 第27章 shell脚本基础 第28章 shell脚本中的控制结构 844

2013-05-15

C#开发技术大全

第1篇 开发环境及C#语言简介. 第1章 Visual Studio 2008介绍 2 1.1 .NET概述 2 1.1.1 .NET发展史 2 1.1.2 中间语言 3 1.1.3 垃圾收集器 4 1.2 .NET Framework 概述 5 1.2.1 .NET Framework 概述 5 1.2.2 公共语言运行时 7 1.2.3 基类库 7 1.2.4 公共语言运行规范 9 1.3 Visual Studio 2008的新特性 9 1.4 Visual Studio 2008开发环境介绍 10 1.4.1 Visual Studio 2008的安装 10 1.4.2 项目模板 12 1.4.3 网站模板 14 1.4.4 文件模板 15 1.4.5 Visual Studio 2008 IDE 概述 16

2013-05-15

ActionScript开发技术大全

第1篇ActionScript3.0语言基础 第1章ActionScript3.0概述 2 1.1ActionScript概述 2 1.1.1ActionScript环境 2 1.1.2ActionScript3.0特性 3 1.1.3ActionScript3.0代码组织 5 1.2ActionScript3.0API概览 5 1.3小结 8 第2章搭建ActionScript3.0开发环境 9 2.1搭建基于FlashCS3IDE的开发环境 9 2.1.1安装FlashCS3ID 9 2.1.2安装FlashCS3IDEupdate9.0.2 11 2.1.3在FlashCS3IDE下创建ActionScript3.0项目 11 2.2搭建基于Flex的开发环境 13 2.2.1安装FlexBuilder3 13 2.2.2在FlexBuilder3下创建ActionScript3.0项目 15 2.3服务端部署 16 2.3.1安装JDK 16 2.3.2安装Tomcat服务器 18 2.3.3Tomcat集成RED5服务器 20 2.4安装VisualBasic6.0 22 2.5小结 23 第3章ActionScript3.0语法 24 3.1变量 24 3.1.1变量声明 24 3.1.2变量赋值 25 3.1.3变量的生存周期 26 3.2基本数据类型 27 3.2.1Object类型 28 3.2.2int类型 28 3.2.3uint类型 29 3.2.4Number类型 30 3.2.5Boolean类型 32 3.2.6String类型 33 3.2.7Null类型 34 3.2.8void类型和*类型 34 3.3动态数据类型检查 35 3.4变量的类型转换 37 3.5ActionScript3.0语法 38 3.5.1大小写敏感 38 3.5.2字面量 38 3.5.3分号 39 3.5.4点号 39 3.5.5括号 39 3.5.6常量 40 3.5.7注释 41 3.5.8关键字与保留字 41 3.6操作符 42 3.6.1ActionScript3.0的运算规则 42 3.6.2初始化操作符 43 3.6.3数学操作符 43 3.6.4位运算符 45 3.6.5赋值操作符 47 3.6.6关系操作符 47 3.6.7逻辑操作符 48 3.6.8条件操作符 49 3.6.9E4X操作符 49 3.7条件语句 50 3.7.1if…else语句 50 3.7.2switch语句 53 3.8循环语句 55 3.8.1while语句 55 3.8.2do…while语句 56 3.8.3for语句 56 3.8.4for…in语句 57 3.8.5foreach…in语句 58 3.8.6break与continue 59 3.9函数 60 3.9.1函数的基本概念 60 3.9.2函数定义与调用 60 3.9.3函数的参数 63 3.9.4函数的返回值 66 3.9.5函数对象 66 3.9.6函数的生存周期 67 3.9.7递归函数 68 3.9.8全局函数 69 3.10小结 72 第2篇ActionScript3.0面向对象特性 第4章ActionScript3.0面向对象编程 74 4.1面向对象编程 74 4.1.1对象的世界 74 4.1.2具体与抽象 75 4.2类 75 4.2.1类的定义 76 4.2.2类的属性 78 4.2.3类的方法 80 4.2.4对象成员与静态成员 83 4.2.5this关键字 84 4.2.6动态类 85 4.3接口 86 4.3.1接口定义 86 4.3.2接口实现 87 4.3.3接口应用 87 4.4继承 89 4.4.1实现继承 89 4.4.2对象成员的继承 90 4.4.3静态成员继承 93 4.5包 94 4.5.1创建包 94 4.5.2类路径 95 4.5.3使用包 98 4.6订单利润计算示例 99 4.6.1需求分析 99 4.6.2编写代码 100 4.7小结 103 第5章ActionScript3.0中的String对象 104 5.1创建String对象 104 5.2字符串处理 105 5.2.1字符处理 105 5.2.2字符串比较 107 5.2.3裁割与连接 108 5.2.4查找、匹配与替换 110 5.2.5提取子串 112 5.2.6大小写转换 113 5.2.7空白处理 114 5.3制作文字移动效果 115 5.4小结 116 第6章ActionScript3.0中的Array类型 117 6.1索引数组 117 6.1.1创建索引数组 117 6.1.2数组元素的语句遍历 118 6.1.3数组元素的函数遍历 120 6.1.4元素处理 123 6.1.5数组复制 126 6.1.6查找与匹配 127 6.1.7数组排序 128 6.1.8数组与字符串 131 6.2关联数组 131 6.2.1Object类实现的关联数组 132 6.2.2Dictionary类实现的关联数组 132 6.3多维数组 133 6.4太阳系行星排序示例 135 6.5小结 138 第7章ActionScript3.0中的日期和时间 139 7.1日期与时间 139 7.1.1创建日期对象 139 7.1.2日期对象的属性与方法 140 7.1.3日期格式化 143 7.2时间间隔 144 7.2.1使用Timer类 144 7.2.2秒表示例 146 7.3小结 149 第8章ActionScript3.0异常处理 150 8.1ActionScript3.0异常 150 8.1.1异常概述 150 8.1.2异常分类 150 8.2ActionScript3.0调试方法 152 8.2.1FlashPlayer的调试版本 152 8.2.2在FlashCS3IDE中调试 152 8.2.3在FlexBuilder3中进行调试 155 8.3处理ActionScript3.0中的异常 160 8.3.1使用try…catch…finally语句 160 8.3.2throw语句主动抛出异常 162 8.3.3处理异常事件 163 8.4异常类型 163 8.4.1异常对象 164 8.4.2异常分类 164 8.4.3自定义异常类型 166 8.5小结 167 第3篇ActionScript3.0可视化编程 第9章可视化编程基础 170 9.1可视化编程模型 170 9.1.1可视化编程概述 170 9.1.2可视对象 172 9.1.3可视对象列表 175 9.1.4可视对象管理函数 181 9.2文档类绑定和元件类绑定 194 9.2.1Flash文档类绑定 195 9.2.2元件类绑定 196 9.3小结 198 第10章对象交互与事件???199 10.1ActionScript3.0事件模型 199 10.1.1事件流 200 10.1.2事件侦听器 204 10.2事件对象 208 10.2.1事件类型基类Event 208 10.2.2鼠标事件类型MouseEvent 211 10.2.3键盘事件KeyboardEvent 213 10.2.4文本事件类TextEvent 214 10.2.5焦点事件FocusEvent 214 10.2.6计时器事件TimerEvent 216 10.2.7HTTP状态事件HTTPStatusEvent 216 10.2.8网络状态事件NetStatusEvent 216 10.2.9进度事件ProgressEvent 217 10.2.10异步异常事件ErrorEvent、IOErrorEvent、SecurityErrorEvent 218 10.2.11全屏事件FullScreenEvent 219 10.3虚拟键盘示例 220 10.4小结 224 .第11章ActionScript3.0可视对象 225 11.1可视对象类DisplayObject 225 11.1.1可视对象列表 225 11.1.2位置、尺寸、透明度与可见性 227 11.1.3缩放与旋转 228 11.1.4坐标体系 231 11.1.5背景色 232 11.1.6区域与范围 233 11.1.7色彩调整 235 11.1.8遮罩 236 11.1.9位图缓存 237 11.1.10混合模式 238 11.2舞台对象Stage 239 11.2.1图像品质与帧频 239 11.2.2缩放与对齐 240 11.2.3焦点控制 242 11.2.4交互控制 242 11.2.5全屏?刂?243 11.3容器对象Sprite 245 11.3.1按钮模式 245 11.3.2热区 246 11.3.3对象拖放 247 11.4影片剪辑MovieClip 248 11.5加载器Loader 251 11.6按钮对象SimpleButton 254 11.7文本框TextField 255 11.7.1文本类型 255 11.7.2外观控制 256 11.7.3设置文本 256 11.7.4处理HTML 258 11.7.5输入限制 260 11.7.6文本格式化 260 11.7.7多行模式 262 11.7.8适应与滚动 263 11.7.9选区 264 11.7.10字体嵌入 265 11.7.11事件处理 268 11.8小结 269 第4篇ActionScript3.0数据处理 第12章数字类型与数学运算 272 12.1数字类型概述 272 12.2Math类 273 12.2.1角度与弧度 273 12.2.2Math常量 273 12.2.3最大值、最小值与绝对值 274 12.2.4数值舍入与随机函数 274 12.2.5幂运算与开方运算 275 12.2.6对数函数 276 12.2.7坐标与弧度 276 12.2.8三角函数 277 12.3求解一元二次方程示例 278 12.4小结 279 第13章XML应用基础 280 13.1了解XML 280 13.2处理XML数据 283 13.2.1初始化XML对象 283 13.2.2访问与遍历 285 13.3XML对象 288 13.3.1XML对象的数据处理方式 288 13.3.2处理子节点 289 13.3.3访问XML数据 293 13.3.4处理命名空间 294 13.4网络图片加载器示例 295 13.5小结 298 第14章正则表达式与字符串匹配 299 14.1正则表达式概述 299 14.2正则表达式语法 300 14.2.1创建对象 300 14.2.2字符、元字符与元序列 301 14.2.3字符集 306 14.2.4组 307 14.3标记、属性与方法 310 14.3.1正则表达式的标记与属性 310 14.3.2正则表达式的方法 314 14.4小结 315 第5篇ActionScript3.0图形编程 第15章ActionScript3.0中的几何对象 318 15.1Point对象 318 15.1.1创建Point对象 318 15.1.2距离计算 319 15.1.3中间点 319 15.1.4极坐标转换 319 15.1.5坐标计算 320 15.1.6坐标缩放 320 15.2矩形对象 321 15.2.1创建Rectangle对象 321 15.2.2确定矩形位置 321 15.2.3调整矩形 322 15.2.4位置关系判定 324 15.3矩阵对象 325 15.3.1初始化Matrix对象 326 15.3.2矩阵应用 327 15.4小结 328 第16章ActionScript3.0图形绘制 329 16.1绘制矢量图形 329 16.1.1位图与矢量图 329 16.1.2绘制矢量图 330 16.2使用线条 330 16.2.1设置线条样式 331 16.2.2直线与曲线 332 16.3使用填充 334 16.3.1单一色填充 335 16.3.2渐变色填充 336 16.3.3位图填充 337 16.4图形绘制函数 338 16.4.1内置图形绘制函数 338 16.4.2绘制三角形 340 16.4.3绘制正多边形 340 16.5白板示例 341 16.6小结 345 第17章ActionScript3.0运动编程 346 17.1运动编程原理 346 17.1.1物体移动 346 17.1.2坐标计算 348 17.2简单物理引擎 352 17.2.1运动的物理原理 352 17.2.2创建物理引擎 354 17.2.3匀速直线运动 363 17.2.4匀加速运动 364 17.2.5圆周运动 365 17.2.6卫星绕地运动 366 17.3小结 368 第18章位图处理 369 18.1位图对象 369 18.1.1位图格式 369 18.1.2位图图像与位图数据 370 18.1.3创建位图对象 370 18.1.4载入位图对象 371 18.2处理位图数据 371 18.2.1位图复制 372 18.2.2像素处理 376 18.2.3位图填充 378 18.2.4生成噪点 379 18.2.5图像滚动 381 18.2.6色彩调整 382 18.2.7阀值处理 383 18.2.8图像混合 384 18.3位图画板示例 386 18.4小结 392 第19章ActionScript3.0滤镜 393 19.1使用滤镜 393 19.1.1滤镜原理 393 19.1.2对可视对象应用滤镜 394 19.1.3对位图数据应用滤镜 395 19.2投影滤镜DropShadowFilter 396 19.3发光滤镜GlowFilter 398 19.4渐变发光滤镜GradientGlowFilter 399 19.5模糊滤镜BlurFilter 401 19.6斜角滤镜BevelFilter 403 19.7渐变斜角滤镜GradientBevelFilter 404 19.8色彩矩阵滤镜ColorMatrixFilter 406 19.9矩阵盘绕滤镜ConvolutionFilter 408 19.10置换滤镜DisplacementMapFilter 410 19.11滤镜切换的相册示例 412 19.12小结 415 第6篇ActionScript3.0多媒体编程 第20章音频编程 418 20.1音频概述 418 20.2播放声音 418 20.2.1音频嵌入 419 20.2.2音频载入 420 20.2.3流式音频 422 20.3播放控制 424 20.3.1缓冲控制 424 20.3.2回放控制 424 20.3.3音效控制 425 20.4MP3播放器 425 20.5使用麦克风 434 20.5.1获取麦克风 434 20.5.2回环模式 435 20.5.3静音设置 436 20.6录制音频到RED5服务器 436 20.7小结 442 第21章视频编程 443 21.1FLV视频 443 21.1.1视频概述 443 21.1.2视频转换 444 21.2播放视频 445 21.2.1视频嵌入 445 21.2.2组件播放 446 21.2.3视频载入 447 21.2.4流式视频 449 21.3播放控制 450 21.3.1缓冲控制 450 21.3.2回放控制 451 21.3.3视频音效 453 21.4视频播放器示例 453 21.4.1视频载入播放器 453 21.4.2视频流播放器 461 21.5使用摄像头 467 21.5.1获取摄像头 467 21.5.2模式设置 468 21.5.3本地回放 469 21.5.4运动检测 469 21.5.5图像质量 469 21.5.6视频录制 470 21.6录制视频到RED5服务器 471 21.7小结 477 第7篇ActionScript3.0数据通信 第22章本地通信 480 22.1本地连接LocalConnection 480 22.1.1使用本地连接 480 22.1.2异域调用 481 22.1.3应用授权示例 482 22.2本地数据存储 486 22.2.1使用SharedObject本地存储 486 22.2.2用户登录示例 487 22.3小结 491 第23章网络通信 492 23.1处理外部数据 492 23.1.1请求与参数 492 23.1.2简单数据发送 493 23.1.3数据发送与载入 494 23.1.4图片载入示例 497 23.2远程数据共享 499 23.2.1使用远程共享 499 23.2.2绘图共享示例 500 23.3FlashRemoting调用远程方法 503 23.3.1调用远程方法 503 23.3.2远程调用示例 505 23.4套接字通信 506 23.4.1使用套接字通信 506 23.4.2套接字通信示例 508 23.5文件上传与下载 512 23.5.1文件上传 512 23.5.2文件下载 515 23.5.3文件上传下载示例 515 23.6小结 520 第8篇深入FlashPlayer 第24章FlashPlayer的客户端系统 522 24.1系统类System 522 24.1.1设置编码 522 24.1.2内存使用 522 24.1.3播放器控制 523 24.1.4剪贴板 523 24.1.5System类功能示例 524 24.2获取系统信息 526 24.2.1使用Capabilities类 527 24.2.2本地机器特性检测示例 528 24.3输入法编辑器IME控制 530 24.3.1使用IME 530 24.3.2IME控制示例 532 24.4fscommand()函数 535 24.4.1使用fscommand()函数 535 24.4.2fscommad()函数示例 537 24.5小结 539 第25章FlashPlayer的安全特性 540 25.1安全性概述 540 25.1.1权限管控模型 540 25.1.2安全沙箱模型 541 25.2系统管理员管控 543 25.2.1使用mms.cfg配置文件 543 25.2.2全局信任目录管控 548 25.3用户管控 548 25.3.1使用FlashPlayer设置对话框 549 22.3.2使用全局设置管理器 550 25.3.3用户受信任目录 553 25.4FlashPlayer许可控制 554 25.4.1内容载入许可 554 25.4.2交叉域与跨脚本访问许可 555 25.4.3宿主程序中的安全许可 556 25.4.4全屏模式安全许可 557 25.4.5本地连接安全许可 557 25.5交叉域安全示例 558 25.5.1创建测试的SWF 558 25.5.2跨脚本访问测试 562 25.5.3文本载入测试 563 25.6小结 564 第26章FlashPlayer与宿主程序 565 26.1使用外部接口ExternalInterface类 565 26.1.1ExternalInterface类 565 26.1.2ActionScript与JavaScript交互 566 26.1.3ActionScript与桌面程序交互 567 26.2网页脚本交互示例 568 26.3桌面应用交互示例 571 26.4小结 573 第27章ActionScript打印控制 574 27.1使用打印作业对象 574 27.1.1创建与启动打印作业 574 27.1.2设置打印内容 575 27.1.3打印调整 576 27.2打印示例 577 27.3小结 582 第9篇FlashAIR入门 第28章创建与部署AIR应用 584 28.1AdobeAIR运行时安装与配置 584 28.2使用FlashCS3IDE创建和部署AIR应用 585 28.2.1安装FlashCS3IDEupdate9.0.3 585 28.2.2创建和部署AIR应用 585 28.3使用FlexBuilder3创建和部署AIR应用 588 28.4AIR应用配置文件 591 28.4.1应用程序配置 591 28.4.2初始化窗口设置 595 28.4.3图标设置 595 28.4.4关联文??柚?596 28.5小结 597 第29章AIR部分特性介绍 598 29.1AIR本地窗口 598 29.1.1创建与关闭本地窗口 598 29.1.2添加窗体内容 600 29.1.3位置与尺寸 600 29.1.4窗口层叠控制 602 29.1.5本地窗口控制示例 602 29.2访问文件系统 612 29.2.1目录与文件引用 612 29.2.2目录与文件浏览 614 29.2.3目录与文件属性 615 29.2.4快速载入与保存 616 29.2.5目录与文件管理 617 29.2.6目录与文件管理示例 620 29.2.7文件内容读写 626 29.2.8文件内容读写示例 629 29.3访问数据库 632 29.3.1使用数据库连接 632 29.3.2建立数据表 634 29.3.3插入数据 635 29.3.4设置SQL语句参数 636 29.3.5查询数据 636 29.3.6用户注册与登录示例 637 29.4小结 642 第10篇实战篇 第30章AdobeAIR应用——本地播放器 644 30.1分析与设计 644 30.1.1功能分析 644 30.1.2界面设计 645 30.1.3模块设置 647 30.2建立项目 649 30.3创建新组件 650 30.3.1创建滚动容器组件 650 30.3.2创建复选框组件 653 30.3.3创建缓冲与播放控制条 655 30.4创建播放器工具类 656 30.4.1创建数据库工具类 656 30.4.2创建字符串?ぞ呃?658 30.5创建数据模块 659 30.5.1创建MediaFile类 659 30.5.2创建MediaFileList类 662 30.6创建播放器事件类 665 30.7创建播放器内核 666 30.7.1创建IMediaPlayerCore接口 667 30.7.2创建播放器内核基类 667 30.7.3创建MP3播放内核 671 30.7.4创建FLV播放内核 675 30.8创建播放器界面 680 30.8.1创建MediaFileItemUI类 680 30.8.2创建MediaFileListUI类 682 30.8.3创建播放列表管理器类 684 30.8.4创建播放控制面板类 686 30.8.5创建视频部件 689 30.8.6创建播放器整体部件 691 30.9测试主程序 696 30.10小结 697 第31章AsWing应用——聊天室程序 698 31.1分析与设计 698 31.1.1功能分析 698 31.1.2界面设计 699 31.1.3AsWing简介 700 31.2部署服务端 700 31.3创建客户端项目 704 31.4创建聊天室界面 706 31.4.1创建登录窗口 706 31.4.2创建用户聊天界面 711 31.5创建聊天室通信与控制组件 715 31.5.1定义DataEvent事件类 715 31.5.2添加IServerApi接口 716 31.5.3定义HTTPWeb应用通信与控制类 716 31.5.4定义RTMP通信与控制类 719 31.6测试主程序 722 31.7小结 723

2013-05-15

108个Photoshop数码照片处理典型实例.part5.rar

《108个Photoshop数码照片处理典型实例》是一本介绍数码照片后期处理技巧与方法的实用手册,由图形图像专家和专业摄影师编写,精选了108个具有代表性的照片处理实例,这些实例具有贴近生活,源于实际的特点。作者将这108个实例归类到8个处理专区,分别为照片初步处理专区;修饰照片专区;人像美容和美化专区;风景照艺术处理专区;艺术照片制作专区;照片特效制作专区;相册制作专区;照片的输出和打印专区。 01 照片初步处理专区 实例01 修改照片的尺寸 实例02 制作构图完美的照片 实例03 清除照片上多余的背景 实例04 扶正倾斜的照片 实例05 旋转与翻转照片 实例06 调整模糊的照片 实例07 调整过暗的照片 实例08 使灰蒙蒙的照片变清晰 实例09 调整过亮的照片 实例10 校正偏色的照片 实例11 让照片色彩更饱满 实例12 调整照片的色调 实例13 修复逆光照片 实例14 去除红眼 02 修饰照片专区 实例15 去除噪点 实例16 修复褪色的彩色照片 实例l7 调整偏白的黑白照片 实例l8 修复损坏的老照片 实例l9 为老照片去除网纹 实例20 修复有折痕的照片 实例21 修补缺失的照片 实例22 黑白老相片翻新 03 人像美容和美化专区 04 风景照艺术处理专区 05 艺术照片制作专区 06 照片特效制作专区 07 相册制作专区 08 照片的输出和打印 ================================================================================================ 本资料共包含以下附件: 108个Photoshop数码照片处理典型实例.part1.rar 108个Photoshop数码照片处理典型实例.part2.rar 108个Photoshop数码照片处理典型实例.part3.rar 108个Photoshop数码照片处理典型实例.part4.rar 108个Photoshop数码照片处理典型实例.part5.rar

2013-04-30

108个Photoshop数码照片处理典型实例.part4.rar

《108个Photoshop数码照片处理典型实例》是一本介绍数码照片后期处理技巧与方法的实用手册,由图形图像专家和专业摄影师编写,精选了108个具有代表性的照片处理实例,这些实例具有贴近生活,源于实际的特点。作者将这108个实例归类到8个处理专区,分别为照片初步处理专区;修饰照片专区;人像美容和美化专区;风景照艺术处理专区;艺术照片制作专区;照片特效制作专区;相册制作专区;照片的输出和打印专区。 01 照片初步处理专区 实例01 修改照片的尺寸 实例02 制作构图完美的照片 实例03 清除照片上多余的背景 实例04 扶正倾斜的照片 实例05 旋转与翻转照片 实例06 调整模糊的照片 实例07 调整过暗的照片 实例08 使灰蒙蒙的照片变清晰 实例09 调整过亮的照片 实例10 校正偏色的照片 实例11 让照片色彩更饱满 实例12 调整照片的色调 实例13 修复逆光照片 实例14 去除红眼 02 修饰照片专区 实例15 去除噪点 实例16 修复褪色的彩色照片 实例l7 调整偏白的黑白照片 实例l8 修复损坏的老照片 实例l9 为老照片去除网纹 实例20 修复有折痕的照片 实例21 修补缺失的照片 实例22 黑白老相片翻新 03 人像美容和美化专区 04 风景照艺术处理专区 05 艺术照片制作专区 06 照片特效制作专区 07 相册制作专区 08 照片的输出和打印 ================================================================================================ 本资料共包含以下附件: 108个Photoshop数码照片处理典型实例.part1.rar 108个Photoshop数码照片处理典型实例.part2.rar 108个Photoshop数码照片处理典型实例.part3.rar 108个Photoshop数码照片处理典型实例.part4.rar 108个Photoshop数码照片处理典型实例.part5.rar

2013-04-30

Learning iOS Programming, 2nd Edition.pdf

Chapter 1, Why Go Native? This chapter discusses the need for native applications and compares building native applications to building web applications. Chapter 2, Becoming a Developer This chapter walks you through the process of registering as an iOS developer and setting up your work environment, from installing Xcode and the iOS SDK to generating the developer certificates you’ll need to build your applications and deploy them onto your own iPhone, iPod touch, or iPad. Chapter 3, Your First iOS App This chapter allows you to get hands-on as quickly as possible and walks you through building your first Hello World application, including how to deploy and run the application on your iPhone, iPod touch, or iPad. Chapter 4, Coding in Objective-C This chapter provides a crash course in the basics of the Objective-C language, and if you’re familiar with another C-derived language (and perhaps with objectoriented programming), it should be enough to get you up and running with Objective-C and the Cocoa Touch frameworks. Chapter 5, Table View–Based Applications The UITableView and associated classes are perhaps the most commonly used classes when building user interfaces for iOS applications. Due to the nature of the applications, these classes can be used to solve a large cross section of problems, and as a result, they appear almost everywhere. In this chapter, we dive fairly deeply into the table view classes. Chapter 6, Other View Controllers After discussing the table view controller in detail, we discuss some of the other view controllers and classes that will become useful when building your applications: simple two-screen views, single-screen tabbed views, modal view controllers, and a view controller for selecting video and images. Chapter 7, Connecting to the Network This chapter discusses connecting to the Internet, browsing the Web, sending email, and retrieving information. Chapter 8, Handling Data This chapter discusses how to handle data input, both from the application user and programmatically, and how to parse XML and JSON documents. The chapter also covers storing data in flat files and storing data with the SQLite database engine. Chapter 9, Using Sensors This chapter discusses how to determine what hardware is available and illustrates how to deal with the major sensors on iOS devices: the accelerometer, magnetometer, camera, and GPS. Chapter 10, Geolocation and Mapping This chapter walks you through the process of building applications that make use of the Core Location and MapKit frameworks. Chapter 11, Introduction to iCloud This chapter provides a brief introduction to integrating Apple’s iCloud service into your own applications. iCloud is a service that helps you synchronize your data across devices, making documents and data available to all of your subscribed devices. Chapter 12, Integrating Your Application This chapter shows you some of the tricks to integrate your application with iOS’s software ecosystem, how to present user preferences with Settings Bundles, and how to use custom URL schemes to launch your application. It also discusses how to make use of the Media Player and Address Book. Chapter 13, Distributing Your Application This chapter talks about how to add some final polish to your application and walks you through the process of building your application for distribution, either via ad hoc distribution or for the App Store. Chapter 14, Going Further This chapter provides a collection of pointers to more advanced material on the topics we covered in the book, as well as material covering some of those topics that we didn’t manage to talk about in the book.

2013-04-30

108个Photoshop数码照片处理典型实例.part3.rar

《108个Photoshop数码照片处理典型实例》是一本介绍数码照片后期处理技巧与方法的实用手册,由图形图像专家和专业摄影师编写,精选了108个具有代表性的照片处理实例,这些实例具有贴近生活,源于实际的特点。作者将这108个实例归类到8个处理专区,分别为照片初步处理专区;修饰照片专区;人像美容和美化专区;风景照艺术处理专区;艺术照片制作专区;照片特效制作专区;相册制作专区;照片的输出和打印专区。 01 照片初步处理专区 实例01 修改照片的尺寸 实例02 制作构图完美的照片 实例03 清除照片上多余的背景 实例04 扶正倾斜的照片 实例05 旋转与翻转照片 实例06 调整模糊的照片 实例07 调整过暗的照片 实例08 使灰蒙蒙的照片变清晰 实例09 调整过亮的照片 实例10 校正偏色的照片 实例11 让照片色彩更饱满 实例12 调整照片的色调 实例13 修复逆光照片 实例14 去除红眼 02 修饰照片专区 实例15 去除噪点 实例16 修复褪色的彩色照片 实例l7 调整偏白的黑白照片 实例l8 修复损坏的老照片 实例l9 为老照片去除网纹 实例20 修复有折痕的照片 实例21 修补缺失的照片 实例22 黑白老相片翻新 03 人像美容和美化专区 04 风景照艺术处理专区 05 艺术照片制作专区 06 照片特效制作专区 07 相册制作专区 08 照片的输出和打印 ================================================================================================ 本资料共包含以下附件: 108个Photoshop数码照片处理典型实例.part1.rar 108个Photoshop数码照片处理典型实例.part2.rar 108个Photoshop数码照片处理典型实例.part3.rar 108个Photoshop数码照片处理典型实例.part4.rar 108个Photoshop数码照片处理典型实例.part5.rar

2013-04-30

108个Photoshop数码照片处理典型实例.part2.rar

《108个Photoshop数码照片处理典型实例》是一本介绍数码照片后期处理技巧与方法的实用手册,由图形图像专家和专业摄影师编写,精选了108个具有代表性的照片处理实例,这些实例具有贴近生活,源于实际的特点。作者将这108个实例归类到8个处理专区,分别为照片初步处理专区;修饰照片专区;人像美容和美化专区;风景照艺术处理专区;艺术照片制作专区;照片特效制作专区;相册制作专区;照片的输出和打印专区。 01 照片初步处理专区 实例01 修改照片的尺寸 实例02 制作构图完美的照片 实例03 清除照片上多余的背景 实例04 扶正倾斜的照片 实例05 旋转与翻转照片 实例06 调整模糊的照片 实例07 调整过暗的照片 实例08 使灰蒙蒙的照片变清晰 实例09 调整过亮的照片 实例10 校正偏色的照片 实例11 让照片色彩更饱满 实例12 调整照片的色调 实例13 修复逆光照片 实例14 去除红眼 02 修饰照片专区 实例15 去除噪点 实例16 修复褪色的彩色照片 实例l7 调整偏白的黑白照片 实例l8 修复损坏的老照片 实例l9 为老照片去除网纹 实例20 修复有折痕的照片 实例21 修补缺失的照片 实例22 黑白老相片翻新 03 人像美容和美化专区 04 风景照艺术处理专区 05 艺术照片制作专区 06 照片特效制作专区 07 相册制作专区 08 照片的输出和打印 ================================================================================================ 本资料共包含以下附件: 108个Photoshop数码照片处理典型实例.part1.rar 108个Photoshop数码照片处理典型实例.part2.rar 108个Photoshop数码照片处理典型实例.part3.rar 108个Photoshop数码照片处理典型实例.part4.rar 108个Photoshop数码照片处理典型实例.part5.rar

2013-04-30

108个Photoshop数码照片处理典型实例.part1.rar

《108个Photoshop数码照片处理典型实例》是一本介绍数码照片后期处理技巧与方法的实用手册,由图形图像专家和专业摄影师编写,精选了108个具有代表性的照片处理实例,这些实例具有贴近生活,源于实际的特点。作者将这108个实例归类到8个处理专区,分别为照片初步处理专区;修饰照片专区;人像美容和美化专区;风景照艺术处理专区;艺术照片制作专区;照片特效制作专区;相册制作专区;照片的输出和打印专区。 01 照片初步处理专区 实例01 修改照片的尺寸 实例02 制作构图完美的照片 实例03 清除照片上多余的背景 实例04 扶正倾斜的照片 实例05 旋转与翻转照片 实例06 调整模糊的照片 实例07 调整过暗的照片 实例08 使灰蒙蒙的照片变清晰 实例09 调整过亮的照片 实例10 校正偏色的照片 实例11 让照片色彩更饱满 实例12 调整照片的色调 实例13 修复逆光照片 实例14 去除红眼 02 修饰照片专区 实例15 去除噪点 实例16 修复褪色的彩色照片 实例l7 调整偏白的黑白照片 实例l8 修复损坏的老照片 实例l9 为老照片去除网纹 实例20 修复有折痕的照片 实例21 修补缺失的照片 实例22 黑白老相片翻新 03 人像美容和美化专区 04 风景照艺术处理专区 05 艺术照片制作专区 06 照片特效制作专区 07 相册制作专区 08 照片的输出和打印 ================================================================================================ 本资料共包含以下附件: 108个Photoshop数码照片处理典型实例.part1.rar 108个Photoshop数码照片处理典型实例.part2.rar 108个Photoshop数码照片处理典型实例.part3.rar 108个Photoshop数码照片处理典型实例.part4.rar 108个Photoshop数码照片处理典型实例.part5.rar

2013-04-30

JSP项目开发全程实录(完整源代码)

第1章 都市供求信息网(Struts 2.0+SQL Server 2000实现) 教学视频:3小时55分 1.1 开发背景 1.2 系统分析 1.2.1 需求分析 1.2.2 可行性分析 1.2.3 编写项目计划书 1.3 系统设计 1.3.1 系统目标 1.3.2 系统功能结构 1.3.3 系统流程图 1.3.4 系统预览 1.3.5 构建开发环境 1.3.6 文件夹组织结构 1.3.7 编码规则 1.4 数据库设计 1.4.1 数据库分析 1.4.2 数据库概念设计 1.4.3 数据库逻辑结构 1.4.4 创建数据库及数据表 1.5 公共类设计 1.5.1 数据库连接及操作类 1.5.2 业务处理类 1.5.3 分页类 1.5.4 字符串处理类 1.6 前台页面设计 1.6.1 前台页面概述 1.6.2 前台页面的技术分析 1.6.3 前台页面的实现过程 1.7 前台信息显示设计 1.7.1 信息显示概述 1.7.2 信息显示技术分析 1.7.3 列表显示信息的实现过程 1.7.4 显示信息详细内容的实现过程 1.8 信息发布模块设计 1.8.1 信息发布模块概述 1.8.2 信息发布技术分析 1.8.3 信息发布实现过程 1.8.4 单元测试 1.9 后台登录设计 1.9.1 后台登录功能概述 1.9.2 后台登录技术分析 1.9.3 后台登录的实现过程 1.10 后台页面设计 1.10.1 后台页面概述 1.10.2 后台页面的技术分析 1.10.3 后台页面的实现过程 1.11 后台信息管理设计 1.11.1 信息管理功能概述 1.11.2 信息管理技术分析 1.11.3 信息显示的实现过程 1.11.4 信息审核的实现过程 1.11.5 信息付费设置的实现过程 1.12 网站发布 1.13 开发技巧与难点分析 1.13.1 实现页面中的超链接 1.13.2 Struts 2.0中的中文乱码问题 1.14 Struts 2.0框架搭建与介绍 1.14.1 搭建Struts 2.0框架 1.14.2 Struts 2.0框架介绍 1.15 本章小结 第2章 图书馆管理系统(Struts 1.2+ MySQL 5.0实现) 第3章 企业电子商城(Struts 1.2+SQL Server 2000实现) 第4章 企业快信——短信+邮件(短信猫+ Java Mail实现) 第5章 企业人力资源管理(系统Spring 1.2+ Struts 1.2+Hibernate 3.0+SQL Server 实现) 第6章 办公自动化管理系统(Struts 1.1+ Hibernate 3.0+SQL Server实现) 第7章 物流信息网(JavaBean+SQL Server 2000实现) 第8章 网络在线考试系统(Struts 1.2+Ajax+ SQL Server 2000实现) 第9章 编程体验BBS——论坛系统(Struts 1.2+ SQL Server 2000实现) 第10章 博客网(Servlet 2.4+JavaBean+SQL Server 2000实现)

2013-04-27

JSP项目开发案例全程实录(第2版)part1

第1章 都市供求信息网(Struts 2.0+SQL Server 2000实现) 教学视频:3小时55分 1.1 开发背景 1.2 系统分析 1.2.1 需求分析 1.2.2 可行性分析 1.2.3 编写项目计划书 1.3 系统设计 1.3.1 系统目标 1.3.2 系统功能结构 1.3.3 系统流程图 1.3.4 系统预览 1.3.5 构建开发环境 1.3.6 文件夹组织结构 1.3.7 编码规则 1.4 数据库设计 1.4.1 数据库分析 1.4.2 数据库概念设计 1.4.3 数据库逻辑结构 1.4.4 创建数据库及数据表 1.5 公共类设计 1.5.1 数据库连接及操作类 1.5.2 业务处理类 1.5.3 分页类 1.5.4 字符串处理类 1.6 前台页面设计 1.6.1 前台页面概述 1.6.2 前台页面的技术分析 1.6.3 前台页面的实现过程 1.7 前台信息显示设计 1.7.1 信息显示概述 1.7.2 信息显示技术分析 1.7.3 列表显示信息的实现过程 1.7.4 显示信息详细内容的实现过程 1.8 信息发布模块设计 1.8.1 信息发布模块概述 1.8.2 信息发布技术分析 1.8.3 信息发布实现过程 1.8.4 单元测试 1.9 后台登录设计 1.9.1 后台登录功能概述 1.9.2 后台登录技术分析 1.9.3 后台登录的实现过程 1.10 后台页面设计 1.10.1 后台页面概述 1.10.2 后台页面的技术分析 1.10.3 后台页面的实现过程 1.11 后台信息管理设计 1.11.1 信息管理功能概述 1.11.2 信息管理技术分析 1.11.3 信息显示的实现过程 1.11.4 信息审核的实现过程 1.11.5 信息付费设置的实现过程 1.12 网站发布 1.13 开发技巧与难点分析 1.13.1 实现页面中的超链接 1.13.2 Struts 2.0中的中文乱码问题 1.14 Struts 2.0框架搭建与介绍 1.14.1 搭建Struts 2.0框架 1.14.2 Struts 2.0框架介绍 1.15 本章小结 第2章 图书馆管理系统(Struts 1.2+ MySQL 5.0实现) 第3章 企业电子商城(Struts 1.2+SQL Server 2000实现) 第4章 企业快信——短信+邮件(短信猫+ Java Mail实现) 第5章 企业人力资源管理(系统Spring 1.2+ Struts 1.2+Hibernate 3.0+SQL Server 实现) 第6章 办公自动化管理系统(Struts 1.1+ Hibernate 3.0+SQL Server实现) 第7章 物流信息网(JavaBean+SQL Server 2000实现) 第8章 网络在线考试系统(Struts 1.2+Ajax+ SQL Server 2000实现) 第9章 编程体验BBS——论坛系统(Struts 1.2+ SQL Server 2000实现) 第10章 博客网(Servlet 2.4+JavaBean+SQL Server 2000实现)

2013-04-27

JSP项目开发案例全程实录(第2版)part2

第1章 都市供求信息网(Struts 2.0+SQL Server 2000实现) 教学视频:3小时55分 1.1 开发背景 1.2 系统分析 1.2.1 需求分析 1.2.2 可行性分析 1.2.3 编写项目计划书 1.3 系统设计 1.3.1 系统目标 1.3.2 系统功能结构 1.3.3 系统流程图 1.3.4 系统预览 1.3.5 构建开发环境 1.3.6 文件夹组织结构 1.3.7 编码规则 1.4 数据库设计 1.4.1 数据库分析 1.4.2 数据库概念设计 1.4.3 数据库逻辑结构 1.4.4 创建数据库及数据表 1.5 公共类设计 1.5.1 数据库连接及操作类 1.5.2 业务处理类 1.5.3 分页类 1.5.4 字符串处理类 1.6 前台页面设计 1.6.1 前台页面概述 1.6.2 前台页面的技术分析 1.6.3 前台页面的实现过程 1.7 前台信息显示设计 1.7.1 信息显示概述 1.7.2 信息显示技术分析 1.7.3 列表显示信息的实现过程 1.7.4 显示信息详细内容的实现过程 1.8 信息发布模块设计 1.8.1 信息发布模块概述 1.8.2 信息发布技术分析 1.8.3 信息发布实现过程 1.8.4 单元测试 1.9 后台登录设计 1.9.1 后台登录功能概述 1.9.2 后台登录技术分析 1.9.3 后台登录的实现过程 1.10 后台页面设计 1.10.1 后台页面概述 1.10.2 后台页面的技术分析 1.10.3 后台页面的实现过程 1.11 后台信息管理设计 1.11.1 信息管理功能概述 1.11.2 信息管理技术分析 1.11.3 信息显示的实现过程 1.11.4 信息审核的实现过程 1.11.5 信息付费设置的实现过程 1.12 网站发布 1.13 开发技巧与难点分析 1.13.1 实现页面中的超链接 1.13.2 Struts 2.0中的中文乱码问题 1.14 Struts 2.0框架搭建与介绍 1.14.1 搭建Struts 2.0框架 1.14.2 Struts 2.0框架介绍 1.15 本章小结 第2章 图书馆管理系统(Struts 1.2+ MySQL 5.0实现) 第3章 企业电子商城(Struts 1.2+SQL Server 2000实现) 第4章 企业快信——短信+邮件(短信猫+ Java Mail实现) 第5章 企业人力资源管理(系统Spring 1.2+ Struts 1.2+Hibernate 3.0+SQL Server 实现) 第6章 办公自动化管理系统(Struts 1.1+ Hibernate 3.0+SQL Server实现) 第7章 物流信息网(JavaBean+SQL Server 2000实现) 第8章 网络在线考试系统(Struts 1.2+Ajax+ SQL Server 2000实现) 第9章 编程体验BBS——论坛系统(Struts 1.2+ SQL Server 2000实现) 第10章 博客网(Servlet 2.4+JavaBean+SQL Server 2000实现)

2013-04-27

C 程序经典900例(下)

本资源富含丰富的程序和一些经典的算法,希望大家喜欢

2013-04-26

C 程序经典900例(上)

本资源富含丰富的程序和一些经典的算法,希望大家喜欢

2013-04-26

176个经典c语言源代码

该资源里面含有一些经典的算法和实例,供大家参考和学习

2013-04-26

jsp api jar 包

Tomcat7.0 javax.jsp API包,供大家参考使用

2013-04-26

网络工程师教程(第三版)part10

本书是基于网络工程师考试的专用教程,高清版 带书签

2013-04-04

网络工程师教程(第三版)part9

本书是基于网络工程师考试的专用教程,高清版 带书签

2013-04-04

网络工程师教程(第三版)part8

本书是基于网络工程师考试的专用教程,高清版 带书签

2013-04-04

网络工程师教程(第三版)part7

本教程是网络工程考试专用教程第三版,高清版,带书签。

2013-04-04

网络工程师教程(第三版)part5

本教程是网络工程考试专用教程第三版,高清版,带书签。

2013-04-04

网络工程师教程(第三版)part4

本教程是网络工程考试专用教程第三版,高清版,带书签。

2013-04-04

网络工程师教程(第三版)part1

本教程是网络工程考试专用教程第三版,高清版,带书签。

2013-04-04

网络工程师教程第三版)part1

本教程是网络工程考试专用教程第三版,高清版,带书签。

2013-04-04

java 23 种设计模式

本文档整合了java的23种设计模式详解,以及代码的详解

2013-04-04

JavaScript 王者归来 书中实例

本资源是JavaScript王者归来的所有实例

2013-04-04

java编程思想第四版习题

Exercise2_1.java Exercise2_2.java Exercise2_3.java Exercise2_4.java Exercise2_5.java.......

2012-12-07

java基础教程

·Java语言介绍 ·简单的Java程序 ·Java中的变量与数据类型 ·运算符、表达式与语句 ·循环与选择结构 ·数组与方法的使用

2012-12-07

中 国 象 棋

本软件主要基于java平台开发的,供大家学习和研究。

2012-12-07

智能Office办公系统源码

本系统主要包含功能有,个人管理,员工管理,系统用户管理,活动目录,公告信息,通信录。此系统主要用来供大家学习和研究,不得用于商业。此系统源于51aspx

2012-12-07

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除