0

http://websystique.com/spring-boot/spring-boot-angularjs-spring-data-jpa-crud-app-example/我从教程中导入了此项目,它运行完美无误。但是为了查看它使用了index.ftl,它在eclipse中显示了404错误。弹簧引导angularjs弹簧数据jpa crud-app示例在日食中获取404错误

我application.yml文件

--- 
server: 
    port: 8080 
    contextPath: /SpringBootCRUDApp 
--- 
spring: 
    profiles: local, default 
datasource: 
    sampleapp: 
    url: jdbc:h2:~/emp 
    username: sa 
    password: 
    driverClassName: org.h2.Driver 
    defaultSchema: 
    maxPoolSize: 10 
    hibernate: 
     hbm2ddl.method: create-drop 
     show_sql: true 
     format_sql: true 
     dialect: org.hibernate.dialect.H2Dialect 
--- 
spring: 
    profiles: prod 
datasource: 
    sampleapp: 
    url: jdbc:mysql://localhost:3306/emp 
    username: root 
    password: root 
    driverClassName: com.mysql.jdbc.Driver 
    defaultSchema: 
    maxPoolSize: 20 
    hibernate: 
     hbm2ddl.method: update 
     show_sql: true 
     format_sql: true 
     dialect: org.hibernate.dialect.MySQLDialect 

回答

1

这个应用程序是一个春天启动应用程序,它就像一个独立的应用程序(它使用内部的Tomcat),无需使用外部的Tomcat。您必须使用maven或直接从应用程序类来启动它。

  1. 如果您已经在运行,请停止任何服务器。
  2. 在项目转到类SpringBootCRUDApp - > rightClick - >作为Spring Boot Application运行。现在,你应该看到应用程序正在开始。

一旦它开始,转到浏览器并给这个URL http://localhost:8080/SpringBootCRUDApp。你应该看到上面显示的屏幕。

+0

这适用于我。谢谢 – techsavvy

+0

好标记答案然后。 –

0

相信你的应用程序已经成功启动。

您应该使用http://localhost:8080/SpringBootCRUDApp ..

enter image description here

+0

无法启动应用程序获取错误404.您是否能够启动相同的应用程序? http://imgur.com/a/B0UaO – techsavvy

+0

我也使用上面提到的url,但得到相同的错误 – techsavvy

+0

我在问你的应用程序是否在控制台启动。你可以发送你的控制台日志截图,并尝试下面的URl。 SpringBootCRUDApp在application.properties中定义。 http:// localhost:8080/SpringBootCRUDApp –