Summary of the invention
The main purpose of the present invention is to provide a kind of application and development method and devices, it is intended to which energy can not be effectively ensured in solution
Enough completely, it is accurately finished application and development, so that the problem that the experience effect of application and development is lower.
To achieve the above object, the present invention provides a kind of application and development method, comprising the following steps:
After receiving the service request of application and development, EJB data packet is called, and obtain and take according to the EJB data packet
Business text file and the corresponding performing environment of the initialization service request;
According to the service context file under the performing environment after the initialization, Spring data packet is obtained, and
The corresponding service of the service request and the corresponding execution method of the service are determined according to the Spring data packet;
The service is completed according to the execution method, and back services complete result.
Preferably, it is obtained under the performing environment after the initialization according to the service context file
Before the step of Spring data packet, further includes:
It determines and completes related information with service, the information includes data access object and/or tool-class;
According to identified information architecture Spring data packet.
Preferably, it is described according to determined by the step of information architecture Spring data packet after, further includes:
The Spring data packet is stored and obtains the store path;
The store path is added in service context file.
Preferably, the step of calling EJB data packet includes:
It reflects to obtain class method manes and parameter relevant to class method manes by Java;
EJB data packet is called according to the class method manes and parameter relevant to class method manes.
Preferably, described to complete the service according to the execution method, and after the step of back services complete result,
Further include:
In service execution failure, the rolling back action of business service is carried out by business application interface.
In addition, to achieve the above object, the present invention furthermore provides a kind of application and development device, comprising:
Calling module, for calling EJB data packet after receiving the service request of application and development;
Module is obtained, for obtaining service context file and the initialization service request according to the EJB data packet
Corresponding performing environment;It is also used under the performing environment after the initialization be obtained according to the service context file
Spring data packet;
Processing module, for determining the corresponding service of the service request and the clothes according to the Spring data packet
It is engaged in corresponding execution method;
Execution module, for completing the service according to the execution method, and back services complete result.
Preferably, the application and development device further include:
Determining module completes related information with service for determining, the information includes data access object and/or work
Has class;
Module is constructed, for according to identified information architecture Spring data packet.
Preferably, the application and development device further include:
Memory module, for being stored the Spring data packet and obtaining the store path;
The processing module is also used to for the store path being added in service context file.
Preferably, the calling module includes obtaining unit and call unit,
It is described to obtain unit, class method manes and parameter relevant to class method manes are obtained for reflecting by Java;
The call unit, for calling EJB data packet according to the class method manes and parameter relevant to class method manes.
Preferably, the execution module, be also used to the service execution fail when, by business application interface into
The rolling back action of row business service.
The present invention completes the business service of application and development by the way that both EJB and Spring to be combined together.By by EJB
The business service for completing application and development is combined together with both Spring.Realization effectively avoids the IoC under EJB mode from holding
Device, AOP ability, to integrate third square bearer etc. based on POJO weaker;Under Spring mode concurrent processing, issued transaction,
Distributed capability, life cycle management etc. are weaker;Can not be effectively ensured can it is complete, be accurately finished application and development, make
Obtain the lower problem of the experience effect of application and development.The problem of.Effectively guarantee it is complete, be accurately finished application and development, mention
The high experience effect of application and development.
Specific embodiment
It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, it is not intended to limit the present invention.
The primary solutions of the embodiment of the present invention are: after receiving the service request of application and development, calling EJB data
Packet, and service context file and the corresponding performing environment of the initialization service request are obtained according to the EJB data packet;?
According to the service context file under performing environment after the initialization, Spring data packet is obtained, and according to described
Spring data packet determines the corresponding service of the service request and the corresponding execution method of the service;According to the execution
Method completes the service, and back services complete result.It is opened by the way that both EJB and Spring are combined together completion application
The business service of hair.It realizes the IoC container effectively avoided under EJB mode, AOP ability, third square bearer is integrated based on POJO
Etc. it is weaker;Under Spring mode concurrent processing, issued transaction, distributed capability, in terms of it is weaker;
Can not be effectively ensured can it is complete, be accurately finished application and development so that the problem that the experience effect of application and development is lower.Effectively
Guarantee it is complete, be accurately finished application and development, improve the experience effect of application and development.
Due to that can only use one of EJB or Spring in existing application and development, IoC container under EJB mode,
AOP ability, to integrate third square bearer etc. based on POJO weaker;Concurrent processing, issued transaction, distribution under Spring mode
Formula ability, life cycle management etc. are weaker.Therefore, application and development, nothing are completed under based on one of above-mentioned mode
Method be effectively ensured can it is complete, be accurately finished application and development so that the experience effect of application and development is lower.
Based on the above issues, the present invention provides a kind of application and development method.
Referring to Fig.1, Fig. 1 is the flow diagram of the first embodiment of application and development method of the present invention.
In one embodiment, the application and development method includes:
Step S10 calls EJB data packet, and according to the EJB data after receiving the service request of application and development
Packet obtains service context file and the corresponding performing environment of the initialization service request;
The EJB data packet can be EJB component (for example, EJB example), and the EJB component includes Service
Skeleton Bean (service framework object) is similar to the pond of Service Context (service context file), passes through
Published-services.xml is come the Service Context that specifies it to be included.As Service Context's
Pond, Skeleton Ben are the container of Service naturally.Therefore, it becomes the operation and deployment unit of Service, is
Service provides the due service supports of containers such as life cycle, concurrent, practice.The publication of Service and calling are obviously also
It is completed by Skeleton Ben.Service Client (service client), which will access Service, must pass through Skeleton
The calling of Ben (service object).
User is issued the service request of application and development by Service Client, received when needing development and application
To after the service request of application and development, EJB data packet is called.The EJB data packet includes the EJB example of creation, is falling to use EJB
When data packet, EJB example is called.
Specifically, with reference to Fig. 2, the process for calling EJB data packet includes:
Step S11 obtains class method manes and parameter relevant to class method manes by Java reflection mechanism;
After receiving service request, obtained by Service Client Factory (service client cluster)
A stub (counterfoil) of Service Client obtains an agent object of Service using Java reflection mechanism, and
Obtain the relevant parameter of the agent object.
Step S12 calls EJB data packet according to the class method manes and parameter relevant to class method manes.
After the class method manes and parameter relevant to class method manes, determine the class method manes and with class method manes phase
The corresponding EJB data packet of the parameter of pass calls EJB data packet according to the class method manes and parameter relevant to class method manes.
After calling EJB data packet, service context file and the initialization business are obtained according to the EJB data packet
Corresponding performing environment is requested, i.e., according to EJB case-based system text file and the corresponding execution of the initialization service request
Environment.
Service context file is constructed in advance, specifically, the process of the building service context file can with reference to Fig. 3
To include:
Step S21 is determined and is completed related information with service, and the information includes data access object and/or tool-class;
Step S22, according to identified information architecture Spring data packet;
Spring finishing service service relies on and the objects such as DAO (data access object), various tool-class, passes through Spring
Spring data packet is written in these complicated dependences and initialization logic by IoC, i.e. write-in configuration file, is configured to expansible
Mark language XML text.The Spring data packet is Spring Service Bean.
The Spring data packet is stored and obtains the store path by step S23;
The store path is added in service context file by step S24.
Service context file is a base unit of distributed service framework, is responsible for management Spring configuration file,
That is management Spring data packet is indicated the path of the Spring datagram using its constructor.Specifically, will
The Spring data packet stores and obtains the store path;The store path is added in service context file.
When completing service, Spring data can be got by the path for the Spring data packet for including in service context file
Packet.
Step S20 obtains Spring number according to the service context file under the performing environment after the initialization
The corresponding service of the service request and the corresponding side of execution of the service are determined according to packet, and according to the Spring data packet
Method;
Getting service context file, and after initializing the corresponding performing environment of the service request, it is described just
The service context file is called under performing environment after beginningization, according to the service context file acquisition Spring data
Packet further according to the store path for the Spring data packet for including in the service context file, arrives the storage road
Diameter gets Spring data packet.The corresponding service of the service request and the clothes are determined according to the Spring data packet
It is engaged in corresponding execution method, that is, needs to complete the corresponding service of the service request by which or which kind of execution method.
Step S30 completes the service according to the execution method, and back services complete result.
After determining the corresponding execution method of the service request, the service request pair is completed according to the execution method
The service answered, and feed back completion and complete result as a result, feeding back by predetermined manner to the Service Client.It is described pre-
If mode can be voice, text, video, picture etc..The completion result includes execution information and implementing result etc..
The present embodiment completes the business service of application and development by the way that both EJB and Spring to be combined together.Passing through will
Both EJB and Spring are combined together the business service for completing application and development.It realizes and effectively avoids the IoC under EJB mode
Container, AOP ability, to integrate third square bearer etc. based on POJO weaker;Concurrent processing, office under Spring mode
Reason, distributed capability, life cycle management etc. are weaker;Can not be effectively ensured can it is complete, be accurately finished application and development,
So that the problem that the experience effect of application and development is lower.Effectively guarantee it is complete, be accurately finished application and development, improve and answer
With the experience effect of exploitation.
It is the flow diagram of the second embodiment of application and development method of the present invention referring to Fig. 4, Fig. 4.Based on above-mentioned application
The first embodiment of development approach, after the step S30, further includes:
Step S40 is grasped in service execution failure by the rollback that business application interface carries out business service
Make.
After completing the service according to the execution method, judge whether the service runs succeeded, is running succeeded
When, feed back the result to run succeeded;When executing failure, feedback executes the result of failure.In service execution failure, lead to
Cross the rolling back action that service application interface JTA carries out business service.Rolling back action is including being exactly the intermediate setting one of somewhere operation
A point then proceedes to complete operating process, if feeling problematic, the point of setting is returned to regard to carrying out rollback, after being equal to that point
The operation in face deletes, and completes operation after that point again.Certainly useless if commit.Realize it is more efficient,
Reasonable finishing service requests corresponding business service.It is understood that a series of expansible croppers of carry are gone back, it is real
The programming of existing AOP style, that is, the modification realizing the orderly or random break-in operation in programming process and being adapted to.Make
The process for obtaining application and development is more reasonable, and reduces the probability to malfunction in application development process, further improves to apply and open
The accuracy of hair.
The executing subject of the application and development method of the first and second embodiments of above-mentioned application and development method all can be whole
End.Further, this method can be realized by installing client (the operation program of such as application and development) at the terminal,
In, which can include but is not limited to laptop, mobile phone, tablet computer or PDA (Personal Digital
Assistant, personal digital assistant) etc. electronic equipments.
The present invention further provides a kind of application and development devices.
It is the functional block diagram of the preferred embodiment of application and development device of the present invention referring to Fig. 5, Fig. 5.
In one embodiment, the application and development device includes: calling module 10, obtains module 20, determining module 40, structure
Model block 50, processing module 60 and execution module 70.
The calling module 10, for calling EJB data packet after receiving the service request of application and development;
The acquisition module 20, for obtaining service context file and the initialization industry according to the EJB data packet
Corresponding performing environment is requested in business;
The EJB data packet can be EJB component (for example, EJB example), and the EJB component is Service
Skeleton Bean specifies its institute by published-services.xml similar to the pond of Service Context
The Service Context for including.As the pond of Service Context, Skeleton Ben is the appearance of Service naturally
Device.Therefore, it becomes the operation and deployment unit of Service, provides the containers such as life cycle, concurrent, practice for Service
Due service support.The publication of Service and calling are obviously also to be completed by Skeleton Ben.Service Client
Accessing Service must be by the calling of Skeleton Ben.
User is issued the service request of application and development by Service Client, received when needing development and application
To after the service request of application and development, EJB data packet is called.
Specifically, the calling module 10 includes: to obtain unit 11 and call unit 12 with reference to Fig. 6,
It is described to obtain unit 11, for obtaining class method manes and ginseng relevant to class method manes by Java reflection mechanism
Number;
After receiving service request, one of Service Client is obtained by Service Client Factory
Stub (counterfoil) obtains an agent object of Service using Java reflection mechanism, and obtains the phase of the agent object
Close parameter.
The call unit 12, for calling EJB data according to the class method manes and parameter relevant to class method manes
Packet.
After the class method manes and parameter relevant to class method manes, determine the class method manes and with class method manes phase
The corresponding EJB data packet of the parameter of pass calls EJB data packet according to the class method manes and parameter relevant to class method manes.
The EJB data packet includes the EJB example of creation, when falling to use EJB data packet, calls EJB example.
After calling EJB data packet, service context file and the initialization business are obtained according to the EJB data packet
Corresponding performing environment is requested, i.e., according to EJB case-based system text file and the corresponding execution of the initialization service request
Environment.
The determining module 30 completes related information with service for determining, the information includes data access object
And/or tool-class;
The building module 40, for according to identified information architecture Spring data packet;
Spring finishing service service relies on and the objects such as DAO (data access object), various tool-class, passes through Spring
Spring data packet is written in these complicated dependences and initialization logic by IoC, i.e. write-in configuration file, is configured to XML text
This.
The memory module 50, for being stored the Spring data packet and obtaining the store path;
The processing module 60, for the store path to be added in service context file.
One base unit of distributed service framework when service context file is responsible for management Spring configuration file,
That is management Spring data packet is indicated the path of the Spring datagram using its constructor.Specifically, will
The Spring data packet stores and obtains the store path;The store path is added in service context file.
When completing service, Spring data can be got by the path for the Spring data packet for including in service context file
Packet.
The acquisition module 20 is also used under the performing environment after the initialization according to the service context text
Part, obtain Spring data packet, and according to the Spring data packet determine the service request it is corresponding service and it is described
Service corresponding execution method;
Getting service context file, and after initializing the corresponding performing environment of the service request, it is described just
The service context file is called under performing environment after beginningization, according to the service context file acquisition Spring data
Packet further according to the store path for the Spring data packet for including in the service context file, arrives the storage road
Diameter gets Spring data packet.The corresponding service of the service request and the clothes are determined according to the Spring data packet
It is engaged in corresponding execution method, that is, needs to complete the corresponding service of the service request by which or which kind of execution method.
The execution module 70, for completing the service according to the execution method, and back services complete result.
After determining the corresponding execution method of the service request, the service request pair is completed according to the execution method
The service answered, and feed back completion and complete result as a result, feeding back by predetermined manner to the Service Client.It is described pre-
If mode can be voice, text, video, picture etc..The completion result includes execution information and implementing result etc..
The present embodiment completes the business service of application and development by the way that both EJB and Spring to be combined together.Passing through will
Both EJB and Spring are combined together the business service for completing application and development.It realizes and effectively avoids the IoC under EJB mode
Container, AOP ability, to integrate third square bearer etc. based on POJO weaker;Concurrent processing, office under Spring mode
Reason, distributed capability, life cycle management etc. are weaker;Can not be effectively ensured can it is complete, be accurately finished application and development,
So that the problem that the experience effect of application and development is lower.Effectively guarantee it is complete, be accurately finished application and development, improve and answer
With the experience effect of exploitation.
Further, the execution module 70 is also used to connect when the service execution fails by business application
Mouth carries out the rolling back action of business service.
After completing the service according to the execution method, judge whether the service runs succeeded, is running succeeded
When, feed back the result to run succeeded;When executing failure, feedback executes the result of failure.In service execution failure, lead to
Cross the rolling back action that service application interface JTA carries out business service.Rolling back action is including being exactly the intermediate setting one of somewhere operation
A point then proceedes to complete operating process, if feeling problematic, the point of setting is returned to regard to carrying out rollback, after being equal to that point
The operation in face deletes, and completes operation after that point again.Realize that more efficient, reasonable finishing service requests corresponding industry
Business service.It is understood that going back a series of expansible croppers of carry, realizes the programming of AOP style, that is, realize and compiling
Orderly or random break-in operation during journey and the modification adapted to.So that the process of application and development is more reasonable,
And the probability to malfunction in application development process is reduced, further improve the accuracy of application and development.
The above is only a preferred embodiment of the present invention, is not intended to limit the scope of the invention, all to utilize this hair
Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills
Art field, is included within the scope of the present invention.