Logs
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.4.2.RELEASE)
2017-05-10 22:20:52.172 INFO 4433 --- [ main] com.userModule.user_module.Application : Starting Application on hiren-vostro with PID 4433 (/media/hiren/Study/workspace/user-module/target/classes started by hiren in /media/hiren/Study/workspace/user-module)
2017-05-10 22:20:52.210 INFO 4433 --- [ main] com.userModule.user_module.Application : The following profiles are active: application.properties
2017-05-10 22:20:52.758 INFO 4433 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@15c43bd9: startup date [Wed May 10 22:20:52 IST 2017]; root of context hierarchy
2017-05-10 22:21:01.766 INFO 4433 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$28cfbdfe] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-05-10 22:21:04.373 INFO 4433 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2017-05-10 22:21:04.515 INFO 4433 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2017-05-10 22:21:04.526 INFO 4433 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.6
2017-05-10 22:21:05.046 INFO 4433 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2017-05-10 22:21:05.047 INFO 4433 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 12312 ms
2017-05-10 22:21:05.595 INFO 4433 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2017-05-10 22:21:05.607 INFO 4433 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-05-10 22:21:05.609 INFO 4433 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2017-05-10 22:21:05.609 INFO 4433 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2017-05-10 22:21:05.610 INFO 4433 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2017-05-10 22:21:06.130 WARN 4433 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mainController': Unsatisfied dependency expressed through field 'userRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Cannot create inner bean '(inner bean)#c6634d' 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)#c6634d': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'entityManagerFactory' available
2017-05-10 22:21:06.139 INFO 4433 --- [ main] o.apache.catalina.core.StandardService : Stopping service Tomcat
2017-05-10 22:21:06.326 INFO 4433 --- [ main] utoConfigurationReportLoggingInitializer :
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-05-10 22:21:06.596 ERROR 4433 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Field userRepository in com.userModule.user_module.MainController required a bean named 'entityManagerFactory' that could not be found.
行动:
考虑在配置中定义一个名为entityManagerFactory的bean。
下面是代码。应用JAVA
package com.userModule.user_module;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
// TODO Auto-generated method stub
SpringApplication.run(Application.class,args);
}
}
主控制器。JAVA
package com.userModule.user_module;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.userModule.user_module.AppUser;
import com.userModule.user_module.UserRepository;
@RestController
@RequestMapping(path="/demo")
public class MainController {
@Autowired
private UserRepository userRepository;
@GetMapping(path="/add")
public @ResponseBody String addNewUser(@RequestParam String name, @RequestParam String email){
AppUser newUser = new AppUser();
newUser.setName(name);
newUser.setEmail(email);
this.userRepository.save(newUser);
return "Saved";
}
}
AppUser。JAVA
package com.userModule.user_module;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
@Entity
public class AppUser {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private int id;
private String name;
private String email;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setEmail(String email) {
this.email = email;
}
public String getEmail() {
return email;
}
}
用户存储库。JAVA
package com.userModule.user_module;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface UserRepository extends CrudRepository<AppUser, Long>{
}
波姆。xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.userModule</groupId>
<artifactId>user-module</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>user-module</name>
<url>http://maven.apache.org</url>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.RELEASE</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.1.4.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.2.3.Final</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4-1206-jdbc42</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
application.properties
spring.datasource.driver-class-name=org.postgresql.Driver
spring.jpa.hibernate.ddl-auto=create
spring.datasource.url=jdbc:postgresql://localhost:5432/postgres
spring.datasource.username=postgres
spring.datasource.password=password
spring.profiles.active=application.properties
尝试从pom中删除这些依赖项。xml,因为它们已经被spring数据jpa提取
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.1.4.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.2.3.Final</version>
</dependency>
我们使用的是Spring启动版本 2.1.3,并启动了冲刺引导 jpa。 应用程序在启动时失败,日志为: 将ScanOptions[org.hibernate.boot.archive.scan.internal.StandardScanOptions@78d49939]注入BootstrapContext;是[org.hibernate.boot.archive.scan.internal.St
当我运行这个错误时,请帮助我解决这个问题 启动应用程序上下文时出错。要显示条件,请报告启用“调试”后重新运行应用程序。2019-02-11 10:53:55.839错误8804 --- [ restartedMain]o. s. b. d.日志失败分析记者: 应用程序启动失败 说明: com中的字段userDao。实例Spring Security应用程序编程接口。服务UserServiceImp
我是spring的初学者,希望这样做示例项目…我有一个数据库,我想连接到它…我使用了像AutoWired和service这样的注释。但有个问题我解决不了 Controller包中的RegisterationController具有我要调用的服务: 第一个包中的DataManagement类: 第一包中的StudentAccountRepository: 第一包中得学生帐户..引用数据库中的表: M
> 出错原因:任务“:bootrun”执行失败。 进程'command'/library/java/javavirtualmachines/jdk1.8.0_60.jdk/contents/home/bin/java''以非零退出值1完成 发生异常:2015-08-23 01:37:57.989 WARN 6186---[main]ationConfigEmbeddedWebApplication
我的程序编译了所有内容,我没有出错,但我实际上期望tomcat应该永久在端口8080上。输出中也没有Spring。在另一个项目中,我做的一切都很好。谢谢你帮助我。 我的父母: 我的tarter.class: 我的Starter-Pom: 控制台输出: 然后什么都不会发生了。谢谢你的帮助。
在Microsoft.azure.services.appauthentication.azureSeviceTokenProvider.getAccessStokenAsyncimpl(字符串权限、字符串资源、字符串范围)在Microsoft.azure.keyvault.keyvault.keyvaultCredential.postAuthenticate(HttpResponseMessa