(Udacity) Lesson 3: Spring Boot Basics for Web Development

4837 단어 udacityudacity

퀴즈

1. 스프링의 어떤 점이 구조화된 소프트웨어 개발을 가능하게 하는가

1) 비즈니스 기능을 구현하기 위해 결합할 수 있는 단일 목적 구성요소의 개발
2) 어떤 class를 사용하든지 resource를 주입할 수 있다
3) 자바 유형, 구성요소 이름, 구성 속성별로 resource에 대한 종속성 요청 매칭
모든 타입(복잡한 객체도) 주입 가능

2. Spring을 잘 반영하지 못한 것

3. 새로운 component를 추가해야 하는 경우

1) user data를 저장하고 있지만, 이제 신발 데이터도 저장하고 접근하고 싶다
2) REST endpoint에 메소드를 노출시키고싶은데, 지금은 application이 그걸 못한다.

4. IoC Configuration에 대해 옳은 것

1) Qualifier annotation은 여러가지 옵션이 있을 때 사용할 bean을 찾는데 도움을 준다.
2) Configuration annotation은 현재 class가 AppicationContext를 확장하게 한다.

5. 스프링 components에 관한 설명중 옳은것

1) @ComponentScan은 @SpringBootApplication과 그 하위 패키지들에서만 Component class를 찾는다.
2) @Service, @Controller, @Repository는 모두 @Component의 타입이다.

6. 의존성에 대해 옳은것

UserService - Provides methods to find and modify users, including setting the users’ current pair of shoes.
ShoeService - Provides methods to find and modify the inventory of shoes.
UserController - Provides REST endpoints for our webpage to request information about users, and set the user’s shoes
1) UserService는 ShoeServcie를 참조한다.
2) ShoeService는 아무것도 참조하지 않는다.

7. property에 맞는 function 고르기

1) logging.level.org.springframework
2) spring.datasource.url
3) server.address
4) spring.http.encoding.charset
5) spring.gson.date-format

8. application.properties 파일 수정해보기

1) Make sure the server uses port 8086 instead of the default
2) Set the log level for the com.udacity.jdnd.course1exercises package to DEBUG
3) Set the username and password for the primary data source to values of your choice
4) Enable template caching for Thymeleaf
5) Enable remote restart through devtools

1) server.port=8086
2) logging.level.com.udacity.jdnd.course1exercises=DEBUG
3) spring.datasource.username=superman
4) spring.datasource.password=FishTacos1234
5) spring.thymeleaf.cache=true
6) spring.devtools.remote.restart.enabled=true

9. 다음 XML파일이 주어졌을때 configuration 같은것 고르기

<beans>
  <bean
      id="indexService"
      class="com.udacity.example.IndexService" />
  <bean
      id="indexApp"
      class="com.udacity.example.IndexApp">
    <constructor-arg ref="indexService" />
  </bean>
</beans>

// IndexService.java
@Service
public class IndexService {
  // ...
}

// IndexApp.java
@Component
public class IndexApp {
  private IndexService indexService;

  public IndexApp (IndexService indexService) {
    this.indexService = indexService;
  }
}

@bean, @component, @configuration 차이
https://mangkyu.tistory.com/75

좋은 웹페이지 즐겨찾기