Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

Application not starting with Spring JPA #39

Open
Cylop opened this issue Dec 19, 2021 · 0 comments
Open

Application not starting with Spring JPA #39

Cylop opened this issue Dec 19, 2021 · 0 comments

Comments

@Cylop
Copy link

Cylop commented Dec 19, 2021

I am trying to create the presistence layer via Spring JPA but when I try to start the application the error below is thrown. If I start the module with the Spring part on its own, everything is working.

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'entityManagerFactory' available [18:05:44] [Server thread/WARN]: at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:863) [18:05:44] [Server thread/WARN]: at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1344) [18:05:44] [Server thread/WARN]: at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:309) [18:05:44] [Server thread/WARN]: at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) [18:05:44] [Server thread/WARN]: at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:330)

application.properties is present in resources folder

Main class does look like this:

`

 public class BansPlugin extends JavaPlugin {

private ConfigurableApplicationContext context;

@Override
public void onEnable() {
    saveDefaultConfig();

    try {
        context = SpringSpigotBootstrapper.initialize(this, new SpringApplicationBuilder().bannerMode(Banner.Mode.OFF).sources(BanApplication.class));
    } catch (ExecutionException | InterruptedException e) {
        e.printStackTrace();
    }
}

@Override
public void onDisable() {
    context.close();
    context = null;
}

}
`

and the application class does look like this:

@SpringBootApplication public class BanApplication { }

I have no clue why its not working with spigot

Edit:

Dependencies:

implementation 'org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT' implementation 'org.springframework.boot:spring-boot-starter-data-jpa' runtimeOnly 'mysql:mysql-connector-java' implementation 'dev.alangomes:spigot-spring-boot-starter:0.20.7'

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant