JpaRepository не сохраняет объект в БД
Пытаюсь сохранить объекта класса Weather в бд, но он не сохраняется и не выдаётся никаких ошибок. В чём может быть проблема?
package com.example.Testww.rep;
import com.example.Testww.Weather;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface WeatherRepository extends JpaRepository<Weather, Long> {
}
package com.example.Testww;
import com.example.Testww.rep.WeatherRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/weather")
public class Controller {
WeatherService weatherService;
@Autowired
public Controller(WeatherService weatherService){
this.weatherService= weatherService;
}
@GetMapping("/save")
public void SsaveWeather(){
Weather weather = new Weather();
weather.setHumidity(5.5);
weather.setTemperature(15.5);
weatherService.saveWeather(weather);
}
}
package com.example.Testww;
import com.example.Testww.rep.WeatherRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class WeatherService {
WeatherRepository weatherRepository;
@Autowired
public WeatherService(WeatherRepository weatherRepository){
this.weatherRepository = weatherRepository;
}
public void saveWeather(Weather weather){
weatherRepository.save(weather);
}
}