@Configuration @ComponentScan("ru.todolist.controller") public class AppConfig { @Bean public DataSource dataSource() { System.out.println("Create datasource begin"); DriverManagerDataSource dataSource = new DriverManagerDataSource(); dataSource.setDriverClassName("org.apache.derby.jdbc.ClientDriver"); dataSource.setUrl("jdbc:derby://localhost:1527/todo;create=true"); dataSource.setUsername("user"); dataSource.setPassword("password"); System.out.println(dataSource); System.out.println("Create datasource end"); return dataSource; } @Autowired @Bean public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean(DataSource dataSource) throws SQLException { LocalContainerEntityManagerFactoryBean bean = new LocalContainerEntityManagerFactoryBean(); Properties properties = new Properties(); String systemDir = "./todo"; properties.put("derby.system.home", systemDir); properties.put("hibernate.dialect", "org.hibernate.dialect.DerbyDialect"); properties.put("hibernate.hbm2ddl.auto", "create"); bean.setPersistenceProviderClass(HibernatePersistenceProvider.class); bean.setDataSource(dataSource); bean.setJpaProperties(properties); bean.setPackagesToScan("ru.todolist"); System.out.println("Create entity end"); return bean; } @Autowired @Bean public JpaTransactionManager transactionManager(EntityManagerFactory entityManagerFactory, DataSource dataSource) { System.out.println("Create transaction begin"); JpaTransactionManager bean = new JpaTransactionManager(entityManagerFactory); bean.setDataSource(dataSource); System.out.println(bean); System.out.println("Create transaction end"); return bean; } Решил так, добавил в pom.xml: ... <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> <dependency> <groupId>de.roskenet</groupId> <artifactId>springboot-javafx-support</artifactId> <version>${springboot-javafx.version}</version> </dependency> </dependencies> <build> <resources> <resource> <filtering>false</filtering> <directory>src/main/java</directory> <includes> <include>**/*.fxml</include> </includes> </resource> <resource> <filtering>false</filtering> <directory>src/main/resources</directory> <includes> <include>**/*.fxml</include> <include>**/*.css</include> </includes> </resource> </resources> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> <repositories> <repository> <id>maven-central-repo</id> <url>http://repo1.maven.org/maven2</url> <snapshots> <enabled>true</enabled> </snapshots> </repository> <repository> <id>spring-releases</id> <name>Spring Releases</name> <url>https://repo.spring.io/libs-release</url> </repository> <repository> <id>org.jboss.repository.releases</id> <name>JBoss Maven Release Repository</name> <url>https://repository.jboss.org/nexus/content/repositories/releases</url> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>spring-releases</id> <name>Spring Releases</name> <url>https://repo.spring.io/libs-release</url> </pluginRepository> </pluginRepositories> ... 
  • can't create bin - Ilya Chizhanou
  • I understand that I can not. Why? The project is assembled and started in eclipse, the bins are created, the transactions go through, but when you collect it maven in the jar and launch it, this error appears. I noticed that if you add all the necessary libraries into one folder and specify java.exe path to the folder with the project classes, everything also works fine. - Leshey
  • PM org.springframework.context.annotation.AnnotationConfigApplicationContext refreshing Invocation of init method failed; nested exception is javax.persistence.PersistenceException: Unable to resolve unit root URL - Leshey
  • add a log to the question - Mikhail Vaysman
  • one
    @Leshey in your comments, the response and contains, the program must have access to dependencies. - Sergey Gornostaev

0