2018-07-10T23:42:39.936010+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx300m -Xss512k -Dfile.encoding=UTF-8
2018-07-10T23:42:39.931694+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2018-07-10T23:42:42.242732+00:00 app[web.1]:
2018-07-10T23:42:42.243091+00:00 app[web.1]: . ____ _ __ _ _
2018-07-10T23:42:42.243219+00:00 app[web.1]: /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
2018-07-10T23:42:42.243331+00:00 app[web.1]: ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
2018-07-10T23:42:42.243411+00:00 app[web.1]: \\/ ___)| |_)| | | | | || (_| | ) ) ) )
2018-07-10T23:42:42.243520+00:00 app[web.1]: ' |____| .__|_| |_|_| |_\__, | / / / /
2018-07-10T23:42:42.243645+00:00 app[web.1]: =========|_|==============|___/=/_/_/_/
2018-07-10T23:42:42.254723+00:00 app[web.1]: :: Spring Boot :: (v2.0.3.RELEASE)
2018-07-10T23:42:42.254783+00:00 app[web.1]:
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'usuarioService': Unsatisfied dependency expressed through field 'passwordEnconder'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
2018-07-10T23:42:57.065261+00:00 app[web.1]: 2018-07-10 23:42:57.065 INFO 4 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2018-07-10T23:42:57.147945+00:00 app[web.1]: 2018-07-10 23:42:57.147 INFO 4 --- [ main] ConditionEvaluationReportLoggingListener :
2018-07-10T23:42:57.100118+00:00 app[web.1]: 2018-07-10 23:42:57.099 INFO 4 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
2018-07-10T23:42:57.104581+00:00 app[web.1]: 2018-07-10 23:42:57.104 INFO 4 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2018-07-10T23:42:57.063073+00:00 app[web.1]: 2018-07-10 23:42:57.062 INFO 4 --- [ main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2018-07-10T23:42:57.147949+00:00 app[web.1]:
2018-07-10T23:42:57.147951+00:00 app[web.1]: Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-07-10T23:42:57.723521+00:00 app[web.1]: 2018-07-10 23:42:57.721 ERROR 4 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
2018-07-10T23:42:57.723542+00:00 app[web.1]:
2018-07-10T23:42:57.723544+00:00 app[web.1]: ***************************
2018-07-10T23:42:57.723546+00:00 app[web.1]: APPLICATION FAILED TO START
2018-07-10T23:42:57.723547+00:00 app[web.1]: ***************************
2018-07-10T23:42:57.723549+00:00 app[web.1]:
2018-07-10T23:42:57.723551+00:00 app[web.1]: Description:
2018-07-10T23:42:57.723553+00:00 app[web.1]:
2018-07-10T23:42:57.723555+00:00 app[web.1]: Field passwordEnconder in ***************************.service.UsuarioService required a bean of type 'org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder' that could not be found.
2018-07-10T23:42:57.723557+00:00 app[web.1]:
2018-07-10T23:42:57.723558+00:00 app[web.1]:
2018-07-10T23:42:57.723560+00:00 app[web.1]: Action:
2018-07-10T23:42:57.723561+00:00 app[web.1]:
2018-07-10T23:42:57.723563+00:00 app[web.1]: Consider defining a bean of type 'org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder' in your configuration.
2018-07-10T23:42:57.723565+00:00 app[web.1]:
2018-07-10T23:42:57.963044+00:00 heroku[web.1]: State changed from starting to crashed
2018-07-10T23:42:57.873810+00:00 heroku[web.1]: Process exited with status 1
2018-07-10T23:42:59.719391+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=*************************** request_id=83daa9ee-e615-493a-bff3-90ad5384cfc0 fwd="177.89.236.26" dyno= connect= service= status=503 bytes= protocol=https
2018-07-10T23:43:01.778412+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=*************************** request_id=e6900e37-0c79-4f91-a552-30050f4c3fb1 fwd="177.89.236.26" dyno= connect= service= status=503 bytes= protocol=https
2018-07-10T23:43:03.138838+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=*************************** request_id=3d1f00ca-fc2d-414b-8440-cf35221c76fe fwd="177.89.236.26" dyno= connect= service= status=503 bytes= protocol=https
我试图在heroku上部署我的应用程序,但出现错误。但是当我在PC上运行它时,我没有收到此错误,一切都运行正常
我在一个具有@Configuration批注的类中声明了这个Bean。
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
在另一个类中,我尝试使用它。
@Autowired
private BCryptPasswordEncoder passwordEnconder;
答案 0 :(得分:0)
不要autowire
实现。而是autowire
接口
试试这个:
@Autowired
private PasswordEncoder passwordEncoder;