I am upgrading a Spring Boot application from version 1.5.6 to 2.1.1. When I start the application, it gets stuck at this line:
INFO: Initializing Spring DispatcherServlet 'dispatcherServlet'
When I hit this URL: http://localhost:8888/actuator/health, I get {"status":"UP"}
Also when I hit this URL: http://localhost:8888/swagger-ui.html, I see the Swagger UI.
But my main application doesn’t start. Any idea why it’s stuck?
You have just to exclude security auto configuration.
Just add on your main SpringbootApplication
#SpringBootApplication(exclude = SecurityAutoConfiguration.class)
I was facing the same issue. Below code was already a part of my application's main class.
#SpringBootApplication(exclude = SecurityAutoConfiguration.class)
I could not see any logs saying that application has started or anything as such. I had logging level to DEBUG.
logging:
level:
root: ERROR
org:
springframework: DEBUG
But when I tried hitting my APIs from localhost, it could get expected response. The application was running on port 8080 in my case.
I know its old.
I was stuck similarly when I tried to move from SpringBoot 1.5 to 2.
What fixed it for me was when I added
#SpringBootApplication(exclude = { SecurityAutoConfiguration.class })
based on differences in springboot2 and this springboo2 security tutorial . Spring 2 migration guide -> 2
Related
I am trying to upgrade my web application that is running on Spring boot 1.3.5-Release to 2.7.1. The ultimate goal for this is to implement OIDC authentication in my web app.
The below are the current versions used
<spring.boot.version>1.3.5.RELEASE</spring.boot.version>
<spring.version>4.1.3.RELEASE</spring.version>
<spring.integration.version>4.1.3.RELEASE</spring.integration.version>
<org.hibernate.version>4.3.10.Final</org.hibernate.version>
<aspectj.version>1.8.7</aspectj.version>
To implement OIDC authentication I am supposed to use OAuth2 client dependency. To use this dependency I need to use Spring Security version 5.x.x(I guess so - correct me plz). With these lower versions how can I implement the thing I wanted?
I just tried to upgrade Spring boot to 2.7.1 by resolving some multiple build issues. But finally while running the application I am getting the below error.
2022-10-26 21:26:31.251 INFO 14788 --- [main] o.s.core.annotation.MergedAnnotation : Failed to introspect annotations on public org.springframework.transaction.PlatformTransactionManager org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.transactionManager(org.springframework.beans.factory.ObjectProvider): java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
What am I missing here?? What is the minimum version of Spring and Springboot that I need to use for implementing OIDC Auth??
framework Spring Authorization Server maybe better for OIDC implementation.
This is not a web project, but I still add spring-boot-starter-actuator in pom, and specify management.port=8081, then in last of run method of CommandLineRunner , have below code,
System.in.read();
when started this project, it will hold on. Then I will to access http://localhost:8081/configprops, but show below message:
This webpage is not available
So how could access actuator endpoints in non-web application?
BTW why I want to do so, because when started my project it can't load yml data successfully and caused NPE. So I want to access /configprops to check it.
My yml like this:
spring:
profiles.active: default
---
spring:
profiles: default
user:
foo:
aaa: aaa#foo.com
---
spring:
profiles: test
user:
foo:
aaa: aaa#foo.com
bbb: bbb#foo.com
#ConfigurationProperties(prefix="user", locations="user.yml")
public class UserConfig {
private HashMap<String, String> foo;
}
In a non web application you can access the Actuator endpoints with JMX. Use JConsole or JVisualVM to read the MBeans. See the Spring Boot documentation for more details: http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#production-ready-jmx
Thanks #dunni in jconsole MBeans tab you could see
when click getData I got a list , one line told me
userConfig={prefix=user, properties={foo=null}}
I have a Spring Boot application with Spring Cloud components, namely org.springframework.cloud:spring-cloud-starter-aws-parameter-store-config.
The component produces logs at WARN level when the application starts which I want to suppress.
Setting a log level in the application.yml like
logging:
level:
org.springframework.cloud.aws.paramstore.AwsParamStorePropertySourceLocator: ERROR
did not work. Apparently its because this cloud component works at bootstrap time before the Spring Boot context starts and the application.yml is read.
How can I suppress this component logs in the best way?
I have the same issue as below. A very simple Hystrix spring boot application failing to load actuator /hystrix.stream.
Application uses Spring boot starter parent 1.5.x and hystrix 1.5.x libs. It worked well with Spring boot 1.3.x. Other actuators are good.
There's seems to be a known problem with 1.4.x and 1.5.x, however I'm looking for some workaround. Please don't suggest solutions for Spring boot 2.0.x.
From the github issue:
https://github.com/Netflix/Hystrix/issues/1566
We are using the Spring boot starter parent 1.5.2.RELEASE and hystrix 1.5.6 dependencies.
Fortunately it works once in hundred tries. We are really puzzled, why it works once and then never. All the services are running on the local machine.
The log details are as below:
Proxy opening connection to: http://localhost:6001/hystrix.stream
2017-05-05 12:29:16.951 INFO 4876 --- [nio-6001-exec-5] ashboardConfiguration$ProxyStreamServlet :
Proxy opening connection to: http://localhost:6001/hystrix.stream
2017-05-05 12:31:36.163 INFO 4876 --- [trap-executor-0] c.n.d.s.r.aws.ConfigClusterResolver : Resolving eureka endpoints via configuration
If we try to curl the end point instead of getting back a snapshot of data, we get
Previous versions of Spring-boot 1.3.x did not have an issue. At first sight, this seems to be an incompatibility with Spring-boot or one of it's dependencies since our team had not had issues until a recent upgrade with Hystrix.
Noteworthy comment is that all other parts of Hystrix are working just fine. RequestLog, and at least Circuit Breaking are working as designed. For some reason the Hystrix Streaming Servlet is no longer functional for us.
The symptoms we receive for this issue are as follows:
Unable to connect to Command Stream (per description of ticket)
Access log receives 503 http status entry for hystrix.stream end point
I'm setting up a microservice architecture using Spring Boot and Eureka. I followed several tutorials. However, the Eureka server is showing a login when trying to open the dashboard. Also, registration of a client fails (I think because of the enabled security).
How can I disable the security?
This is my configuration:
eureka.instance.hostname=localhost
eureka.client.registerWithEureka=false
eureka.client.fetchRegistry=false
eureka.environment=dev
server.port=1112
I'm using a .properties file instead of .yml. What I tried is to add the property
security.basic.enabled=false
but the result was the same. So I tried to configure Spring Boot Security by myself but this caused 404 HTTP errors because the '/login'-controller was not found (and I don't want to develop this at the moment).
You have added two starter security dependencies in your Gradle. Those are configuring basic username password security. Please remove them.
you can also exclude the SecurityAutoConfiguration in your spring application main class
#SpringBootApplication(exclude = {SecurityAutoConfiguration.class})