'annotation'에 해당되는 글 1건

  1. 2015.06.24 XML과 JAVA 를 같이 사용
기초/spring framework2015. 6. 24. 12:26

xml에 java 추기


    <context:annotation-config />
        <bean class="com.spring.springxmljavadi.ApplicationConfig"/>



javacode


public class ApplicationConfig {
    public Student student1(){
        ArrayList<String> hobbies = new ArrayList<String>();
        hobbies.add("낚시");
        hobbies.add("축구");
        hobbies.add("등산");
        Student student = new Student("클라스", 20, hobbies);
        student.setHeight(180);
        student.setWeight(95);
       
        return student;
    }
}


이것은 메인에서 부를 때 xml로 불러야한다



java에 xml 추가


@ImportResource("classpath:appBean3.xml")




'기초 > spring framework' 카테고리의 다른 글

Spring JDBC  (0) 2015.07.06
한글처리  (0) 2015.07.02
profile 사용하기  (0) 2015.06.25
외부로 부터 파일을 가져오기  (0) 2015.06.25
InitializingBean, DisposableBean  (0) 2015.06.24
Posted by ICT 기술 블로그