Hello,
I just created a bamboo plugin skeleton by this command “atlas-create-bamboo-plugin”
and I created a rest API module.
But after that, I use Agent manager and generate a setter for that so that spring can inject the dependency but it is still null
import com.atlassian.bamboo.buildqueue.manager.AgentManager;
import com.atlassian.plugin.spring.scanner.annotation.component.Scanned;
import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport;
import com.atlassian.plugins.rest.common.security.AnonymousAllowed;
import org.springframework.beans.factory.annotation.Autowired;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
/**
* A resource of message.
*/
@Path("/message")
public class AgfentApi {
public void setAgentManager(AgentManager agentManager) {
this.agentManager = agentManager;
}
private AgentManager agentManager;
@GET
@AnonymousAllowed
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Response getMessage()
{
if(agentManager!=null)
return Response.ok(new AgfentApiModel("success")).build();
else
return Response.ok(new AgfentApiModel("not success")).build();
}
}
I am getting the output as “not success” .Output for the api call
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<message>
<value>not success</value>
</message>
I am using bamboo 6.8.0 version plugin skeleton.
Is this is any bug or I works fine for others??