The SLSB implementation of SPRING,IOC mode and EJB3

Source: Internet
Author: User

Let's take a look at the implementation of EJB3 's SLSB:

import javax.ejb.Stateless;
public class HelloBean{
private String _greeting = "Default Hello";

public void setGreeting(String greeting)
_greeting = greeting;

public String hello()
return _greeting;

<bean type="...">
<init greeting="Hello, world"/>

What do we see? In the configuration file, "Hello, World" is passed to setgreeting as a parameter, of course, the EJB implementation generates the Hello interface based on the default value, and the interface's method implementation directly calls return _greeting; Hello, World. "

The set method is used to pass the required string to setgreeting, and if our requirements change, we only need to make changes in the configuration file, which is what the IOC model


Visible, EJB3 use of the IOC model and spring adopted by the IOC, have adopted a type2 approach, learning Spring, for us to learn EJB3 is also a good foreshadowing.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.