Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.0.0

=> 스프링부트 프로젝트 버전을 2.7.6으로 설정

 

 

// application.properties
server.port=8088

 

1. 의존성 추가

// gradle 사용 시 build.gradle
dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'
}

// maven 사용 시 pom.xml
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-mongodb</artifactId>
    </dependency>
</dependencies>

 

 

2. 연결 설정

// application.properties
spring.data.mongodb.uri=mongodb://localhost:27017/mydatabase
spring.data.mongodb.database=mydatabase

// application.yml
spring:
  data:
    mongodb:
      uri: mongodb://localhost:27017/mydatabase
      database: mydatabase

 


3. 엔티티 및 레포지토리 설정

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

@Document(collection = "users")
public class User {
    @Id
    private String id;
    private String name;
    private int age;

    // Getter, Setter 작성
}
import org.springframework.data.mongodb.repository.MongoRepository;

public interface UserRepository extends MongoRepository<User, String> {
    User findByName(String name);
}

 

 

4. 서비스, 컨트롤러 구현

import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class UserService {
    private final UserRepository userRepository;

    public UserService(UserRepository userRepository) {
        this.userRepository = userRepository;
    }

    public List<User> getAllUsers() {
        return userRepository.findAll();
    }

    public User saveUser(User user) {
        return userRepository.save(user);
    }
}
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/users")
public class UserController {
    private final UserService userService;

    public UserController(UserService userService) {
        this.userService = userService;
    }

    @GetMapping
    public List<User> getUsers() {
        return userService.getAllUsers();
    }

    @PostMapping
    public User createUser(@RequestBody User user) {
        return userService.saveUser(user);
    }
}

 

 

5. 실행

mongod --dbpath /your/db/path

 

 

 

 

 

 

 

📌 1. Git 초기 설정

  • Git을 처음 설치했다면 사용자 이름과 이메일을 설정
  • 설정 명령어:
    • git config --global user.name "사용자이름"
    • git config --global user.email "이메일주소"

 

📌 2. 로컬 저장소 생성

  • 새로운 프로젝트 디렉터리를 만든 후, Git 초기화:
    • git init
  • 현재 디렉터리가 Git 저장소로 초기화되며, 숨김 폴더 .git이 생성됨

 

📌 3. 원격 저장소 연결(GitHub 연결)

  • GitHub에서 새 저장소(Repository) 생성
  • 로컬 저장소와 원격 저장소 연결:
    • git remote add origin [https://github.com/사용자이름/저장소이름.git]
  • 연결된 원격 저장소 확인:
    • git remote -v

 

📌 4. 파일 상태 확인

  • Git은 파일 상태를 Untracked, Staged, Committed로 구분함
  • 현재 파일 상태를 확인:
    • git status

 

📌 5. 파일 추가(Stage)

  • 모든 파일을 Staging Area에 추가:
    • git add .
  • 특정 파일만 추가하고 싶다면:
    • git add 파일이름

 

📌 6. 커밋(commit)

  • 파일을 저장소에 저장(커밋):
    • git commit -m "커밋 메시지"
  • 커밋 메시지는 변경 내용을 잘 나타내야 함

 

📌 7. 원격 저장소에 푸시(Push)

  • 로컬 커밋을 GitHub 원격 저장소에 업로드:
    • git push origin main
  • 만약 브랜치 이름이 main이 아니라면 해당 브랜치 이름을 사용

 

📌 8. 원격 저장소 변경 내용 가져오기(Pull)

  • 다른 사람이 수정한 내용을 로컬로 가져오기:
    • git pull origin main
  • PullFetch + Merge를 자동으로 실행함

 

📌 9. Git 저장소 복제(Clone)

  • 기존에 있는 GitHub 저장소를 내 로컬에 복사하고 싶을 때 사용:
    • git clone [https://github.com/사용자이름/저장소이름.git]
  • 저장소를 통째로 복제하여 새로운 디렉터리에 다운로드

 

📌 10. Git 브랜치 관리

  • 새로운 브랜치 생성:
    • git branch 새브랜치이름
  • 브랜치 변경:
    • git checkout 새브랜치이름
  • 브랜치 생성과 동시에 이동:
    • git checkout -b 새브랜치이름
  • 로컬 브랜치를 원격 저장소에 푸시:
    • git push origin 새브랜치이름

 

📌 11. Git 브랜치 병합(Merge)

  • 다른 브랜치의 변경 내용을 현재 브랜치에 합치기:
    • git merge 브랜치이름
  • 주의: 충돌(conflict)이 발생할 수 있으며, 충돌 파일을 직접 수정해야 함

 

📌 12. 원격 저장소와 연결 해제(Remove Remote)

  • 기존 원격 저장소 연결 해제:
    • git remote remove origin

 

📍 Tip

  • git log: 커밋 내역을 확인할 수 있음
  • git diff: 변경된 파일의 차이점을 보여줌
  • git reset --hard: 커밋을 초기 상태로 되돌림 (주의: 데이터 손실 가능)
mongo admin

> use admin

> db.createUser({user: 'user01', pwd: 'userpass01', roles: ['root'] })

> use mydb

> db.createUser({user:"user01", pwd:"userpass01", roles:[{role:'root', db:'admin'}] })

> db.getUsers()
[
        {
                "_id" : "mydb.user01",
                "userId" : UUID("1c7166dd-faaa-4887-80f8-ab0000000000"),
                "user" : "user01",
                "db" : "mydb",
                "roles" : [
                        {
                                "role" : "root",
                                "db" : "admin"
                        }
                ],
                "mechanisms" : [
                        "SCRAM-SHA-1",
                        "SCRAM-SHA-256"
                ]
        }
]

https://fullcalendar.io/docs/react

 

 

React Component - Docs | FullCalendar

FullCalendar seamlessly integrates with the React JavaScript framework. It provides a component that exactly matches the functionality of FullCalendar’s standard API. This is more than a mere “connector”. It tells the core FullCalendar package to beg

fullcalendar.io

npm install --save @fullcalendar/react @fullcalendar/core @fullcalendar/daygrid @fullcalendar/interaction

app.js

import './App.css';
import FullCalendar from '@fullcalendar/react';
import dayGridPlugin from '@fullcalendar/daygrid';

function App() {
  return (
    <div className="App">
      <FullCalendar 
        defaultView="dayGridMonth"
        plugins={[ dayGridPlugin ]}
        events={[
          { title: 'event 1', date: '2022-02-01' },
          { title: 'event 2', date: '2022-02-02' }
        ]}
      />
    </div>
  );
}

export default App;

 

 

 

 

 

 

 

+ Recent posts