|
|
@ -4,6 +4,7 @@ import java.sql.Timestamp;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.UUID;
|
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import jakarta.persistence.EntityManager;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
import org.springframework.context.annotation.ComponentScan;
|
|
|
|
import org.springframework.context.annotation.ComponentScan;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
@ -11,6 +12,8 @@ import org.springframework.http.converter.HttpMessageConverter;
|
|
|
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
|
|
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
|
|
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
|
|
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
|
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
|
|
|
|
|
|
import space.kklochko.spring_rest_example.db.factories.EntityManagerConnection;
|
|
|
|
|
|
|
|
import space.kklochko.spring_rest_example.db.repositories.IndicatorRepository;
|
|
|
|
import space.kklochko.spring_rest_example.models.Indicator;
|
|
|
|
import space.kklochko.spring_rest_example.models.Indicator;
|
|
|
|
|
|
|
|
|
|
|
|
@EnableWebMvc
|
|
|
|
@EnableWebMvc
|
|
|
@ -22,11 +25,13 @@ public class WebConfig implements WebMvcConfigurer {
|
|
|
|
converters.add(new MappingJackson2HttpMessageConverter());
|
|
|
|
converters.add(new MappingJackson2HttpMessageConverter());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Bean("indicator")
|
|
|
|
@Bean
|
|
|
|
public Indicator getIndicator() {
|
|
|
|
public EntityManager manager() {
|
|
|
|
UUID id = UUID.fromString("becbafac-702c-11ee-9113-c0e4349366ab");
|
|
|
|
return (new EntityManagerConnection("spring_rest_example")).connect();
|
|
|
|
Timestamp timestamp = Timestamp.valueOf("2023-10-18 14:30:00");
|
|
|
|
}
|
|
|
|
Indicator indicator = new Indicator(id, "Blood2", "Fine2", timestamp);
|
|
|
|
|
|
|
|
return indicator;
|
|
|
|
@Bean
|
|
|
|
|
|
|
|
public IndicatorRepository indicatorRepository(EntityManager manager) {
|
|
|
|
|
|
|
|
return new IndicatorRepository(manager);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|