2017년 11월 2일 목요일

[Spring]Beginning of Spring

There are many ways to implements Spring Project.

How to Make a Maven Project(for Beginner):

  1. Create 'Java Project'
  2. Right-Click the Project folder > Configure > Convert to Maven Project > Finish
  3. src > Spring Bean Configuration File(.xml) > name it 'applicationContext'

Then, it creates a POM.xml file. This is not the way you do in the company but to make it look clear without many files and complex file tree, you can start it in this way.
In the company, you create a Maven Project directly.

ref)
maven: accumulator of knowledge
POM: Project Object Model

Then, you have two choices to import Spring Library.

  1. Download: mvnrepository(spring-corespring-context)
  2. Edit POM.xml: 

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>Day02_DI</groupId>
  <artifactId>Day02_DI</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.6.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
    </plugins>
  </build>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    <version>4.2.5.RELEASE</version>
</dependency>
  <!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    <version>4.2.5.RELEASE</version>
</dependency>
</dependencies>
</project>

Then, create 'spring Bean Configuration File' into 'src' folder with a name -  'applicationContext.xml'.


@autoWired

댓글 없음:

댓글 쓰기