【正文】
required functionality[4] provides a way to tie together the objects that make up an application. It acplishes this goal with the Spring Application Context, which is a strategy for managing dependencies between objects. Spring uses dependency injection and method interception techniques described below.The code that we write is dependent on the objects it uses. It is responsible for creating these objects. This may result in tight coupling, but we would prefer that our code be loosely coupled. Dependency injection is a technique which helps us to acplish this. Dependency injection is a form of Inversion of Control (IoC)[6]. Spring AOP implements method interception through JDK dynamic proxies. The XYZ framework uses Spring AOP to manage concerns such as transaction management and performance monitoring.The developed XYZ framework consists of two distinct parts: code and configuration. Code resides in a particular application layer and focuses on a particular piece of the application solution. This could be interacting with a database, or presenting data to the screen. Configuration glues the various layers of the application together. Separating configuration from code allows us to manage configuration independently, giving us the flexibility of applying different configurations to the same code base. For example, a Data Access Objects (DAO) implementation knows that it is using JDBC to connect to a database through a data source, but it does not know anything about the implementation of that data source. It may e from a Java Naming and Directory Interface (JNDI) context or be derived from a driver manager. It may point to the remote database or a local database. Regardless of where the data source es from, the DAO implementation will operate on the data source in the same manner. Likewise, a Service object may depend on a DAO, but it does not know whether the DAO is implemented via Hibernate, straight JDBC, or a Web service. The service object interacts with the DAO in the same manner, regardless of the DAO’s implementation.Spring gives us a way to manage our application’s entire configuration through a Spring application context, defined by a set of XML files. We could define the application context in one file. However, by defining it in groups of smaller files, we can simplify configuration management. A logical set of such application context files which forms a plete application configuration is called a configuration set.During the development of Javabased enterprise applications the standard configuration is where a framework’s configuration set uses external resources such as data sources and JNDI resources. This type of configuration sometimes can create problems with: (1) An inplete database that has not yet been loaded. Developers may want to test the display of certain types of data, but if the underlying database has not yet been pleted, they will not be able to do this. (2) Services or DAOs that may not have been developed yet. Integrating with unfinished services or DAOs may halt development.These issues decrease productivity. The developed XYZ framework has separated its configuration from its code, we can use an alternate configuration set targeted specifically towards development. This relieves us from worrying about the availability of external systems, which are irrelevant to solving immediate development needs.The developed XYZ framework defines two configuration sets: default and standalone. We can also customize our application by adding additional configuration sets based on our project needs. The default configuration set connects to the development database using the DataSource defined in JNDI. It uses fully developed application services and DAOs. The standalone configuration set is the most flexible environment for development. This configuration set: (1) connects to either a locally installed database or the development database using a DriverManagerDataSource。 (3) uses fully developed application Services and DAOs。 file defines the service part of all configuration sets. This file is located in the src/config directory of the service project. Application context files shared between configuration sets are also located in this directory. In addition, each configuration set has its own subdirectory, which contains files specific to it. Services and DAOs, for instance, are shared between configuration sets, while supporting services (like data sources) belong in the subdirectories. XML files define the Spring beans in this application by using the 〈bean〉 tag. A Spring bean is a Java object created and initialized by the application context.. Classes and dependenciesUsing the developed XYZ framework, the following code and configuration artifacts will be typically required to develop a user interface screen: (a) Action, ActionForm classes and entries。 (c) DAO interface and implementation class。 [7]. Unlike unit tests, integration tests do require code dependencies to be available. The purpose of this test is to ensure that the integration between different classes (developed by different developers) works as expected. During the Functional Testing process, the focus is on testing functionality of the application by using data to depict different scenarios. Functional testing typically involves testing classes in the Service layer with different data. It can also be performed by testing the user interface layer and by using real dependencies.In order to perform different types of testing, the application being developed must be testable. Let us list some of the basic characteristics of a testable application. (1) Ease of developing unit and integration tests. We should be able to unit test without necessarily using data sources, or queues. Also, we should be able to mock dependencies of code under test. (2) Ease of simulating various test scenarios for functional testing. (3) Ease of rerunning all tests repeatedly over the life cycle o