Java spring project part 1

Quality assurance, Devs and SEO teams ready to help your business grow

Java spring project part 1

Project: Create a Circle and a Point class. One will depend on the other. Circle will have a Point as the circle’s center.

Use the Constructor to create an injection.

Create a new Maven Project. Add the Spring dependency. Define in the xml configuration file a Point and Circle class instances.

IgZv6oM1YfeZ6eTgd7zMO_5CjMQ6kO34NokYrSkHm7cOUyXJ3-EmlVwAoJbLbYwhCHtzh2QtYlHicyHxFefgiPjN-Mf2N4s2KiGRhqBLp5O75c2A7j88opWLWrlqzEOOAet4PK3K

For Point instance use value to add the dependencies for x and y fields.

For the Circle instance use both value and ref to add dependencies to the circle’s ray and Point bean.

Go to pom.xml file and add the dependecies:

4QQWZzMlay7hyRs6UoHKXCoy1AomMdw0kZleFc3M7l7I4shQTGrVIP2ma1V2UWeVkwODIqk9jGVyPYtZWlBWXK5_GRi78uNIULbRbYxf2Q2pxDimK6POrzPQE-Ru8E9A-M3k_evE

Inside <project> tag add a new dependency.

<dependencies>

<dependency>

<groupId>org.springframework </groupId>

<artifactId>spring-context </artifactId>

<version>4.3.0.RELEASE </version>

<dependency>

</dependencies>

Go to Project main menu, right click, Select Build with Dependencies

1MXc6Z-DQLPyZ2rI69vtPLwvjUZHPmo8_yOLv81y4-nW9qtap-0hzNV4R4yGs1Mb0fqBPfzUTO5O2nq0KrH4-0cIxk71IQdq7UHwi2P2Cx6ueG8ST9tSRkkRB0wNHFhC2TZRgfZX

In order to use an xml config file, we will make use of the following class instance after creating a Main class in Source Packages to make an explicit configuration in XML:

FileSystemXmlApplicationContext context;

context = new FileSystemXmlApplicationContext();

 

No Comments

Add your comment