본문 바로가기

Spring

(8)
8. Definitions · API: Mediator between a consumer and a system · REST API: API that conforms to a set of guidelines. · JSON: universal format of key-value pairs that all systems can understand. { "name": "Tyrion Lannister", //JSON STRING "phoneNumber": "4515429321", // JSON STRING "age": 40, // JSON NUMBER "height": 1.2, // JSON NUMBER "siblings": [ "Cersei", "Jaime" ], // JSON ARRAY "alwaysDrunk":..
7. React https://nodejs.org/en/download/ Download | Node.js Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. nodejs.org 환경변수 설정 C:\Program Files\nodejs front end 터미널에서 npm install 입력
6. Testing a Web Application Unit Testing @RunWith(MockitoJUnitRunner.class) public class GradeServiceTest { @Mock private Dependency dependency; @InjectMocks private Service service; } @RunWith(MockitoJUnitRunner.class): class-level annotation where the target class can run tests. @Mock: mocks a dependency. @InjectMocks: creates an object and injects every mock into it. @Test: method-level annotation that can run a test. @..
5. Beans and Dependency Injection A bean is an object that lives inside the Spring Container. As your @SpringBootApplication performs a @ComponentScan, a bean is created from classes marked with @Component. @Controller, @Service and @Repository derive from @Component. @Configuration: marks a class as a source for bean definitions. @Bean: method-level annotation for bean definitions. @Autowired injects the bean where it's needed...
4. Three Layer Codebase GradeRepository.java public class GradeRepository { private List items = new ArrayList(); public void addItem(Item item){ items.add(item); } public void setItem(int index, Item item){ items.set(index, item); } public Item getItem(int index){ return items.get(index); } public List getItems(){ return items; } } GradeService.java public class GradeService { GradeRepository gradeRepository = new Gra..
3. Field Validation Field Validation dependency에 validation 추가해야함 org.springframework.boot spring-boot-starter-validation Step1 : Annotates the fields that need validation @Min(18) Step2 : Pass in a bad input Step3 :@Valid can validate the fields inside the handler method Step4 : A BindingResult carries the result of the validation Step5 : A negative BindingResult forces the user to stay in the form Step6 : Thymele..
2. Model View Controller Model View Controller Model: Stores data needed by the view in the form of key-value pairs. View: Visual elements of a webpage. Controller: Serves web requests by managing the model and presenting the view. AnnotationPurpose @Controller Instruments the target to serve web requests. @GetMapping("path") Maps a GET request to a handler method @RequestParam Parameter to be received from a GET reques..
1. Spring Boot(Visual Studio Code) Maven 설치 (Binary zip archive) https://maven.apache.org/download.cgi Maven – Download Apache Maven Downloading Apache Maven 3.8.6 Apache Maven 3.8.6 is the latest release and recommended version for all users. System Requirements Java Development Kit (JDK) Maven 3.3+ require JDK 1.7 or above to execute - they still allow you to build against 1.3 and oth maven.apache.org C - Program Files에 압축 풀어서 ..