- @Autowired
- ApplicationProperties properties;
- @Autowired
- JdbcTemplate jdbcTemplate;
-
-
- @Bean
- public String bootstrapServers() { return properties.bootstrapServers; }
-
- @Bean
- public String topic() {
- return properties.topic;
- }
-
- @Bean
- public String consumerGroup() {
- return properties.consumerGroup;
- }
-
- @Bean
- public WebMvcConfigurer corsConfigurer() {
- return new WebMvcConfigurer() {
- @Override
- public void addCorsMappings(CorsRegistry registry) {
- registry
- .addMapping("/**")
- .allowedOrigins("http://localhost:4200");
- }
- };
- }
-
-
- @Override
- public void run(String... strings) throws Exception {
-
- LOG.info("Creating tables");
- jdbcTemplate.execute("DROP TABLE users IF EXISTS");
- jdbcTemplate.execute("CREATE TABLE users(id SERIAL, username VARCHAR(255), loggedIn BOOLEAN)");
- }
-
-