В Spring Boot - база данных приложения не создается

0

Я создаю приложение Spring Boot. Пока я запускаю приложение, база данных таблицы не создается.

Вот мое application.properties

spring.datasource.url=jdbc:mysql://localhost/aymuws
spring.datasource.username=root
spring.datasource.password=1101289217

spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=create-drop

Класс репозитория User

package com.technostack.aymuws.entities;

@Entity
@Table(name="user")
public class User {

    @Id
    @Email
    @NotEmpty
    @Column(unique=true)
    private String email;

    @Column(name="_name",unique=false,nullable=false,length=100)
    @NotEmpty
    private String name;

    @Column(name="_password",unique=true,nullable=false)
    @NotEmpty
    @Size(max=12,min=6)
    private String password;

    @Column(name="_task")
    @OneToMany(mappedBy="user",cascade=CascadeType.ALL)
    private List<Task> tasks;

    @Column(name="_roles")
    @ManyToMany(cascade=CascadeType.ALL)
    @JoinTable(name="USER_ROLES",joinColumns= {
            @JoinColumn(name="USER_EMAIL",referencedColumnName="email")
    },inverseJoinColumns= {
            @JoinColumn(name="ROLE_NAME",referencedColumnName="name")
    })
    private List<Roles> roles;

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public List<Task> getTasks() {
        return tasks;
    }

    public void setTasks(List<Task> tasks) {
        this.tasks = tasks;
    }

    public List<Roles> getRoles() {
        return roles;
    }

    public void setRoles(List<Roles> roles) {
        this.roles = roles;
    }

    public User(String email, String name, String password) {
        this.email = email;
        this.name = name;
        this.password = password;
    }

    public User() {
    }
}

Класс репозитория Task

package com.technostack.aymuws.entities;

@Entity
public class Task {

    @Id
    @GeneratedValue
    private Long task_id;
    @NotEmpty
    private String date;
    @NotEmpty
    private String starttime;
    @NotEmpty
    private String stoptime;
    @NotEmpty
    private String description;
    @ManyToOne
    @JoinColumn(name="USER_EMAIL",referencedColumnName="email")
    private User user;

    // Constructors, setters & getters
}

И Role репозитория класса

package com.technostack.aymuws.entities;

@Entity
public class Roles {

    @Id
    private String name;
    @ManyToMany(mappedBy="roles")
    private List<User> users;

    // Constructor, getters and setters
}

Класс обслуживания следующий.

package com.technostack.aymuws.service;

@Service
public class UserService {

    @Autowired
    private UserRepository userRepository;

    public void createUser(User user) {
        BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
        user.setPassword(encoder.encode(user.getPassword()));
        Roles user_role = new Roles("USER");
        List<Roles> create_role = new ArrayList<>();
        create_role.add(user_role);
        user.setRoles(create_role);
        userRepository.save(user);
    }

    public void createAdmin(User user) {
        BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
        user.setPassword(encoder.encode(user.getPassword()));
        Roles user_role = new Roles("ADMIN");
        List<Roles> create_role = new ArrayList<>();
        create_role.add(user_role);
        user.setRoles(create_role);
        userRepository.save(user);
    }

    public User findone(String email) {
        return userRepository.findOne(email);
    }
}

Вот консоль, когда я запускаю приложение.

00:33:34.875 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Included patterns for restart : []
00:33:34.881 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Excluded patterns for restart : [/spring-boot-starter/target/classes/, /spring-boot-autoconfigure/target/classes/, /spring-boot-starter-[\w-]+/, /spring-boot/target/classes/, /spring-boot-actuator/target/classes/, /spring-boot-devtools/target/classes/]
00:33:34.882 [main] DEBUG org.springframework.boot.devtools.restart.ChangeableUrls - Matching URLs for reloading : [file:/D:/STS%204%20Project%20Workspace/Spring/AymuwsManagementSystem/target/classes/]

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _' | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v1.5.20.RELEASE)

2019-04-22 00:33:35.898  INFO 6448 --- [  restartedMain] .t.a.i.AymuwsManagementSystemApplication : Starting AymuwsManagementSystemApplication on ADMIN-PC with PID 6448 (started by ADMIN in D:\STS 4 Project Workspace\Spring\AymuwsManagementSystem)
2019-04-22 00:33:35.901  INFO 6448 --- [  restartedMain] .t.a.i.AymuwsManagementSystemApplication : No active profile set, falling back to default profiles: default
2019-04-22 00:33:36.877  INFO 6448 --- [  restartedMain] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@143eb1f4: startup date [Mon Apr 22 00:33:36 IST 2019]; root of context hierarchy
2019-04-22 00:33:41.963  INFO 6448 --- [  restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$f40d0ceb] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-04-22 00:33:43.478  INFO 6448 --- [  restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2019-04-22 00:33:43.619  INFO 6448 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-04-22 00:33:43.620  INFO 6448 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.39
2019-04-22 00:33:43.986  INFO 6448 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-04-22 00:33:43.987  INFO 6448 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 7119 ms
2019-04-22 00:33:44.552  INFO 6448 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2019-04-22 00:33:44.553  INFO 6448 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2019-04-22 00:33:44.554  INFO 6448 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2019-04-22 00:33:44.554  INFO 6448 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2019-04-22 00:33:44.556  INFO 6448 --- [ost-startStop-1] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: 'springSecurityFilterChain' to: [/*]
2019-04-22 00:33:44.557  INFO 6448 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
Mon Apr 22 00:33:45 IST 2019 WARN: Establishing SSL connection without server identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Mon Apr 22 00:33:47 IST 2019 WARN: Establishing SSL connection without server identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Mon Apr 22 00:33:47 IST 2019 WARN: Establishing SSL connection without server identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Mon Apr 22 00:33:47 IST 2019 WARN: Establishing SSL connection without server identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Mon Apr 22 00:33:47 IST 2019 WARN: Establishing SSL connection without server identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Mon Apr 22 00:33:47 IST 2019 WARN: Establishing SSL connection without server identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Mon Apr 22 00:33:47 IST 2019 WARN: Establishing SSL connection without server identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Mon Apr 22 00:33:47 IST 2019 WARN: Establishing SSL connection without server identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Mon Apr 22 00:33:47 IST 2019 WARN: Establishing SSL connection without server identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Mon Apr 22 00:33:47 IST 2019 WARN: Establishing SSL connection without server identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
2019-04-22 00:33:48.182  INFO 6448 --- [  restartedMain] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2019-04-22 00:33:48.246  INFO 6448 --- [  restartedMain] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
    name: default
    ...]
2019-04-22 00:33:48.501  INFO 6448 --- [  restartedMain] org.hibernate.Version                    : HHH000412: Hibernate Core {5.0.12.Final}
2019-04-22 00:33:48.504  INFO 6448 --- [  restartedMain] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
2019-04-22 00:33:48.508  INFO 6448 --- [  restartedMain] org.hibernate.cfg.Environment            : HHH000021: Bytecode provider name : javassist
2019-04-22 00:33:48.622  INFO 6448 --- [  restartedMain] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2019-04-22 00:33:49.004  INFO 6448 --- [  restartedMain] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
2019-04-22 00:33:49.642  INFO 6448 --- [  restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport  : HHH000227: Running hbm2ddl schema export
2019-04-22 00:33:49.664  INFO 6448 --- [  restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport  : HHH000230: Schema export complete
2019-04-22 00:33:49.758  INFO 6448 --- [  restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2019-04-22 00:33:50.844  INFO 6448 --- [  restartedMain] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@143eb1f4: startup date [Mon Apr 22 00:33:36 IST 2019]; root of context hierarchy
2019-04-22 00:33:51.194  INFO 6448 --- [  restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2019-04-22 00:33:51.198  INFO 6448 --- [  restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2019-04-22 00:33:51.343  INFO 6448 --- [  restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2019-04-22 00:33:51.344  INFO 6448 --- [  restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2019-04-22 00:33:51.518  INFO 6448 --- [  restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2019-04-22 00:33:51.654  WARN 6448 --- [  restartedMain] .t.AbstractTemplateResolverConfiguration : Cannot find template location: classpath:/templates/ (please add some templates or check your Thymeleaf configuration)
2019-04-22 00:33:53.669  INFO 6448 --- [  restartedMain] b.a.s.AuthenticationManagerConfiguration : 

Using default security password: 0ca7d39a-a92e-4e5b-a0e5-8ac4530d5849

2019-04-22 00:33:53.850  INFO 6448 --- [  restartedMain] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: OrRequestMatcher [requestMatchers=[Ant [pattern='/css/**'], Ant [pattern='/js/**'], Ant [pattern='/images/**'], Ant [pattern='/webjars/**'], Ant [pattern='/**/favicon.ico'], Ant [pattern='/error']]], []
2019-04-22 00:33:54.145  INFO 6448 --- [  restartedMain] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: OrRequestMatcher [requestMatchers=[Ant [pattern='/**']]], [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@27ef81f6, org.springframework.security.web.context.SecurityContextPersistenceFilter@66a10a07, org.springframework.security.web.header.HeaderWriterFilter@3b89247c, org.springframework.security.web.authentication.logout.LogoutFilter@aa4c06d, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@13b8cd35, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@77d4b0f1, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@31591127, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@1245fcf2, org.springframework.security.web.session.SessionManagementFilter@15098ea6, org.springframework.security.web.access.ExceptionTranslationFilter@5e21e0fd, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@7ce8e89c]
2019-04-22 00:33:54.683  WARN 6448 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : Unable to start LiveReload server
2019-04-22 00:33:54.981  INFO 6448 --- [  restartedMain] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2019-04-22 00:33:55.109  INFO 6448 --- [  restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2019-04-22 00:33:55.135  INFO 6448 --- [  restartedMain] .t.a.i.AymuwsManagementSystemApplication : Started AymuwsManagementSystemApplication in 20.199 seconds (JVM running for 21.509)

Я настраиваю всю информацию базы данных в файле свойств. Однако после выполнения приложения я не могу создать базу данных.

  • 0
    Включите ваш основной класс и любые дополнительные классы конфигурации. Похоже, что вы поместили свой основной класс в его собственный пакет, но не сказали Spring сканировать другие пакеты на предмет различных классов.
Теги:
spring-boot
spring

2 ответа

0

Вы на самом деле не создаете базу данных из вашего загрузочного приложения Spring, вместо этого вы подключаетесь к ней.

Чтобы создать базу данных, вам необходимо сначала установить MySQL в вашей системе, запустить службу, а затем создать базу данных там вместе с таблицами user, role и task. Поместите имя базы данных в свой файл application.properties укажите класс Component конфигурации базы данных для подключения к вашей базе данных.

Вот пример файла application.properties из одного из моих проектов, который подключается к базе данных MySQL.

spring.datasource.username=root
spring.datasource.password=mypass
spring.datasource.dataSourceClassName=com.mysql.cj.jdbc.MysqlDataSource
spring.datasource.databaseName=mydatabase
spring.datasource.serverName=localhost
spring.datasource.maximumPoolSize=5
spring.datasource.port=3306
spring.datasource.url=jdbc:mysql://localhost/mydatabase?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC

spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect
spring.jpa.database=MYSQL
spring.jpa.hibernate.ddl-auto=none
spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.EJB3NamingStrategy
spring.jpa.openInView=false
spring.jpa.show_sql=false
spring.jpa.generate-ddl=false
application.name=my-application

И класс конфигурации базы данных может выглядеть следующим образом.

package com.technostack.aymuws.config;

import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContextException;
import org.springframework.context.EnvironmentAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import java.util.Arrays;

@Configuration
@EnableJpaRepositories("package com.technostack.aymuws.entities")
@EnableTransactionManagement
public class DatabaseConfiguration implements EnvironmentAware {

    private final Logger log = LoggerFactory.getLogger(DatabaseConfiguration.class);
    private Environment env;

    private static final String DATASOURCE_CLASS_NAME = "spring.datasource.dataSourceClassName";
    private static final String PROPERTY_DATABASE_NAME = "spring.datasource.databaseName";
    private static final String PROPERTY_URL = "spring.datasource.url";
    private static final String PROPERTY_SERVER_NAME = "spring.datasource.serverName";
    private static final String PROPERTY_USER_NAME = "spring.datasource.username";
    private static final String PROPERTY_PASSWORD = "spring.datasource.password";
    private static final String MAX_POOL_SIZE = "spring.datasource.maximumPoolSize";
    private static final String PROPERTY_PORT = "spring.datasource.port";

    @Override
    public void setEnvironment(Environment env) {
        this.env = env;
    }

    @Bean(destroyMethod = "close")
    public HikariDataSource dataSource() {
        log.debug("Configuring Datasource...");
        databaseConnectionPoolCheck();
        HikariConfig config = configureDataSource();

        log.debug("Database host: " + config.getDataSourceProperties().get("serverName"));
        log.debug("Database name: " + config.getDataSourceProperties().get("databaseName"));
        return new HikariDataSource(config);
    }

    private HikariConfig configureDataSource() {
        HikariConfig config = new HikariConfig();
        config.setDataSourceClassName(env.getProperty(DATASOURCE_CLASS_NAME));
        addDatabaseServer(config);
        config.addDataSourceProperty("user", env.getProperty(PROPERTY_USER_NAME));
        config.addDataSourceProperty("password", env.getProperty(PROPERTY_PASSWORD));

        String port = env.getProperty(PROPERTY_PORT);

        if (port != null)
            config.addDataSourceProperty("portNumber", port);

        config.setMaximumPoolSize(env.getProperty(MAX_POOL_SIZE, Integer.class));
        return config;
    }

    private void databaseConnectionPoolCheck() {
        if (env.getProperty(PROPERTY_URL) == null
                && env.getProperty(PROPERTY_DATABASE_NAME) == null) {
            log.error("Your database connection pool configuration is incorrect! The application"
                            + "cannot start. Please check your Spring profile, current profiles are: {}",
                    Arrays.toString(env.getActiveProfiles()));

            throw new ApplicationContextException("Database connection pool is not configured correctly");
        }
    }

    private void addDatabaseServer(HikariConfig config) {
        if (env.getProperty(PROPERTY_URL) == null
                || "".equals(env.getProperty(PROPERTY_URL))) {
            config.addDataSourceProperty("databaseName", env.getProperty(PROPERTY_DATABASE_NAME));
            config.addDataSourceProperty("serverName", env.getProperty(PROPERTY_SERVER_NAME));
        } else {
            config.addDataSourceProperty("url", env.getProperty(PROPERTY_URL));
        }
    }
}

Возможно, вам также придется добавить следующую зависимость в ваш pom.xml.

<dependency>
    <groupId>com.zaxxer</groupId>
    <artifactId>HikariCP</artifactId>
    <version>3.3.1</version>
</dependency>

И наконец, я обнаружил еще одну проблему в вашем коде, которая заключается в @Table аннотация @Table отсутствует в вашем классе сущностей Role and Task. Класс User имеет аннотацию @Table это нормально. Эта аннотация @Table отображает таблицу базы данных вместе с этим классом хранилища. Пожалуйста, исправьте это.

0

Измените эту конфигурацию в application.properties и посмотрите, работает ли она

spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url = jdbc:mysql://localhost:3306/aymuws?autoReconnect=true&verifyServerCertificate=false&useSSL=false&requireSSL=false

Ещё вопросы

Сообщество Overcoder
Наверх
Меню