I'm creating a new project using spring boot + apache camel + jpa.
It's supposed to be very simple, but something is misconfigured and I can't find what is it.
The apache camel route seems to be working but the database connection seems not.
Main app:
@SpringBootApplication
@EnableAutoConfiguration
public class PolicyUpdateWebServiceApplication {
protected static final Logger LOG = Logger.getLogger(PolicyUpdateWebServiceApplication.class);
public static void main(String[] args) {
new SpringApplication(PolicyUpdateWebServiceApplication.class).run(args);
}
@Bean
public ServletRegistrationBean dispatcherServlet() {
return new ServletRegistrationBean(new CXFServlet(), "/webservices/*");
}
@Bean(name= Bus.DEFAULT_BUS_ID)
public SpringBus springBus() {
return new SpringBus();
}
}
Entity:
@Entity
@XmlRootElement(
name = "TransactionInfo"
)
@XmlCDATA({"bookingXML"})
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(
name = "TransactionInfo",
propOrder = {"transactionId", "CCVB", "quoteNumber", "policyNumber", "bookingXML", "creationDate", "lastModified", "status", "statusDescription"}
)
public class TransactionInfo implements Serializable {
private static final long serialVersionUID = -2368497973443507661L;
@Id
private String transactionId;
@Embedded
@Column(nullable = false)
private CCVB CCVB;
@Column(nullable = false, length = 50)
private String quoteNumber;
@Column(nullable = false, length = 50)
private String policyNumber;
@Column(nullable = false)
private String bookingXML;
@XmlJavaTypeAdapter(XMLDateAdapter.class)
@Column(nullable = false, updatable = false)
private Date creationDate;
@XmlJavaTypeAdapter(XMLDateAdapter.class)
@Column(nullable = false)
private Date lastModified;
@Column(length = 4, nullable = false)
private IntegrationStatus status;
@Column(length = 100)
private String statusDescription;
Repository:
@Repository
public interface TransactionInfoRepository extends CrudRepository<TransactionInfo, String> {
TransactionInfo findByTransactionId(String name);
TransactionInfo save(TransactionInfo TransactionInfo);
}
Service:
public interface TransactionInfoService {
void saveTransactionInfo(TransactionInfo transactionInfo);
}
Service Implementation:
@Component("transactionInfoService")
@Transactional
public class TransactionInfoServiceImpl implements TransactionInfoService {
@Autowired
TransactionInfoRepository transactionInfoRepository;
public void saveTransactionInfo(TransactionInfo transactionInfo) {
transactionInfoRepository.save(transactionInfo);
}
}
During the apache route... I have the code:
public class PolicyPublishProcessor implements Processor {
@Autowired
TransactionInfoService transactionInfoService;
TransactionInfo transactionInfo = new TransactionInfo();
// save a couple of customers
transactionInfoService.saveTransactionInfo(transactionInfo);
However, when I turn the debug... I can see that the transactionInfoService variable, which is supposed to be injected... is coming null.
Anyone know what could be happening?
Thanks,