[main] WARN org.springframework.context.annotation.AnnotationConfigApplicationContext - Exception encountered during context initialization - cancel ling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'bot' defined in URL [jar:file:/root/Telegr am.jar!/com/nikita/bot/Bot.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.Unsati sfiedDependencyException: Error creating bean with name 'channelService' defined in URL [jar:file:/root/Telegram.jar!/com/nikita/service/ChannelService.class]: U nsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaChannelRepository' defined in com.nikita.repository.JpaChannelRepository defined in @EnableJpaRepositories declared on App: Cannot create inner be an '(inner bean)#3382f8ae' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org. springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#3382f8ae': Cannot resolve reference to bean 'entityManagerFactor y' while setting constructor argument; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'entityManagerFactory' available
21:43:19.367 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'bot' defined in URL [jar:file:/root/Telegram.jar!/com/nikita/bot /Bot.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyExcepti on: Error creating bean with name 'channelService' defined in URL [jar:file:/root/Telegram.jar!/com/nikita/service/ChannelService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaChannel Repository' defined in com.nikita.repository.JpaChannelRepository defined in @EnableJpaRepositories declared on App: Cannot create inner bean '(inner bean)#3382f 8ae' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans. factory.BeanCreationException: Error creating bean with name '(inner bean)#3382f8ae': Cannot resolve reference to bean 'entityManagerFactory' while setting const ructor argument; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'entityManagerFactory' available
import com.nikita.model.Channel;
import com.nikita.repository.JpaChannelRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class ChannelService {
private final JpaChannelRepository jpaChannelRepository;
@Autowired
public ChannelService(JpaChannelRepository jpaChannelRepository) {
this.jpaChannelRepository = jpaChannelRepository;
}
public List<Channel> findByStart(boolean start){
return jpaChannelRepository.findAllByStart(start);
}
public Channel update(Channel channel){
return jpaChannelRepository.save(channel);
}
public void delete(String id){
jpaChannelRepository.deleteById(id);
}
public List<Channel> findAll(){
return jpaChannelRepository.findAll();
}
public Channel findById(String id){
return jpaChannelRepository.findById(id).get();
}
}
package com.nikita.repository;
import com.nikita.model.Channel;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
@Repository
public interface JpaChannelRepository extends JpaRepository<Channel, String> {
@Override
Optional<Channel> findById(String id);
@Query("SELECT c FROM Channel c WHERE c.start=:start")
List<Channel> findAllByStart(@Param("start") boolean start);
@Override
<S extends Channel> S save(S s);
@Override
void deleteById(String id);
}
Первый раз деплою. через идею все нормально отрабатывает, но при попытке задеплоить на vps выдает ошибку
hibernate.ddl-auto: validate
и если установлен, то импортировали ли вы ddl & dml на сервер. Или у вас он на production должен создать ddl сам?public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(App.class);
}
}